source:
libcf/trunk/test/debug.c@
151
Last change on this file since 151 was 151, checked in by , 11 years ago | |
---|---|
File size: 1.0 KB |
Rev | Line | |
---|---|---|
[35] | 1 | /** |
2 | * @file debug.c | |
3 | * @author myusgun <myusgun@gmail.com> | |
4 | */ | |
5 | #include "cf_file.h" | |
6 | #include "cf_debug.h" | |
7 | ||
[51] | 8 | #include <string.h> |
[35] | 9 | |
[151] | 10 | void callee3 (void) |
11 | { | |
[135] | 12 | CF_DEBUG_BEGIN_FUNCTION; |
13 | ||
[64] | 14 | // ... |
[135] | 15 | CF_DEBUG_PRINT_CALLSTACK (stdout); |
16 | // ... | |
[64] | 17 | |
18 | CF_DEBUG_END_FUNCTION; | |
19 | } | |
20 | ||
[151] | 21 | void callee2 (void) |
22 | { | |
[135] | 23 | CF_DEBUG_BEGIN_FUNCTION; |
24 | ||
[64] | 25 | // ... |
[135] | 26 | callee3 (); |
27 | // ... | |
[64] | 28 | |
[51] | 29 | CF_DEBUG_END_FUNCTION; |
[35] | 30 | } |
31 | ||
[151] | 32 | void callee1 (void) |
33 | { | |
[135] | 34 | CF_DEBUG_BEGIN_FUNCTION; |
35 | ||
[64] | 36 | // ... |
[135] | 37 | callee2 (); |
38 | // ... | |
[64] | 39 | |
40 | CF_DEBUG_END_FUNCTION; | |
41 | } | |
42 | ||
[151] | 43 | int main (void) |
44 | { | |
[51] | 45 | char data[] = |
46 | "【 曲名 : 사랑하고 있는데 】\n" | |
47 | "《 歌 : Kylee 》\n" | |
48 | "『 절원의 템페스트 OP2 Theme 』\n"; | |
[35] | 49 | |
[135] | 50 | /* init. once */ |
[62] | 51 | CF_DEBUG_INITIALIZE; |
[35] | 52 | |
[135] | 53 | /* at begin function */ |
54 | CF_DEBUG_BEGIN_FUNCTION; | |
55 | ||
56 | /* print */ | |
[51] | 57 | CF_DEBUG_PRINT (stderr, "print message with context to stderr\n"); |
[35] | 58 | |
[64] | 59 | CF_DEBUG_PRINT_BIN (stdout, (unsigned char *) data, (int) sizeof (data), "data : \n%s", data); |
[35] | 60 | |
[135] | 61 | /* step into other function with cf debugging util */ |
[64] | 62 | callee1 (); |
[135] | 63 | |
64 | /* at leave function */ | |
[64] | 65 | CF_DEBUG_END_FUNCTION; |
[35] | 66 | |
[62] | 67 | CF_DEBUG_FINALIZE; |
[35] | 68 | |
69 | return 0; | |
70 | } |
Note:
See TracBrowser
for help on using the repository browser.