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
);
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 "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> frame <n>",
139 " dir <path> display <expr>",
140 " delete display <disnum> undisplay <disnum>\n",
142 "Wine-specific commands:",
143 " mode [16,32] walk [wnd,class,queue] <handle>",
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 module Displays information about all modules",
178 " info queue <handle> Dumps queue information",
179 " info reg Displays values in all registers at top of stack",
180 " info segments Dumps information about all known segments",
181 " info share Dumps information about shared libraries",
182 " info stack Dumps information about top of stack",
183 " info wnd <handle> Dumps information about all windows",
188 while(infotext
[i
]) fprintf(stderr
,"%s\n", infotext
[i
++]);