Changeset 51 in libcf for trunk/include/cf_debug.h
- Timestamp:
- 04/02/13 10:23:52 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/cf_debug.h
r50 r51 27 27 28 28 #ifdef _DEBUG 29 /**30 * 디버그 컨텍스트 생성31 *32 * @see CF_Debug_CreateCtx33 */34 # define CF_DEBUG_CREATE_CTX() \35 CF_Debug_CreateCtx ()36 37 /**38 * 디버그 컨텍스트 해제39 *40 * @param __ctx 디버그 컨텍스트41 *42 * @see CF_Debug_DestroyCtx43 */44 # define CF_DEBUG_DESTROY_CTX(__ctx) \45 CF_Debug_DestroyCtx (__ctx)46 29 47 30 /** 48 31 * 디버그 메시지를 지정된 파일 포인터로 출력 49 32 * 50 * @param __fp 파일 포인터. 표준출력(stdout) 및 표준오류(stderr) 사용 가능51 33 * @param __fmt 포맷 스트링 52 34 * @param ... 가변 인자 … … 60 42 * 바이너리 데이터를 디버그 메시지와 함께 지정된 파일 포인터로 출력 61 43 * 62 * @param __fp 파일 포인터. 표준출력(stdout) 및 표준오류(stderr) 사용 가능63 44 * @param __bin 바이너리 데이터 64 45 * @param __len 바이너리 길이 … … 72 53 73 54 /** 74 * 컨텍스트를 업데이트하고 디버그 메시지를 출력55 * 함수에 진입 75 56 * 76 * @param __ctx 디버그 컨텍스트 77 * @param __fmt 포맷 스트링 78 * @param ... 가변 인자 79 * 80 * @see CF_Debug_Trace 57 * @see CF_Debug_EnterFunction 81 58 */ 82 # define CF_DEBUG_ TRACE(__ctx,__fmt,...)\83 CF_Debug_ Trace (__ctx,__FILE__,__func__,__LINE__,__fmt,##__VA_ARGS__)59 # define CF_DEBUG_BEGIN_FUNCTION \ 60 CF_Debug_EnterFunction (__FILE__,__func__,__LINE__) 84 61 85 62 /** 86 * 컨텍스트를 업데이트하고 바이너리 데이터를 디버그 메시지와 함께 출력63 * 함수에서 종료 87 64 * 88 * @param __ctx 디버그 컨텍스트 89 * @param __bin 바이너리 데이터 90 * @param __len 바이너리 길이 91 * @param __fmt 포맷 스트링 92 * @param ... 가변 인자 93 * 94 * @see CF_Debug_TraceBin 65 * @see CF_Debug_LeaveFunction 95 66 */ 96 # define CF_DEBUG_ TRACE_BIN(__ctx,__bin,__len,__fmt,...)\97 CF_Debug_ TraceBin (__ctx,__FILE__,__func__,__LINE__,__bin,__len,__fmt,##__VA_ARGS__)67 # define CF_DEBUG_END_FUNCTION \ 68 CF_Debug_LeaveFunction () 98 69 99 /**100 * 컨텍스트에 콜스택 푸시101 *102 * @param __ctx 디버그 컨텍스트103 *104 * @see CF_Debug_CallStackPush105 */106 # define CF_DEBUG_CALLSTACK_PUSH(__ctx) \107 CF_Debug_CallStackPush (__ctx,__FILE__,__func__,__LINE__)108 109 /**110 * 컨텍스트에서 콜스택 팝111 *112 * @param __ctx 디버그 컨텍스트113 * @param __callstack 콜스택 정보를 가져올 콜스택 데이터 구조체 포인터114 *115 * @see CF_Debug_CallStackPop, CF_Debug_CallStack116 */117 # define CF_DEBUG_CALLSTACK_POP(__ctx,__callstack) \118 CF_Debug_CallStackPop (__ctx,__callstack)119 70 #else // #ifdef _DEBUG 120 # define CF_DEBUG_CREATE_CTX() NULL121 # define CF_DEBUG_DESTROY_CTX(__ctx)122 71 # define CF_DEBUG_PRINT(__fp,__fmt,...) 123 72 # define CF_DEBUG_PRINT_BIN(__fp,__bin,__len,__fmt,...) 124 # define CF_DEBUG_TRACE(__ctx,__fmt,...) 125 # define CF_DEBUG_TRACE_BIN(__ctx,__bin,__len,__fmt,...) 126 # define CF_DEBUG_CALLSTACK_PUSH(__ctx) 127 # define CF_DEBUG_CALLSTACK_POP(__ctx,__callstack) 1 73 # define CF_DEBUG_BEGIN_FUNCTION 74 # define CF_DEBUG_END_FUNCTION 128 75 #endif // #ifdef _DEBUG 129 130 /** 디버그 컨텍스트 */131 typedef void * CF_Debug_Ctx;132 133 /** 콜스택 데이터 */134 typedef struct cf_debug_callStack {135 char file[NAME_LENGTH + 1]; /**< 파일 이름 */136 char function[NAME_LENGTH + 1]; /**< 함수 이름 */137 int line; /**< 라인 넘버 */138 } CF_Debug_CallStack;139 76 140 77 #ifdef __cplusplus 141 78 extern "C" { 142 79 #endif 143 144 CF_EXPORT CF_Debug_Ctx145 CF_Debug_CreateCtx (void);146 147 CF_EXPORT int148 CF_Debug_DestroyCtx (CF_Debug_Ctx ctx);149 150 CF_EXPORT int151 CF_Debug_SetOutputFD (CF_Debug_Ctx ctx,152 int fd);153 80 154 81 CF_EXPORT int … … 169 96 170 97 CF_EXPORT int 171 CF_Debug_Trace (CF_Debug_Ctx ctx, 172 const char * file, 173 const char * func, 174 const int line, 175 const char * fmt, ...); 98 CF_Debug_PrintCallStack (FILE * fp); 176 99 177 100 CF_EXPORT int 178 CF_Debug_TraceBin (CF_Debug_Ctx ctx, 179 const char * file, 180 const char * func, 181 const int line, 182 const unsigned char * bin, 183 const int len, 184 const char * fmt, ...); 101 CF_Debug_EnterFunction (const char * file, 102 const char * func, 103 const int line); 185 104 186 105 CF_EXPORT int 187 CF_Debug_CallStackPush (CF_Debug_Ctx ctx, 188 const char * file, 189 const char * func, 190 const int line); 191 192 CF_EXPORT int 193 CF_Debug_CallStackPop (CF_Debug_Ctx ctx, 194 CF_Debug_CallStack * callstack); 106 CF_Debug_LeaveFunction (void); 195 107 196 108 #ifdef __cplusplus
Note:
See TracChangeset
for help on using the changeset viewer.