37 { \ |
37 { \ |
38 const TUint8* p = (const TUint8*)&(x); \ |
38 const TUint8* p = (const TUint8*)&(x); \ |
39 DEBUGPRINT("Line %d: " #x "=%02x %02x %02x %02x %02x %02x %02x %02x", __LINE__, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]); \ |
39 DEBUGPRINT("Line %d: " #x "=%02x %02x %02x %02x %02x %02x %02x %02x", __LINE__, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]); \ |
40 } |
40 } |
41 |
41 |
|
42 #ifdef __WINS__ |
|
43 #pragma warning( disable : 4127 ) // disable warning warning C4127: conditional expression is constant |
|
44 #endif |
|
45 template<typename T> void DebugPrintVar(T x, char *name, TInt line) |
|
46 { |
|
47 const TUint8 *p = (const TUint8 *)&x; |
|
48 const TInt size = sizeof(T); |
|
49 if (size < 2) |
|
50 { |
|
51 DEBUGPRINT("Line %d: %s =%02x", line, name, p[0]); |
|
52 } |
|
53 else if (size < 4) |
|
54 { |
|
55 DEBUGPRINT("Line %d: %s =%02x %02x", line, name, p[0], p[1]); |
|
56 } |
|
57 else if (size < 8) |
|
58 { |
|
59 DEBUGPRINT("Line %d: %s =%02x %02x %02x %02x", line, name, p[0], p[1], p[2], p[3]); |
|
60 } |
|
61 else |
|
62 { |
|
63 DEBUGPRINT("Line %d: %s =%02x %02x %02x %02x %02x %02x %02x %02x", line, name, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]); |
|
64 } |
|
65 } |
|
66 #ifdef __WINS__ |
|
67 #pragma warning( default : 4127 ) // disable warning warning C4127: conditional expression is constant |
|
68 #endif |
|
69 |
|
70 |
42 extern "C" { |
71 extern "C" { |
43 |
72 |
44 // Simulated versions of atomic functions without the atomicity |
73 // Simulated versions of atomic functions without the atomicity |
45 #define __LOAD(T) return *(T*)a |
74 #define __LOAD(T) return *(T*)a |
46 #define __STORE(T) *(T*)a=v; return v |
75 #define __STORE(T) *(T*)a=v; return v |
279 } // extern "C" |
308 } // extern "C" |
280 |
309 |
281 |
310 |
282 #define DEBUGPRINTxyrc() \ |
311 #define DEBUGPRINTxyrc() \ |
283 DEBUGPRINTVAR(x); \ |
312 DEBUGPRINTVAR(x); \ |
284 DEBUGPRINTVAR(y); \ |
313 DebugPrintVar(y, "y", __LINE__); \ |
285 DEBUGPRINTVAR(r); \ |
314 DebugPrintVar(r, "r", __LINE__); \ |
286 DEBUGPRINTVAR(c) |
315 DebugPrintVar(c, "c", __LINE__) |
|
316 |
287 |
317 |
288 template<class T> TInt DoLoadTest(TInt aIndex, TAny* aPtr, T aInitialValue) |
318 template<class T> TInt DoLoadTest(TInt aIndex, TAny* aPtr, T aInitialValue) |
289 { |
319 { |
290 #ifdef __EXTRA_DEBUG__ |
320 #ifdef __EXTRA_DEBUG__ |
291 DEBUGPRINT("DoLoadTest %d %08x", aIndex, aPtr); |
321 DEBUGPRINT("DoLoadTest %d %08x", aIndex, aPtr); |
394 line = __LINE__; |
424 line = __LINE__; |
395 if (line) |
425 if (line) |
396 { |
426 { |
397 DEBUGPRINT("r=%d",r); |
427 DEBUGPRINT("r=%d",r); |
398 DEBUGPRINTVAR(x); |
428 DEBUGPRINTVAR(x); |
399 DEBUGPRINTVAR(ex); |
429 DebugPrintVar(ex, "ex", __LINE__); |
400 DEBUGPRINT("c=%d",c); |
430 DEBUGPRINT("c=%d",c); |
401 DEBUGPRINTVAR(y); |
431 DebugPrintVar(y, "y", __LINE__); |
402 DEBUGPRINTVAR(ey); |
432 DebugPrintVar(ey, "ey", __LINE__); |
403 } |
433 } |
404 return line; |
434 return line; |
405 } |
435 } |
406 |
436 |
407 |
437 |