13 #define BACKTRACE_DEPTH 5
25 void *backtrace[BACKTRACE_DEPTH];
26 unsigned char btcount;
31 typedef std::map<unsigned int, ALLOC_INFO> AllocList;
33 extern AllocList *allocList;
34 extern pthread_mutex_t memLock;
36 static inline void AddTrack(
unsigned int addr,
unsigned int asize,
const char *fname,
unsigned int lnum,
unsigned int type)
41 allocList =
new(AllocList);
50 (*allocList)[addr]=
info;
53 static inline void RemoveTrack(
unsigned int addr,
unsigned int type)
57 AllocList::iterator i;
59 i = allocList->find(addr);
60 if ( i != allocList->end() )
62 if ( i->second.type != type )
69 inline void *
operator new(
size_t size,
const char *
file,
int line)
71 void *
ptr = (
void *)malloc(
size);
76 inline void operator delete(
void *
p)
78 RemoveTrack((
unsigned int)
p,1);
82 inline void *
operator new[](
size_t size,
const char *
file,
int line)
84 void *
ptr = (
void *)malloc(
size);
89 inline void operator delete[](
void *
p)
91 RemoveTrack((
unsigned int)
p, 2);
96 #define new new(__FILE__, __LINE__)
110 #define CHECKFORMAT __attribute__ ((__format__(__printf__, 2, 3)))
122 #define DEFAULT_DEBUG_LVL 4
125 # define MAX_DEBUG_LEVEL 0
127 # ifndef MAX_DEBUG_LEVEL
128 # define MAX_DEBUG_LEVEL 5
135 #define eDebugLow(lvl, flags, ...) \
137 if (((lvl) <= MAX_DEBUG_LEVEL) && ((lvl) <= debugLvl)) \
138 eDebugImpl((flags), __VA_ARGS__); \
141 #define _DBGFLG_NONEWLINE 1
142 #define _DBGFLG_NOTIME 2
143 #define _DBGFLG_FATAL 4
144 #define eFatal(...) eDebugLow(lvlFatal, _DBGFLG_FATAL, __VA_ARGS__)
145 #define eLog(lvl, ...) eDebugLow(lvl, 0, ##__VA_ARGS__)
146 #define eLogNoNewLineStart(lvl, ...) eDebugLow(lvl, _DBGFLG_NONEWLINE, ##__VA_ARGS__)
147 #define eLogNoNewLine(lvl, ...) eDebugLow(lvl, _DBGFLG_NOTIME | _DBGFLG_NONEWLINE, ##__VA_ARGS__)
148 #define eWarning(...) eDebugLow(lvlWarning, 0, __VA_ARGS__)
149 #define eDebug(...) eDebugLow(lvlDebug, 0, __VA_ARGS__)
150 #define eDebugNoNewLineStart(...) eDebugLow(lvlDebug, _DBGFLG_NONEWLINE, __VA_ARGS__)
151 #define eDebugNoNewLine(...) eDebugLow(lvlDebug, _DBGFLG_NOTIME | _DBGFLG_NONEWLINE, __VA_ARGS__)
152 #define eTrace(...) eDebugLow(lvlTrace, 0, ##__VA_ARGS__)
153 #define eTraceNoNewLineStart(...) eDebugLow(lvlTrace, _DBGFLG_NONEWLINE, ##__VA_ARGS__)
154 #define eTraceNoNewLine(...) eDebugLow(lvlTrace, _DBGFLG_NOTIME | _DBGFLG_NONEWLINE, ##__VA_ARGS__)
155 #define ASSERT(x) { if (!(x)) eFatal("%s:%d ASSERTION %s FAILED!", __FILE__, __LINE__, #x); }
static int ptr
Definition: bcm.cpp:17
void ePythonOutput(const char *, int lvl=lvlDebug)
Definition: eerror.cpp:215
#define CHECKFORMAT
Definition: eerror.h:110
int eGetEnigmaDebugLvl()
Definition: eerror.cpp:223
void CHECKFORMAT eDebugImpl(int flags, const char *,...)
Definition: eerror.cpp:167
@ lvlInfo
Definition: eerror.h:120
@ lvlDebug
Definition: eerror.h:120
@ lvlTrace
Definition: eerror.h:120
@ lvlError
Definition: eerror.h:120
@ lvlFatal
Definition: eerror.h:120
@ lvlWarning
Definition: eerror.h:120
int debugLvl
Definition: eerror.cpp:79
unsigned char address
Definition: hdmi_cec.h:0
size
Definition: Plugins/SystemPlugins/PositionerSetup/log.py:16
line
Definition: newplugin.py:87
file
Definition: newplugin.py:100
p
Definition: upgrade.py:63