diff options
author | Mike Buland <eichlan@xagasoft.com> | 2009-08-21 22:12:10 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2009-08-21 22:12:10 +0000 |
commit | 78499c848a9c2bafe1db1ec7ceaf8556e2d7c7cc (patch) | |
tree | 60cc931b6d398b478ac99d6f946e6fbc72d24fb2 /src/sharedcore.cpp | |
parent | 539d6bf53bcece62e29d3d7d900b83dc03275b65 (diff) | |
download | libbu++-78499c848a9c2bafe1db1ec7ceaf8556e2d7c7cc.tar.gz libbu++-78499c848a9c2bafe1db1ec7ceaf8556e2d7c7cc.tar.bz2 libbu++-78499c848a9c2bafe1db1ec7ceaf8556e2d7c7cc.tar.xz libbu++-78499c848a9c2bafe1db1ec7ceaf8556e2d7c7cc.zip |
Added loads of debugging to sharedcore, we're sure it's to blame, but not as
much anymore, for the fishtrax issues, maybe.
Diffstat (limited to 'src/sharedcore.cpp')
-rw-r--r-- | src/sharedcore.cpp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/sharedcore.cpp b/src/sharedcore.cpp index 6333335..24d8972 100644 --- a/src/sharedcore.cpp +++ b/src/sharedcore.cpp | |||
@@ -7,3 +7,70 @@ | |||
7 | 7 | ||
8 | #include "bu/sharedcore.h" | 8 | #include "bu/sharedcore.h" |
9 | 9 | ||
10 | void hardlog(const char *fmt, ...) | ||
11 | { | ||
12 | va_list ap; | ||
13 | va_start( ap, fmt ); | ||
14 | |||
15 | FILE *fh = fopen("sharedcore.log", "ab"); | ||
16 | vfprintf( fh, fmt, ap ); | ||
17 | va_end( ap ); | ||
18 | fclose( fh ); | ||
19 | } | ||
20 | |||
21 | int iDepth = 0; | ||
22 | |||
23 | void fncin( void *base, const char *fn, void *core, int *iRefCount, int params, ... ) | ||
24 | { | ||
25 | va_list ap; | ||
26 | va_start( ap, params ); | ||
27 | |||
28 | FILE *fh = fopen("sharedcore.log", "ab"); | ||
29 | fprintf( fh, "%08X: ", base ); | ||
30 | for( int j = 0; j < iDepth; j++ ) | ||
31 | fprintf( fh, " " ); | ||
32 | fprintf( fh, "%s(", fn ); | ||
33 | for( int j = 0; j < params; j++ ) | ||
34 | if( j == 0 ) | ||
35 | fprintf( fh, " %08X", va_arg( ap, void * ) ); | ||
36 | else | ||
37 | fprintf( fh, ", %08X", va_arg( ap, void * ) ); | ||
38 | if( params > 0 ) | ||
39 | fprintf( fh, " )"); | ||
40 | else | ||
41 | fprintf( fh, ")"); | ||
42 | |||
43 | fprintf( fh, " [%08X / %08X] (%d)\n", core, iRefCount, rc ); | ||
44 | va_end( ap ); | ||
45 | fclose( fh ); | ||
46 | |||
47 | iDepth++; | ||
48 | } | ||
49 | |||
50 | void fncout( void *base, const char *fn, void *core, int *iRefCount, int params, ... ) | ||
51 | { | ||
52 | va_list ap; | ||
53 | va_start( ap, params ); | ||
54 | |||
55 | iDepth--; | ||
56 | |||
57 | FILE *fh = fopen("sharedcore.log", "ab"); | ||
58 | fprintf( fh, "%08X: ", base ); | ||
59 | for( int j = 0; j < iDepth; j++ ) | ||
60 | fprintf( fh, " " ); | ||
61 | fprintf( fh, "%s(", fn ); | ||
62 | for( int j = 0; j < params; j++ ) | ||
63 | if( j == 0 ) | ||
64 | fprintf( fh, " %08X", va_arg( ap, void * ) ); | ||
65 | else | ||
66 | fprintf( fh, ", %08X", va_arg( ap, void * ) ); | ||
67 | if( params > 0 ) | ||
68 | fprintf( fh, " )"); | ||
69 | else | ||
70 | fprintf( fh, ")"); | ||
71 | |||
72 | fprintf( fh, " [%08X / %08X] (%d)\n", core, iRefCount, rc ); | ||
73 | va_end( ap ); | ||
74 | fclose( fh ); | ||
75 | } | ||
76 | |||