Changeset 34 in libcf for trunk/include/cf_debug.h
- Timestamp:
- 02/05/13 11:26:59 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/cf_debug.h
r30 r34 11 11 * 환경에 적합하도록 사용자가 구성한 컨텍스트를 이용하여 사용할 수도 있음 <br /> 12 12 * (단, 콜스택의 푸시/팝은 컨텍스트를 이용해야만 사용 가능) 13 * 14 * @section 샘플코드 15 * @code 16 17 #include "cf_debug.h" 18 19 CF_Debug_Ctx gDebugCtx; 20 21 void callee (void) { 22 CF_Debug_CallStack callstack; 23 24 CF_DEBUG_CALLSTACK_PUSH (gDebugCtx); 25 CF_DEBUG_CALLSTACK_POP (gDebugCtx, &callstack); 26 } 27 28 int main (void) { 29 int fd = 0; 30 gDebugCtx = CF_Debug_CreateCtx (); 31 32 CF_DEBUG_CALLSTACK_PUSH (gDebugCtx); 33 34 CF_DEBUG_TRACE (gDebugCtx, "print trace message with context to stderr\n"); 35 36 fd = CF_File_Create ("debug.txt"); 37 if (fd < 0) { 38 CF_DEBUG_PRINT (stderr, "error ...\n"); 39 // error 40 } 41 CF_Debug_SetOutputFD (gDebugCtx, fd); 42 43 CF_DEBUG_TRACE (gDebugCtx, "print trace message with context to debug.txt\n"); 44 45 CF_DEBUG_CALLSTACK_POP (gDebugCtx, NULL); 46 47 CF_Debug_DestroyCtx (gDebugCtx); 48 49 return 0; 50 } 51 52 * @endcode 13 53 */ 14 54 #ifndef __CF_DEBUG_H__ … … 19 59 #include <stdio.h> 20 60 21 /** 잘못된 컨텍스트 오류 */22 61 #define CF_ERROR_DEBUG_INVALID_CTX CF_ERROR_DEBUG - 1 23 24 /** 디버그 메시지 출력을 위한 파일 포인터 설정 오류 */25 62 #define CF_ERROR_DEBUG_SET_OUTPUT_FD CF_ERROR_DEBUG - 2 26 27 /** 콜스택 푸시 오류 */28 63 #define CF_ERROR_DEBUG_PUSH_CALLSTACK CF_ERROR_DEBUG - 3 29 30 /** 콜스택 팝 오류 */31 64 #define CF_ERROR_DEBUG_POP_CALLSTACK CF_ERROR_DEBUG - 4 32 65
Note:
See TracChangeset
for help on using the changeset viewer.