Updated bug list by my knowledge of them.
[wine/dcerpc.git] / debugger / info.c
bloba4ea51ebf2bf1905487f35ad69055be302197658
1 /*
2 * Wine debugger utility routines
4 * Copyright 1993 Eric Youngdale
5 * Copyright 1995 Alexandre Julliard
6 */
8 #include "config.h"
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include "debugger.h"
12 #include "expr.h"
14 /***********************************************************************
15 * DEBUG_PrintBasic
17 * Implementation of the 'print' command.
19 void DEBUG_PrintBasic( const DBG_ADDR *addr, int count, char format )
21 char * default_format;
22 long long int value;
24 if( addr->type == NULL )
26 fprintf(stderr, "Unable to evaluate expression\n");
27 return;
30 default_format = NULL;
31 value = DEBUG_GetExprValue((DBG_ADDR *) addr, &default_format);
33 switch(format)
35 case 'x':
36 if (addr->seg)
38 DEBUG_nchar += fprintf( stderr, "0x%04lx", (long unsigned int) value );
40 else
42 DEBUG_nchar += fprintf( stderr, "0x%08lx", (long unsigned int) value );
44 break;
46 case 'd':
47 DEBUG_nchar += fprintf( stderr, "%ld\n", (long int) value );
48 break;
50 case 'c':
51 DEBUG_nchar += fprintf( stderr, "%d = '%c'",
52 (char)(value & 0xff), (char)(value & 0xff) );
53 break;
55 case 'i':
56 case 's':
57 case 'w':
58 case 'b':
59 fprintf( stderr, "Format specifier '%c' is meaningless in 'print' command\n", format );
60 case 0:
61 if( default_format != NULL )
63 DEBUG_nchar += fprintf( stderr, default_format, value );
65 break;
70 /***********************************************************************
71 * DEBUG_PrintAddress
73 * Print an 16- or 32-bit address, with the nearest symbol if any.
75 struct symbol_info
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,
81 &rtn.list );
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 );
87 return rtn;
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.
96 struct symbol_info
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,
103 &rtn.list );
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 );
110 return rtn;
114 /***********************************************************************
115 * DEBUG_Help
117 * Implementation of the 'help' command.
119 void DEBUG_Help(void)
121 int i = 0;
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>]",
131 " help quit",
132 " bt cont [N]",
133 " step [N] next [N]",
134 " stepi [N] nexti [N]",
135 " x <addr> print <expr>",
136 " set <reg> = <expr> set *<addr> = <expr>",
137 " up down",
138 " list <lines> disassemble [<addr>][,<addr>]",
139 " frame <n> finish",
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.",
157 NULL
160 while(helptext[i]) fprintf(stderr,"%s\n", helptext[i++]);
164 /***********************************************************************
165 * DEBUG_HelpInfo
167 * Implementation of the 'help info' command.
169 void DEBUG_HelpInfo(void)
171 int i = 0;
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",
188 NULL
191 while(infotext[i]) fprintf(stderr,"%s\n", infotext[i++]);