Alexandre Julliard | 808cb04 | 1995-08-17 17:11:36 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Debugger memory handling |
| 3 | * |
| 4 | * Copyright 1993 Eric Youngdale |
| 5 | * Copyright 1995 Alexandre Julliard |
Eric Pouech | d33bcb6 | 2000-03-15 19:57:20 +0000 | [diff] [blame] | 6 | * Copyright 2000 Eric Pouech |
Alexandre Julliard | 808cb04 | 1995-08-17 17:11:36 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
Marcus Meissner | b0d52b0 | 1999-02-28 19:59:00 +0000 | [diff] [blame] | 9 | #include "config.h" |
Alexandre Julliard | 808cb04 | 1995-08-17 17:11:36 +0000 | [diff] [blame] | 10 | #include <stdlib.h> |
Eric Pouech | 527eea9 | 2000-03-08 16:44:54 +0000 | [diff] [blame] | 11 | #include <string.h> |
Patrik Stridvall | 3b23362 | 2000-03-24 21:19:02 +0000 | [diff] [blame] | 12 | |
Alexandre Julliard | 808cb04 | 1995-08-17 17:11:36 +0000 | [diff] [blame] | 13 | #include "debugger.h" |
Eric Pouech | 527eea9 | 2000-03-08 16:44:54 +0000 | [diff] [blame] | 14 | #include "winbase.h" |
Alexandre Julliard | 808cb04 | 1995-08-17 17:11:36 +0000 | [diff] [blame] | 15 | |
Ulrich Weigand | b3ec4b9 | 1999-11-13 20:58:45 +0000 | [diff] [blame] | 16 | #ifdef __i386__ |
Alexandre Julliard | 954a413 | 2000-09-24 03:15:50 +0000 | [diff] [blame] | 17 | #define IS_VM86_MODE() (DEBUG_context.EFlags & V86_FLAG) |
Ulrich Weigand | 1cbf27a | 2000-06-04 01:33:21 +0000 | [diff] [blame] | 18 | #endif |
Alexandre Julliard | af0bae5 | 1995-10-03 17:06:08 +0000 | [diff] [blame] | 19 | |
Eric Pouech | 527eea9 | 2000-03-08 16:44:54 +0000 | [diff] [blame] | 20 | static void DEBUG_Die(const char* msg) |
Alexandre Julliard | af0bae5 | 1995-10-03 17:06:08 +0000 | [diff] [blame] | 21 | { |
Eric Pouech | e5efa0c | 2000-04-13 19:31:58 +0000 | [diff] [blame] | 22 | DEBUG_Printf(DBG_CHN_MESG, msg); |
Eric Pouech | 527eea9 | 2000-03-08 16:44:54 +0000 | [diff] [blame] | 23 | exit(1); |
Alexandre Julliard | af0bae5 | 1995-10-03 17:06:08 +0000 | [diff] [blame] | 24 | } |
| 25 | |
Eric Pouech | 527eea9 | 2000-03-08 16:44:54 +0000 | [diff] [blame] | 26 | void* DEBUG_XMalloc(size_t size) |
| 27 | { |
| 28 | void *res = malloc(size ? size : 1); |
| 29 | if (res == NULL) |
| 30 | DEBUG_Die("Memory exhausted.\n"); |
| 31 | memset(res, 0, size); |
| 32 | return res; |
| 33 | } |
| 34 | |
| 35 | void* DEBUG_XReAlloc(void *ptr, size_t size) |
| 36 | { |
| 37 | void* res = realloc(ptr, size); |
| 38 | if ((res == NULL) && size) |
| 39 | DEBUG_Die("Memory exhausted.\n"); |
| 40 | return res; |
| 41 | } |
| 42 | |
| 43 | char* DEBUG_XStrDup(const char *str) |
| 44 | { |
| 45 | char *res = strdup(str); |
| 46 | if (!res) |
| 47 | DEBUG_Die("Memory exhausted.\n"); |
| 48 | return res; |
| 49 | } |
| 50 | |
Alexandre Julliard | 954a413 | 2000-09-24 03:15:50 +0000 | [diff] [blame] | 51 | enum dbg_mode DEBUG_GetSelectorType( WORD sel ) |
| 52 | { |
| 53 | #ifdef __i386__ |
| 54 | LDT_ENTRY le; |
| 55 | |
| 56 | if (IS_VM86_MODE()) return MODE_VM86; |
| 57 | if (sel == 0) return MODE_32; |
| 58 | if (GetThreadSelectorEntry( DEBUG_CurrThread->handle, sel, &le)) |
| 59 | return le.HighWord.Bits.Default_Big ? MODE_32 : MODE_16; |
| 60 | /* selector doesn't exist */ |
| 61 | return MODE_INVALID; |
| 62 | #else |
| 63 | return MODE_32; |
| 64 | #endif |
| 65 | } |
Ulrich Weigand | 1cbf27a | 2000-06-04 01:33:21 +0000 | [diff] [blame] | 66 | #ifdef __i386__ |
Eric Pouech | 527eea9 | 2000-03-08 16:44:54 +0000 | [diff] [blame] | 67 | void DEBUG_FixAddress( DBG_ADDR *addr, DWORD def) |
| 68 | { |
| 69 | if (addr->seg == 0xffffffff) addr->seg = def; |
Alexandre Julliard | 954a413 | 2000-09-24 03:15:50 +0000 | [diff] [blame] | 70 | if (DEBUG_IsSelectorSystem(addr->seg)) addr->seg = 0; |
Eric Pouech | 527eea9 | 2000-03-08 16:44:54 +0000 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | /* Determine if sel is a system selector (i.e. not managed by Wine) */ |
| 74 | BOOL DEBUG_IsSelectorSystem(WORD sel) |
| 75 | { |
Alexandre Julliard | 954a413 | 2000-09-24 03:15:50 +0000 | [diff] [blame] | 76 | if (IS_VM86_MODE()) return FALSE; /* no system selectors in vm86 mode */ |
| 77 | return !(sel & 4) || ((sel >> 3) < 17); |
Eric Pouech | 527eea9 | 2000-03-08 16:44:54 +0000 | [diff] [blame] | 78 | } |
| 79 | #endif /* __i386__ */ |
| 80 | |
Ulrich Weigand | 1cbf27a | 2000-06-04 01:33:21 +0000 | [diff] [blame] | 81 | DWORD DEBUG_ToLinear( const DBG_ADDR *addr ) |
| 82 | { |
| 83 | #ifdef __i386__ |
| 84 | LDT_ENTRY le; |
| 85 | |
Alexandre Julliard | 954a413 | 2000-09-24 03:15:50 +0000 | [diff] [blame] | 86 | if (IS_VM86_MODE()) return (DWORD)(LOWORD(addr->seg) << 4) + addr->off; |
| 87 | |
Ulrich Weigand | 1cbf27a | 2000-06-04 01:33:21 +0000 | [diff] [blame] | 88 | if (DEBUG_IsSelectorSystem(addr->seg)) |
| 89 | return addr->off; |
| 90 | |
| 91 | if (GetThreadSelectorEntry( DEBUG_CurrThread->handle, addr->seg, &le)) { |
| 92 | return (le.HighWord.Bits.BaseHi << 24) + (le.HighWord.Bits.BaseMid << 16) + le.BaseLow + addr->off; |
| 93 | } |
| 94 | return 0; |
| 95 | #else |
| 96 | return addr->off; |
| 97 | #endif |
| 98 | } |
| 99 | |
Eric Pouech | 527eea9 | 2000-03-08 16:44:54 +0000 | [diff] [blame] | 100 | void DEBUG_GetCurrentAddress( DBG_ADDR *addr ) |
| 101 | { |
Eric Pouech | 527eea9 | 2000-03-08 16:44:54 +0000 | [diff] [blame] | 102 | #ifdef __i386__ |
| 103 | addr->seg = DEBUG_context.SegCs; |
| 104 | |
Alexandre Julliard | 954a413 | 2000-09-24 03:15:50 +0000 | [diff] [blame] | 105 | if (DEBUG_IsSelectorSystem(addr->seg)) |
Eric Pouech | 527eea9 | 2000-03-08 16:44:54 +0000 | [diff] [blame] | 106 | addr->seg = 0; |
| 107 | addr->off = DEBUG_context.Eip; |
Eric Pouech | 911436b | 2000-06-18 19:30:24 +0000 | [diff] [blame] | 108 | #elif defined(__sparc__) |
| 109 | addr->seg = 0; |
| 110 | addr->off = DEBUG_context.pc; |
Eric Pouech | 527eea9 | 2000-03-08 16:44:54 +0000 | [diff] [blame] | 111 | #else |
Eric Pouech | 911436b | 2000-06-18 19:30:24 +0000 | [diff] [blame] | 112 | # error You must define GET_IP for this CPU |
Eric Pouech | 527eea9 | 2000-03-08 16:44:54 +0000 | [diff] [blame] | 113 | #endif |
| 114 | } |
| 115 | |
Eric Pouech | e5efa0c | 2000-04-13 19:31:58 +0000 | [diff] [blame] | 116 | void DEBUG_InvalAddr( const DBG_ADDR* addr ) |
| 117 | { |
| 118 | DEBUG_Printf(DBG_CHN_MESG,"*** Invalid address "); |
| 119 | DEBUG_PrintAddress(addr, DEBUG_CurrThread->dbg_mode, FALSE); |
| 120 | DEBUG_Printf(DBG_CHN_MESG,"\n"); |
| 121 | if (DBG_IVAR(ExtDbgOnInvalidAddress)) DEBUG_ExternalDebugger(); |
| 122 | } |
| 123 | |
Eric Pouech | 527eea9 | 2000-03-08 16:44:54 +0000 | [diff] [blame] | 124 | void DEBUG_InvalLinAddr( void* addr ) |
| 125 | { |
| 126 | DBG_ADDR address; |
| 127 | |
Eric Pouech | 527eea9 | 2000-03-08 16:44:54 +0000 | [diff] [blame] | 128 | address.seg = 0; |
| 129 | address.off = (unsigned long)addr; |
Eric Pouech | e5efa0c | 2000-04-13 19:31:58 +0000 | [diff] [blame] | 130 | DEBUG_InvalAddr( &address ); |
Eric Pouech | 527eea9 | 2000-03-08 16:44:54 +0000 | [diff] [blame] | 131 | } |
Alexandre Julliard | af0bae5 | 1995-10-03 17:06:08 +0000 | [diff] [blame] | 132 | |
| 133 | /*********************************************************************** |
Alexandre Julliard | 808cb04 | 1995-08-17 17:11:36 +0000 | [diff] [blame] | 134 | * DEBUG_ReadMemory |
| 135 | * |
| 136 | * Read a memory value. |
| 137 | */ |
Eric Pouech | 04c16b8 | 2000-04-30 12:21:15 +0000 | [diff] [blame] | 138 | /* FIXME: this function is now getting closer and closer to |
| 139 | * DEBUG_ExprGetValue. They should be merged... |
| 140 | */ |
| 141 | int DEBUG_ReadMemory( const DBG_VALUE* val ) |
Alexandre Julliard | 808cb04 | 1995-08-17 17:11:36 +0000 | [diff] [blame] | 142 | { |
Eric Pouech | 04c16b8 | 2000-04-30 12:21:15 +0000 | [diff] [blame] | 143 | int value = 0; /* to clear any unused byte */ |
| 144 | int os = DEBUG_GetObjectSize(val->type); |
| 145 | |
| 146 | assert(sizeof(value) >= os); |
| 147 | |
| 148 | /* FIXME: only works on little endian systems */ |
| 149 | |
| 150 | if (val->cookie == DV_TARGET) { |
| 151 | DBG_ADDR addr = val->addr; |
| 152 | void* lin; |
| 153 | |
Ulrich Weigand | 1cbf27a | 2000-06-04 01:33:21 +0000 | [diff] [blame] | 154 | #ifdef __i386__ |
Eric Pouech | 04c16b8 | 2000-04-30 12:21:15 +0000 | [diff] [blame] | 155 | DEBUG_FixAddress( &addr, DEBUG_context.SegDs ); |
Ulrich Weigand | 1cbf27a | 2000-06-04 01:33:21 +0000 | [diff] [blame] | 156 | #endif |
Eric Pouech | 04c16b8 | 2000-04-30 12:21:15 +0000 | [diff] [blame] | 157 | lin = (void*)DEBUG_ToLinear( &addr ); |
| 158 | |
| 159 | DEBUG_READ_MEM_VERBOSE(lin, &value, os); |
| 160 | } else { |
| 161 | if (val->addr.off) |
| 162 | memcpy(&value, (void*)val->addr.off, os); |
| 163 | } |
Eric Pouech | 527eea9 | 2000-03-08 16:44:54 +0000 | [diff] [blame] | 164 | return value; |
Alexandre Julliard | 808cb04 | 1995-08-17 17:11:36 +0000 | [diff] [blame] | 165 | } |
| 166 | |
| 167 | |
| 168 | /*********************************************************************** |
| 169 | * DEBUG_WriteMemory |
| 170 | * |
| 171 | * Store a value in memory. |
| 172 | */ |
Eric Pouech | 04c16b8 | 2000-04-30 12:21:15 +0000 | [diff] [blame] | 173 | void DEBUG_WriteMemory( const DBG_VALUE* val, int value ) |
Alexandre Julliard | 808cb04 | 1995-08-17 17:11:36 +0000 | [diff] [blame] | 174 | { |
Eric Pouech | 04c16b8 | 2000-04-30 12:21:15 +0000 | [diff] [blame] | 175 | int os = DEBUG_GetObjectSize(val->type); |
Alexandre Julliard | 808cb04 | 1995-08-17 17:11:36 +0000 | [diff] [blame] | 176 | |
Eric Pouech | 04c16b8 | 2000-04-30 12:21:15 +0000 | [diff] [blame] | 177 | assert(sizeof(value) >= os); |
| 178 | |
| 179 | /* FIXME: only works on little endian systems */ |
| 180 | |
| 181 | if (val->cookie == DV_TARGET) { |
| 182 | DBG_ADDR addr = val->addr; |
| 183 | void* lin; |
| 184 | |
Ulrich Weigand | 1cbf27a | 2000-06-04 01:33:21 +0000 | [diff] [blame] | 185 | #ifdef __i386__ |
Eric Pouech | 04c16b8 | 2000-04-30 12:21:15 +0000 | [diff] [blame] | 186 | DEBUG_FixAddress( &addr, DEBUG_context.SegDs ); |
Ulrich Weigand | 1cbf27a | 2000-06-04 01:33:21 +0000 | [diff] [blame] | 187 | #endif |
Eric Pouech | 04c16b8 | 2000-04-30 12:21:15 +0000 | [diff] [blame] | 188 | lin = (void*)DEBUG_ToLinear( &addr ); |
| 189 | DEBUG_WRITE_MEM_VERBOSE(lin, &value, os); |
| 190 | } else { |
| 191 | memcpy((void*)val->addr.off, &value, os); |
| 192 | } |
Alexandre Julliard | 808cb04 | 1995-08-17 17:11:36 +0000 | [diff] [blame] | 193 | } |
| 194 | |
Eric Pouech | 71189b5 | 2000-07-25 12:51:56 +0000 | [diff] [blame] | 195 | /*********************************************************************** |
| 196 | * DEBUG_GrabAddress |
| 197 | * |
| 198 | * Get the address from a value |
| 199 | */ |
| 200 | BOOL DEBUG_GrabAddress( DBG_VALUE* value, BOOL fromCode ) |
| 201 | { |
| 202 | assert(value->cookie == DV_TARGET || value->cookie == DV_HOST); |
| 203 | |
| 204 | #ifdef __i386__ |
| 205 | DEBUG_FixAddress( &value->addr, |
| 206 | (fromCode) ? DEBUG_context.SegCs : DEBUG_context.SegDs); |
| 207 | #endif |
| 208 | |
| 209 | /* |
| 210 | * Dereference pointer to get actual memory address we need to be |
| 211 | * reading. We will use the same segment as what we have already, |
| 212 | * and hope that this is a sensible thing to do. |
| 213 | */ |
| 214 | if (value->type != NULL) { |
| 215 | if (value->type == DEBUG_TypeIntConst) { |
| 216 | /* |
| 217 | * We know that we have the actual offset stored somewhere |
| 218 | * else in 32-bit space. Grab it, and we |
| 219 | * should be all set. |
| 220 | */ |
| 221 | unsigned int seg2 = value->addr.seg; |
| 222 | value->addr.seg = 0; |
| 223 | value->addr.off = DEBUG_GetExprValue(value, NULL); |
| 224 | value->addr.seg = seg2; |
| 225 | } else { |
| 226 | struct datatype * testtype; |
| 227 | |
| 228 | if (DEBUG_TypeDerefPointer(value, &testtype) == 0) |
| 229 | return FALSE; |
| 230 | if (testtype != NULL || value->type == DEBUG_TypeIntConst) |
| 231 | value->addr.off = DEBUG_GetExprValue(value, NULL); |
| 232 | } |
| 233 | } else if (!value->addr.seg && !value->addr.off) { |
| 234 | DEBUG_Printf(DBG_CHN_MESG,"Invalid expression\n"); |
| 235 | return FALSE; |
| 236 | } |
| 237 | return TRUE; |
| 238 | } |
Alexandre Julliard | 808cb04 | 1995-08-17 17:11:36 +0000 | [diff] [blame] | 239 | |
| 240 | /*********************************************************************** |
| 241 | * DEBUG_ExamineMemory |
| 242 | * |
| 243 | * Implementation of the 'x' command. |
| 244 | */ |
Eric Pouech | d33bcb6 | 2000-03-15 19:57:20 +0000 | [diff] [blame] | 245 | void DEBUG_ExamineMemory( const DBG_VALUE *_value, int count, char format ) |
Alexandre Julliard | 808cb04 | 1995-08-17 17:11:36 +0000 | [diff] [blame] | 246 | { |
Eric Pouech | d33bcb6 | 2000-03-15 19:57:20 +0000 | [diff] [blame] | 247 | DBG_VALUE value = *_value; |
Alexandre Julliard | c6c0944 | 1997-01-12 18:32:19 +0000 | [diff] [blame] | 248 | int i; |
| 249 | unsigned char * pnt; |
Alexandre Julliard | 808cb04 | 1995-08-17 17:11:36 +0000 | [diff] [blame] | 250 | |
Eric Pouech | 71189b5 | 2000-07-25 12:51:56 +0000 | [diff] [blame] | 251 | if (!DEBUG_GrabAddress(&value, (format == 'i'))) return; |
Alexandre Julliard | c6c0944 | 1997-01-12 18:32:19 +0000 | [diff] [blame] | 252 | |
Alexandre Julliard | 808cb04 | 1995-08-17 17:11:36 +0000 | [diff] [blame] | 253 | if (format != 'i' && count > 1) |
| 254 | { |
Eric Pouech | d33bcb6 | 2000-03-15 19:57:20 +0000 | [diff] [blame] | 255 | DEBUG_PrintAddress( &value.addr, DEBUG_CurrThread->dbg_mode, FALSE ); |
Eric Pouech | e5efa0c | 2000-04-13 19:31:58 +0000 | [diff] [blame] | 256 | DEBUG_Printf(DBG_CHN_MESG,": "); |
Alexandre Julliard | 808cb04 | 1995-08-17 17:11:36 +0000 | [diff] [blame] | 257 | } |
| 258 | |
Eric Pouech | d33bcb6 | 2000-03-15 19:57:20 +0000 | [diff] [blame] | 259 | pnt = (void*)DEBUG_ToLinear( &value.addr ); |
Alexandre Julliard | 808cb04 | 1995-08-17 17:11:36 +0000 | [diff] [blame] | 260 | |
| 261 | switch(format) |
| 262 | { |
Alexandre Julliard | 8da12c4 | 1999-01-17 16:55:11 +0000 | [diff] [blame] | 263 | case 'u': { |
Eric Pouech | 527eea9 | 2000-03-08 16:44:54 +0000 | [diff] [blame] | 264 | WCHAR wch; |
Alexandre Julliard | 8da12c4 | 1999-01-17 16:55:11 +0000 | [diff] [blame] | 265 | if (count == 1) count = 256; |
| 266 | while (count--) |
| 267 | { |
Eric Pouech | 4a07ed8 | 2000-05-09 22:32:01 +0000 | [diff] [blame] | 268 | if (!DEBUG_READ_MEM_VERBOSE(pnt, &wch, sizeof(wch)) || !wch) |
Eric Pouech | 527eea9 | 2000-03-08 16:44:54 +0000 | [diff] [blame] | 269 | break; |
| 270 | pnt += sizeof(wch); |
Eric Pouech | 04c16b8 | 2000-04-30 12:21:15 +0000 | [diff] [blame] | 271 | DEBUG_Printf(DBG_CHN_MESG, "%c", (char)wch); |
Alexandre Julliard | 8da12c4 | 1999-01-17 16:55:11 +0000 | [diff] [blame] | 272 | } |
Eric Pouech | e5efa0c | 2000-04-13 19:31:58 +0000 | [diff] [blame] | 273 | DEBUG_Printf(DBG_CHN_MESG,"\n"); |
Alexandre Julliard | 8da12c4 | 1999-01-17 16:55:11 +0000 | [diff] [blame] | 274 | return; |
| 275 | } |
Eric Pouech | 527eea9 | 2000-03-08 16:44:54 +0000 | [diff] [blame] | 276 | case 's': { |
| 277 | char ch; |
| 278 | |
Alexandre Julliard | 808cb04 | 1995-08-17 17:11:36 +0000 | [diff] [blame] | 279 | if (count == 1) count = 256; |
Alexandre Julliard | af0bae5 | 1995-10-03 17:06:08 +0000 | [diff] [blame] | 280 | while (count--) |
| 281 | { |
Eric Pouech | 4a07ed8 | 2000-05-09 22:32:01 +0000 | [diff] [blame] | 282 | if (!DEBUG_READ_MEM_VERBOSE(pnt, &ch, sizeof(ch)) || !ch) |
Eric Pouech | 527eea9 | 2000-03-08 16:44:54 +0000 | [diff] [blame] | 283 | break; |
| 284 | pnt++; |
Eric Pouech | 04c16b8 | 2000-04-30 12:21:15 +0000 | [diff] [blame] | 285 | DEBUG_Output(DBG_CHN_MESG, &ch, 1); |
Alexandre Julliard | af0bae5 | 1995-10-03 17:06:08 +0000 | [diff] [blame] | 286 | } |
Eric Pouech | e5efa0c | 2000-04-13 19:31:58 +0000 | [diff] [blame] | 287 | DEBUG_Printf(DBG_CHN_MESG,"\n"); |
Alexandre Julliard | 808cb04 | 1995-08-17 17:11:36 +0000 | [diff] [blame] | 288 | return; |
Eric Pouech | 527eea9 | 2000-03-08 16:44:54 +0000 | [diff] [blame] | 289 | } |
Alexandre Julliard | 808cb04 | 1995-08-17 17:11:36 +0000 | [diff] [blame] | 290 | case 'i': |
Eric Pouech | 71189b5 | 2000-07-25 12:51:56 +0000 | [diff] [blame] | 291 | while (count-- && DEBUG_DisassembleInstruction( &value.addr )); |
Alexandre Julliard | 808cb04 | 1995-08-17 17:11:36 +0000 | [diff] [blame] | 292 | return; |
Eric Pouech | 527eea9 | 2000-03-08 16:44:54 +0000 | [diff] [blame] | 293 | #define DO_DUMP2(_t,_l,_f,_vv) { \ |
| 294 | _t _v; \ |
| 295 | for(i=0; i<count; i++) { \ |
| 296 | if (!DEBUG_READ_MEM_VERBOSE(pnt, &_v, sizeof(_t))) break; \ |
Eric Pouech | e5efa0c | 2000-04-13 19:31:58 +0000 | [diff] [blame] | 297 | DEBUG_Printf(DBG_CHN_MESG,_f,(_vv)); \ |
Eric Pouech | d33bcb6 | 2000-03-15 19:57:20 +0000 | [diff] [blame] | 298 | pnt += sizeof(_t); value.addr.off += sizeof(_t); \ |
Eric Pouech | 527eea9 | 2000-03-08 16:44:54 +0000 | [diff] [blame] | 299 | if ((i % (_l)) == (_l)-1) { \ |
Eric Pouech | e5efa0c | 2000-04-13 19:31:58 +0000 | [diff] [blame] | 300 | DEBUG_Printf(DBG_CHN_MESG,"\n"); \ |
Eric Pouech | d33bcb6 | 2000-03-15 19:57:20 +0000 | [diff] [blame] | 301 | DEBUG_PrintAddress( &value.addr, DEBUG_CurrThread->dbg_mode, FALSE );\ |
Eric Pouech | e5efa0c | 2000-04-13 19:31:58 +0000 | [diff] [blame] | 302 | DEBUG_Printf(DBG_CHN_MESG,": ");\ |
Eric Pouech | 527eea9 | 2000-03-08 16:44:54 +0000 | [diff] [blame] | 303 | } \ |
| 304 | } \ |
Eric Pouech | e5efa0c | 2000-04-13 19:31:58 +0000 | [diff] [blame] | 305 | DEBUG_Printf(DBG_CHN_MESG,"\n"); \ |
Eric Pouech | 527eea9 | 2000-03-08 16:44:54 +0000 | [diff] [blame] | 306 | } \ |
| 307 | return |
| 308 | #define DO_DUMP(_t,_l,_f) DO_DUMP2(_t,_l,_f,_v) |
| 309 | |
| 310 | case 'x': DO_DUMP(int, 4, " %8.8x"); |
| 311 | case 'd': DO_DUMP(unsigned int, 4, " %10d"); |
| 312 | case 'w': DO_DUMP(unsigned short, 8, " %04x"); |
| 313 | case 'c': DO_DUMP2(char, 32, " %c", (_v < 0x20) ? ' ' : _v); |
| 314 | case 'b': DO_DUMP2(char, 16, " %02x", (_v) & 0xff); |
Alexandre Julliard | 808cb04 | 1995-08-17 17:11:36 +0000 | [diff] [blame] | 315 | } |
| 316 | } |