Changeset 63 in libcf for trunk/src/cf_debug.c
- Timestamp:
- 04/09/13 11:20:55 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/cf_debug.c
r62 r63 414 414 415 415 /** 416 * 함수 진입을 명시 (글로벌 컨텍스트) 417 * 418 * @return 성공 시, CF_OK; 실패 시, 오류 코드 419 * 420 * @param file 파일 경로 421 * @param func 함수 이름 422 * @param line 라인 넘버 423 * 424 * @see CF_Debug_LeaveFunction 425 */ 426 int 427 CF_Debug_EnterFunction (const char * file, 428 const char * func, 429 const int line) 430 { 431 CF_DEBUG_CTX * ctx = (CF_DEBUG_CTX *)gDebugSingleCtx; 432 433 ASSERT_CTX (ctx); 434 435 CF_Mutex_Lock (&ctx->mutex); 436 CF_Debug_CallStackPush (gDebugSingleCtx, file, func, line); 437 CF_Mutex_Unlock (&ctx->mutex); 438 439 return CF_OK; 440 } 441 442 /** 443 * 함수 종료를 명시 (글로벌 컨텍스트) 444 * 445 * @return 성공 시, CF_OK; 실패 시, 오류 코드 446 * 447 * @see CF_Debug_EnterFunction 448 */ 449 int 450 CF_Debug_LeaveFunction (void) 451 { 452 CF_DEBUG_CTX * ctx = (CF_DEBUG_CTX *)gDebugSingleCtx; 453 454 ASSERT_CTX (ctx); 455 456 CF_Mutex_Lock (&ctx->mutex); 457 CF_Debug_CallStackPop (gDebugSingleCtx, NULL); 458 CF_Mutex_Unlock (&ctx->mutex); 459 460 return CF_OK; 461 } 462 463 /** 416 464 * 현재 콜스택을 출력 (글로벌 컨텍스트) 417 465 * … … 428 476 CF_DEBUG_CALLSTACK * callstack = NULL; 429 477 430 if (ctx == NULL) 431 return CF_ERROR_DEBUG_INVALID_CTX; 478 ASSERT_CTX (ctx); 432 479 433 480 for ( callstack = ctx->callstack.caller … … 435 482 ; callstack = callstack->caller) 436 483 { 437 fprintf (fp, "#%-4d %s <%s:%d>\n", 438 iter++, 439 callstack->func, 440 callstack->file, 441 callstack->line); 442 } 443 444 return CF_OK; 445 } 446 447 /** 448 * 함수 진입을 명시 (글로벌 컨텍스트) 449 * 450 * @return 성공 시, CF_OK; 실패 시, 오류 코드 451 * 452 * @param file 파일 경로 453 * @param func 함수 이름 454 * @param line 라인 넘버 455 * 456 * @see CF_Debug_LeaveFunction 457 */ 458 int 459 CF_Debug_EnterFunction (const char * file, 460 const char * func, 461 const int line) 462 { 463 CF_DEBUG_CTX * ctx = (CF_DEBUG_CTX *)gDebugSingleCtx; 464 465 ASSERT_CTX (ctx); 466 467 CF_Mutex_Lock (&ctx->mutex); 468 CF_Debug_CallStackPush (gDebugSingleCtx, file, func, line); 469 CF_Mutex_Unlock (&ctx->mutex); 470 471 return CF_OK; 472 } 473 474 /** 475 * 함수 종료를 명시 (글로벌 컨텍스트) 476 * 477 * @return 성공 시, CF_OK; 실패 시, 오류 코드 478 * 479 * @see CF_Debug_EnterFunction 480 */ 481 int 482 CF_Debug_LeaveFunction (void) 483 { 484 CF_DEBUG_CTX * ctx = (CF_DEBUG_CTX *)gDebugSingleCtx; 485 486 ASSERT_CTX (ctx); 487 488 CF_Mutex_Lock (&ctx->mutex); 489 CF_Debug_CallStackPop (gDebugSingleCtx, NULL); 490 CF_Mutex_Unlock (&ctx->mutex); 491 492 return CF_OK; 493 } 484 fprintf (fp == NULL ? stderr : fp, 485 "#%-4d %s <%s:%d>\n", 486 iter++, 487 callstack->func, 488 callstack->file, 489 callstack->line); 490 } 491 492 return CF_OK; 493 }
Note:
See TracChangeset
for help on using the changeset viewer.