Changeset 109 in libcf for trunk/src/cf_debug.c
- Timestamp:
- 06/04/13 14:25:10 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/cf_debug.c
r107 r109 25 25 return CF_ERROR_DEBUG_INVALID_CTX 26 26 27 /** 28 * 디버그 컨텍스트 29 * 30 * @remark change from public to private 31 */ 27 /** 디버그 컨텍스트 (Opaque) */ 32 28 typedef void * CF_Debug_Ctx; 33 29 34 /* * 35 * 콜스택 데이터 36 * 37 * @remark change from public to private 38 */ 30 /** 콜스택 인터페이스 */ 39 31 typedef struct cf_debug_callStack { 40 32 char file[NAME_LENGTH + 1]; /* *< 파일 이름 */ … … 43 35 } CF_Debug_CallStack; 44 36 37 /** 콜스택 컨텍스트 */ 45 38 typedef struct __cf_debug_callstack__ 46 39 { … … 52 45 53 46 struct __cf_debug_callstack__ * caller; 54 } S_CF_DEBUG_CALLSTACK, CF_DEBUG_CALLSTACK; 55 47 } CF_DEBUG_CALLSTACK; 48 49 /** 디버그 컨텍스트 (CF_Debug_Ctx의 구현) */ 56 50 typedef struct __cf_debug_ctx__ 57 51 { 58 char file[NAME_LENGTH + 1]; 59 char func[NAME_LENGTH + 1]; 60 int line; 61 62 CF_Mutex mutex; 52 int fd; 53 CF_Mutex_Ctx mutex; 63 54 64 55 CF_DEBUG_CALLSTACK callstack; 65 } S_CF_DEBUG_CTX,CF_DEBUG_CTX;56 } CF_DEBUG_CTX; 66 57 67 58 CF_Debug_Ctx gDebugSingleCtx = NULL; 68 69 static int70 CF_Debug_Local_UpdateCtx (CF_Debug_Ctx ctx,71 const char * file,72 const char * func,73 const int line)74 {75 CF_DEBUG_CTX * context = (CF_DEBUG_CTX *) ctx;76 77 ASSERT_CTX (ctx);78 79 strncpy (context->file, file, strlen (file));80 strncpy (context->func, func, strlen (func));81 context->line = line;82 83 return CF_OK;84 }85 59 86 60 static int … … 232 206 context->callstack.caller = push; 233 207 234 CF_Debug_Local_UpdateCtx (ctx, file, func, line);235 236 208 return CF_OK; 237 209 } … … 294 266 return CF_ERROR_DEBUG_PEEK_CALLSTACK; 295 267 296 memset (context->file, 0x00, sizeof (context->file));297 memset (context->func, 0x00, sizeof (context->func));298 context->line = 0;299 300 /* restore current context */301 if (pop->caller != NULL)302 {303 CF_Debug_Local_UpdateCtx (ctx,304 pop->caller->file,305 pop->caller->func,306 pop->caller->line);307 }308 309 268 context->callstack.caller = pop->caller; 310 269 free (pop); … … 333 292 334 293 if (context->mutex) 335 CF_Mutex_Destory (&context->mutex);294 CF_Mutex_DestoryCtx (&context->mutex); 336 295 337 296 free (context); … … 357 316 if (context == NULL) 358 317 { 359 result = CF_ERROR_DEBUG_ ALLOCATE_CTX;318 result = CF_ERROR_DEBUG_CREATE_CTX; 360 319 TRY_BREAK; 361 320 } 362 321 363 result = CF_Mutex_Create (&context->mutex);322 result = CF_Mutex_CreateCtx (&context->mutex); 364 323 if (result < 0) 365 324 {
Note:
See TracChangeset
for help on using the changeset viewer.