2 * Wine debugger utility routines
4 * Copyright 1993 Eric Youngdale
5 * Copyright 1995 Alexandre Julliard
14 /***********************************************************************
17 * Implementation of the 'print' command.
19 void DEBUG_PrintBasic( const DBG_ADDR
*addr
, int count
, char format
)
21 char * default_format
;
24 if( addr
->type
== NULL
)
26 fprintf(stderr
, "Unable to evaluate expression\n");
30 default_format
= NULL
;
31 value
= DEBUG_GetExprValue((DBG_ADDR
*) addr
, &default_format
);
38 DEBUG_nchar
+= fprintf( stderr
, "0x%04lx", (long unsigned int) value
);
42 DEBUG_nchar
+= fprintf( stderr
, "0x%08lx", (long unsigned int) value
);
47 DEBUG_nchar
+= fprintf( stderr
, "%ld\n", (long int) value
);
51 DEBUG_nchar
+= fprintf( stderr
, "%d = '%c'",
52 (char)(value
& 0xff), (char)(value
& 0xff) );
59 fprintf( stderr
, "Format specifier '%c' is meaningless in 'print' command\n", format
);
61 if( default_format
!= NULL
)
63 DEBUG_nchar
+= fprintf( stderr
, default_format
, value
);
70 /***********************************************************************
73 * Print an 16- or 32-bit address, with the nearest symbol if any.
76 DEBUG_PrintAddress( const DBG_ADDR
*addr
, int addrlen
, int flag
)
78 struct symbol_info rtn
;
80 const char *name
= DEBUG_FindNearestSymbol( addr
, flag
, &rtn
.sym
, 0,
83 if (addr
->seg
) fprintf( stderr
, "0x%04lx:", addr
->seg
&0xFFFF );
84 if (addrlen
== 16) fprintf( stderr
, "0x%04lx", addr
->off
);
85 else fprintf( stderr
, "0x%08lx", addr
->off
);
86 if (name
) fprintf( stderr
, " (%s)", name
);
89 /***********************************************************************
90 * DEBUG_PrintAddressAndArgs
92 * Print an 16- or 32-bit address, with the nearest symbol if any.
93 * Similar to DEBUG_PrintAddress, but we print the arguments to
94 * each function (if known). This is useful in a backtrace.
97 DEBUG_PrintAddressAndArgs( const DBG_ADDR
*addr
, int addrlen
,
98 unsigned int ebp
, int flag
)
100 struct symbol_info rtn
;
102 const char *name
= DEBUG_FindNearestSymbol( addr
, flag
, &rtn
.sym
, ebp
,
105 if (addr
->seg
) fprintf( stderr
, "0x%04lx:", addr
->seg
);
106 if (addrlen
== 16) fprintf( stderr
, "0x%04lx", addr
->off
);
107 else fprintf( stderr
, "0x%08lx", addr
->off
);
108 if (name
) fprintf( stderr
, " (%s)", name
);
114 /***********************************************************************
117 * Implementation of the 'help' command.
119 void DEBUG_Help(void)
122 static const char * const helptext
[] =
124 "The commands accepted by the Wine debugger are a reasonable",
125 "subset of the commands that gdb accepts.",
126 "The commands currently are:",
128 " break [*<addr>] delete break bpnum",
129 " disable bpnum enable bpnum",
130 " condition <bpnum> [<expr>] pass",
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> debugmsg <class>[-+]<type>\n",
142 " mode [16,32] walk [wnd,class,queue,module,",
143 " process,modref <pid>]",
144 " info (see 'help info' for options)\n",
146 "The 'x' command accepts repeat counts and formats (including 'i') in the",
147 "same way that gdb does.\n",
149 " The following are examples of legal expressions:",
150 " $eax $eax+0x3 0x1000 ($eip + 256) *$eax *($esp + 3)",
151 " Also, a nm format symbol table can be read from a file using the",
152 " symbolfile command. Symbols can also be defined individually with",
153 " the define command.",
158 while(helptext
[i
]) fprintf(stderr
,"%s\n", helptext
[i
++]);
162 /***********************************************************************
165 * Implementation of the 'help info' command.
167 void DEBUG_HelpInfo(void)
170 static const char * const infotext
[] =
172 "The info commands allow you to get assorted bits of interesting stuff",
173 "to be displayed. The options are:",
174 " info break Dumps information about breakpoints",
175 " info display Shows auto-display expressions in use",
176 " info locals Displays values of all local vars for current frame",
177 " info maps Dumps all virtual memory mappings",
178 " info module <handle> Displays internal module state",
179 " info queue <handle> Displays internal queue state",
180 " info reg Displays values in all registers at top of stack",
181 " info segments Dumps information about all known segments",
182 " info share Dumps information about shared libraries",
183 " info stack Dumps information about top of stack",
184 " info wnd <handle> Displays internal window state",
189 while(infotext
[i
]) fprintf(stderr
,"%s\n", infotext
[i
++]);