2 * Wine debugger utility routines
4 * Copyright 1993 Eric Youngdale
5 * Copyright 1995 Alexandre Julliard
13 /***********************************************************************
16 * Implementation of the 'print' command.
18 void DEBUG_PrintBasic( const DBG_ADDR
*addr
, int count
, char format
)
20 char * default_format
;
23 if( addr
->type
== NULL
)
25 fprintf(stderr
, "Unable to evaluate expression\n");
29 default_format
= NULL
;
30 value
= DEBUG_GetExprValue((DBG_ADDR
*) addr
, &default_format
);
37 DEBUG_nchar
+= fprintf( stderr
, "0x%04lx", (long unsigned int) value
);
41 DEBUG_nchar
+= fprintf( stderr
, "0x%08lx", (long unsigned int) value
);
46 DEBUG_nchar
+= fprintf( stderr
, "%ld\n", (long int) value
);
50 DEBUG_nchar
+= fprintf( stderr
, "%d = '%c'",
51 (char)(value
& 0xff), (char)(value
& 0xff) );
58 fprintf( stderr
, "Format specifier '%c' is meaningless in 'print' command\n", format
);
60 if( default_format
!= NULL
)
62 DEBUG_nchar
+= fprintf( stderr
, default_format
, value
);
69 /***********************************************************************
72 * Print an 16- or 32-bit address, with the nearest symbol if any.
75 DEBUG_PrintAddress( const DBG_ADDR
*addr
, int addrlen
, int flag
)
77 struct symbol_info rtn
;
79 const char *name
= DEBUG_FindNearestSymbol( addr
, flag
, &rtn
.sym
, 0,
82 if (addr
->seg
) fprintf( stderr
, "0x%04lx:", addr
->seg
&0xFFFF );
83 if (addrlen
== 16) fprintf( stderr
, "0x%04lx", addr
->off
);
84 else fprintf( stderr
, "0x%08lx", addr
->off
);
85 if (name
) fprintf( stderr
, " (%s)", name
);
88 /***********************************************************************
89 * DEBUG_PrintAddressAndArgs
91 * Print an 16- or 32-bit address, with the nearest symbol if any.
92 * Similar to DEBUG_PrintAddress, but we print the arguments to
93 * each function (if known). This is useful in a backtrace.
96 DEBUG_PrintAddressAndArgs( const DBG_ADDR
*addr
, int addrlen
,
97 unsigned int ebp
, int flag
)
99 struct symbol_info rtn
;
101 const char *name
= DEBUG_FindNearestSymbol( addr
, flag
, &rtn
.sym
, ebp
,
104 if (addr
->seg
) fprintf( stderr
, "0x%04lx:", addr
->seg
);
105 if (addrlen
== 16) fprintf( stderr
, "0x%04lx", addr
->off
);
106 else fprintf( stderr
, "0x%08lx", addr
->off
);
107 if (name
) fprintf( stderr
, " (%s)", name
);
113 /***********************************************************************
116 * Implementation of the 'help' command.
118 void DEBUG_Help(void)
121 static const char * const helptext
[] =
123 "The commands accepted by the Wine debugger are a reasonable",
124 "subset of the commands that gdb accepts.",
125 "The commands currently are:",
126 " break [*<addr>] delete break bpnum",
127 " disable bpnum enable bpnum",
128 " condition <bpnum> [<expr>]",
132 " step [N] next [N]",
133 " stepi [N] nexti [N]",
134 " x <addr> print <expr>",
135 " set <reg> = <expr> set *<addr> = <expr>",
137 " list <lines> disassemble [<addr>][,<addr>]",
139 " show dir dir <path>",
140 " display <expr> undisplay <disnum>",
141 " delete display <disnum>\n",
143 "Wine-specific commands:",
144 " mode [16,32] walk [wnd,class,queue,module]",
145 " info (see 'help info' for options)\n",
147 "The 'x' command accepts repeat counts and formats (including 'i') in the",
148 "same way that gdb does.\n",
150 " The following are examples of legal expressions:",
151 " $eax $eax+0x3 0x1000 ($eip + 256) *$eax *($esp + 3)",
152 " Also, a nm format symbol table can be read from a file using the",
153 " symbolfile command. Symbols can also be defined individually with",
154 " the define command.",
159 while(helptext
[i
]) fprintf(stderr
,"%s\n", helptext
[i
++]);
163 /***********************************************************************
166 * Implementation of the 'help info' command.
168 void DEBUG_HelpInfo(void)
171 static const char * const infotext
[] =
173 "The info commands allow you to get assorted bits of interesting stuff",
174 "to be displayed. The options are:",
175 " info break Dumps information about breakpoints",
176 " info display Shows auto-display expressions in use",
177 " info locals Displays values of all local vars for current frame",
178 " info maps Dumps all virtual memory mappings",
179 " info module <handle> Displays internal module state",
180 " info queue <handle> Displays internal queue state",
181 " info reg Displays values in all registers at top of stack",
182 " info segments Dumps information about all known segments",
183 " info share Dumps information about shared libraries",
184 " info stack Dumps information about top of stack",
185 " info wnd <handle> Displays internal window state",
190 while(infotext
[i
]) fprintf(stderr
,"%s\n", infotext
[i
++]);