#include <signal.h>
#include <stdio.h>
#include <string>
#include <vector>
#include <libgen.h>
#include <sys/time.h>
#include <execinfo.h>
Go to the source code of this file.
|
#define | DLOG_BASENAME_ONLY 1 |
|
#define | dLog_pre() fprintf(stderr, "[%s:%i:%s] ", basename(__FILE__), __LINE__, __func__) |
|
#define | dLog(...) |
|
#define | dBreak() |
|
#define | dBreakIf(x) |
|
#define | dBreakCount(x) |
|
#define | PERF_TIMER_START |
|
#define | PERF_TIMER_STOP gettimeofday(&PERF_TIMER_T2, NULL); |
|
#define | PERF_TIMER_DELTA ((PERF_TIMER_T2.tv_usec - PERF_TIMER_T1.tv_usec) / 1000000.0 + (double)(PERF_TIMER_T2.tv_sec - PERF_TIMER_T1.tv_sec)) |
|
#define | PRINT_BACKTRACE(...) |
|
#define | VDC_LIBTRACE |
|
#define | NARG(...) NARG_(__VA_ARGS__, RSEQ_N()) |
|
#define | NARG_(...) ARG_N(__VA_ARGS__) |
|
#define | ARG_N(_1, _2, _3, _4, _5, _6, _7, _8, _9, N, ...) N |
|
#define | RSEQ_N() 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 |
|
#define | _CONCAT(a, b) a##b |
|
#define | PRINTARGS_1(x, ...) |
|
#define | PRINTARGS_2(x, ...) |
|
#define | PRINTARGS_3(x, ...) |
|
#define | PRINTARGS_4(x, ...) |
|
#define | PRINTARGS_5(x, ...) |
|
#define | PRINTARGS_6(x, ...) |
|
#define | PRINTARGS_7(x, ...) |
|
#define | PRINTARGS_8(x, ...) |
|
#define | PRINTARGS_9(x, ...) |
|
#define | _PRINTARGS(n, ...) |
|
#define | PRINTARGS(...) _PRINTARGS(NARG(__VA_ARGS__), __VA_ARGS__) |
|
#define | FTRACE_PRE() printf("%s%s(", classScopeFromPrettyFunc(__PRETTY_FUNCTION__).c_str(), __func__) |
|
#define | FTRACE(...) |
|
◆ _CONCAT
#define _CONCAT |
( |
|
a, |
|
|
|
b |
|
) |
| a##b |
◆ _PRINTARGS
#define _PRINTARGS |
( |
|
n, |
|
|
|
... |
|
) |
| |
◆ ARG_N
#define ARG_N |
( |
|
_1, |
|
|
|
_2, |
|
|
|
_3, |
|
|
|
_4, |
|
|
|
_5, |
|
|
|
_6, |
|
|
|
_7, |
|
|
|
_8, |
|
|
|
_9, |
|
|
|
N, |
|
|
|
... |
|
) |
| N |
◆ dBreak
Value: { \
dLog("Breakpoint"); \
raise(SIGTRAP); \
}
Definition at line 39 of file debug.h.
◆ dBreakCount
Value: { \
static int count = 0; \
if (++count == (x))
dBreak(); \
}
Definition at line 48 of file debug.h.
◆ dBreakIf
Value:
Definition at line 44 of file debug.h.
◆ dLog
Value: { \
dLog_pre(); \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, "\n"); \
}
Definition at line 33 of file debug.h.
◆ DLOG_BASENAME_ONLY
#define DLOG_BASENAME_ONLY 1 |
◆ dLog_pre
#define dLog_pre |
( |
| ) |
fprintf(stderr, "[%s:%i:%s] ", basename(__FILE__), __LINE__, __func__) |
◆ FTRACE
Value: do { \
FTRACE_PRE(); \
PRINTARGS(__VA_ARGS__); \
printf(");\n"); \
} while (0)
Definition at line 226 of file debug.h.
◆ FTRACE_PRE
#define FTRACE_PRE |
( |
| ) |
printf("%s%s(", classScopeFromPrettyFunc(__PRETTY_FUNCTION__).c_str(), __func__) |
◆ NARG
◆ NARG_
#define NARG_ |
( |
|
... | ) |
ARG_N(__VA_ARGS__) |
◆ PERF_TIMER_DELTA
#define PERF_TIMER_DELTA ((PERF_TIMER_T2.tv_usec - PERF_TIMER_T1.tv_usec) / 1000000.0 + (double)(PERF_TIMER_T2.tv_sec - PERF_TIMER_T1.tv_sec)) |
◆ PERF_TIMER_START
Value: struct timeval PERF_TIMER_T1, PERF_TIMER_T2; \
gettimeofday(&PERF_TIMER_T1, NULL);
Definition at line 60 of file debug.h.
◆ PERF_TIMER_STOP
#define PERF_TIMER_STOP gettimeofday(&PERF_TIMER_T2, NULL); |
◆ PRINT_BACKTRACE
#define PRINT_BACKTRACE |
( |
|
... | ) |
|
Value: { \
printf("------------------ %s", __func__); \
printf(__VA_ARGS__); \
printf(" ------------------\n"); \
void **buffer = (void **)malloc(sizeof(void *) * 32); \
int depth = backtrace(buffer, 32); \
fflush(stdout); \
backtrace_symbols_fd(buffer, depth, fileno(stdout)); \
free(buffer); \
}
Definition at line 71 of file debug.h.
◆ PRINTARGS
◆ PRINTARGS_1
#define PRINTARGS_1 |
( |
|
x, |
|
|
|
... |
|
) |
| |
◆ PRINTARGS_2
#define PRINTARGS_2 |
( |
|
x, |
|
|
|
... |
|
) |
| |
Value: { \
PRINTARG(x); \
printf(", "); \
PRINTARGS_1(__VA_ARGS__); \
}
Definition at line 173 of file debug.h.
◆ PRINTARGS_3
#define PRINTARGS_3 |
( |
|
x, |
|
|
|
... |
|
) |
| |
Value: { \
PRINTARG(x); \
printf(", "); \
PRINTARGS_2(__VA_ARGS__); \
}
Definition at line 179 of file debug.h.
◆ PRINTARGS_4
#define PRINTARGS_4 |
( |
|
x, |
|
|
|
... |
|
) |
| |
Value: { \
PRINTARG(x); \
printf(", "); \
PRINTARGS_3(__VA_ARGS__); \
}
Definition at line 185 of file debug.h.
◆ PRINTARGS_5
#define PRINTARGS_5 |
( |
|
x, |
|
|
|
... |
|
) |
| |
Value: { \
PRINTARG(x); \
printf(", "); \
PRINTARGS_4(__VA_ARGS__); \
}
Definition at line 191 of file debug.h.
◆ PRINTARGS_6
#define PRINTARGS_6 |
( |
|
x, |
|
|
|
... |
|
) |
| |
Value: { \
PRINTARG(x); \
printf(", "); \
PRINTARGS_5(__VA_ARGS__); \
}
Definition at line 197 of file debug.h.
◆ PRINTARGS_7
#define PRINTARGS_7 |
( |
|
x, |
|
|
|
... |
|
) |
| |
Value: { \
PRINTARG(x); \
printf(", "); \
PRINTARGS_6(__VA_ARGS__); \
}
Definition at line 203 of file debug.h.
◆ PRINTARGS_8
#define PRINTARGS_8 |
( |
|
x, |
|
|
|
... |
|
) |
| |
Value: { \
PRINTARG(x); \
printf(", "); \
PRINTARGS_7(__VA_ARGS__); \
}
Definition at line 209 of file debug.h.
◆ PRINTARGS_9
#define PRINTARGS_9 |
( |
|
x, |
|
|
|
... |
|
) |
| |
Value: { \
PRINTARG(x); \
printf(", "); \
PRINTARGS_8(__VA_ARGS__); \
}
Definition at line 215 of file debug.h.
◆ RSEQ_N
#define RSEQ_N |
( |
| ) |
9, 8, 7, 6, 5, 4, 3, 2, 1, 0 |
◆ VDC_LIBTRACE
◆ classScopeFromPrettyFunc()
std::string classScopeFromPrettyFunc |
( |
const std::string & |
pretty | ) |
|
|
inline |
◆ PRINTARG() [1/16]
◆ PRINTARG() [2/16]
◆ PRINTARG() [3/16]
void PRINTARG |
( |
const char * |
x | ) |
|
|
inline |
◆ PRINTARG() [4/16]
void PRINTARG |
( |
const double * |
d | ) |
|
|
inline |
◆ PRINTARG() [5/16]
void PRINTARG |
( |
const float * |
f | ) |
|
|
inline |
◆ PRINTARG() [6/16]
void PRINTARG |
( |
const int * |
i | ) |
|
|
inline |
◆ PRINTARG() [7/16]
void PRINTARG |
( |
const long * |
li | ) |
|
|
inline |
◆ PRINTARG() [8/16]
void PRINTARG |
( |
const size_t * |
li | ) |
|
|
inline |
◆ PRINTARG() [9/16]
void PRINTARG |
( |
const std::string |
x | ) |
|
|
inline |
◆ PRINTARG() [10/16]
template<class T >
void PRINTARG |
( |
const std::vector< T > |
v | ) |
|
◆ PRINTARG() [11/16]
void PRINTARG |
( |
const void * |
x | ) |
|
|
inline |
◆ PRINTARG() [12/16]
void PRINTARG |
( |
double |
x | ) |
|
|
inline |
◆ PRINTARG() [13/16]
◆ PRINTARG() [14/16]
◆ PRINTARG() [15/16]
◆ PRINTARG() [16/16]
void PRINTARG |
( |
size_t |
x | ) |
|
|
inline |