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:",
127 " break [*<addr>] delete break bpnum",
128 " disable bpnum enable bpnum",
129 " condition <bpnum> [<expr>]",
133 " step [N] next [N]",
134 " stepi [N] nexti [N]",
135 " x <addr> print <expr>",
136 " set <reg> = <expr> set *<addr> = <expr>",
138 " list <lines> disassemble [<addr>][,<addr>]",
140 " show dir dir <path>",
141 " display <expr> undisplay <disnum>",
142 " delete display <disnum> debugmsg <class>[-+]<type>\n",
144 "Wine-specific commands:",
145 " mode [16,32] walk [wnd,class,queue,module]",
146 " info (see 'help info' for options)\n",
148 "The 'x' command accepts repeat counts and formats (including 'i') in the",
149 "same way that gdb does.\n",
151 " The following are examples of legal expressions:",
152 " $eax $eax+0x3 0x1000 ($eip + 256) *$eax *($esp + 3)",
153 " Also, a nm format symbol table can be read from a file using the",
154 " symbolfile command. Symbols can also be defined individually with",
155 " the define command.",
160 while(helptext[i]) fprintf(stderr,"%s\n", helptext[i++]);
164 /***********************************************************************
167 * Implementation of the 'help info' command.
169 void DEBUG_HelpInfo(void)
172 static const char * const infotext[] =
174 "The info commands allow you to get assorted bits of interesting stuff",
175 "to be displayed. The options are:",
176 " info break Dumps information about breakpoints",
177 " info display Shows auto-display expressions in use",
178 " info locals Displays values of all local vars for current frame",
179 " info maps Dumps all virtual memory mappings",
180 " info module <handle> Displays internal module state",
181 " info queue <handle> Displays internal queue state",
182 " info reg Displays values in all registers at top of stack",
183 " info segments Dumps information about all known segments",
184 " info share Dumps information about shared libraries",
185 " info stack Dumps information about top of stack",
186 " info wnd <handle> Displays internal window state",
191 while(infotext[i]) fprintf(stderr,"%s\n", infotext[i++]);