Added the TEXT() and MAKELRESULT() definitions.
[wine/multimedia.git] / debugger / info.c
blob5dc6247e8f65d65f94cba1aded275486e2dadc14
1 /*
2 * Wine debugger utility routines
4 * Copyright 1993 Eric Youngdale
5 * Copyright 1995 Alexandre Julliard
6 */
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include "debugger.h"
11 #include "expr.h"
13 /***********************************************************************
14 * DEBUG_Print
16 * Implementation of the 'print' command.
18 void DEBUG_PrintBasic( const DBG_ADDR *addr, int count, char format )
20 char * default_format;
21 long long int value;
23 if( addr->type == NULL )
25 fprintf(stderr, "Unable to evaluate expression\n");
26 return;
29 default_format = NULL;
30 value = DEBUG_GetExprValue((DBG_ADDR *) addr, &default_format);
32 switch(format)
34 case 'x':
35 if (addr->seg)
37 DEBUG_nchar += fprintf( stderr, "0x%04lx", (long unsigned int) value );
39 else
41 DEBUG_nchar += fprintf( stderr, "0x%08lx", (long unsigned int) value );
43 break;
45 case 'd':
46 DEBUG_nchar += fprintf( stderr, "%ld\n", (long int) value );
47 break;
49 case 'c':
50 DEBUG_nchar += fprintf( stderr, "%d = '%c'",
51 (char)(value & 0xff), (char)(value & 0xff) );
52 break;
54 case 'i':
55 case 's':
56 case 'w':
57 case 'b':
58 fprintf( stderr, "Format specifier '%c' is meaningless in 'print' command\n", format );
59 case 0:
60 if( default_format != NULL )
62 DEBUG_nchar += fprintf( stderr, default_format, value );
64 break;
69 /***********************************************************************
70 * DEBUG_PrintAddress
72 * Print an 16- or 32-bit address, with the nearest symbol if any.
74 struct symbol_info
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,
80 &rtn.list );
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 );
86 return rtn;
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.
95 struct symbol_info
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,
102 &rtn.list );
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 );
109 return rtn;
113 /***********************************************************************
114 * DEBUG_Help
116 * Implementation of the 'help' command.
118 void DEBUG_Help(void)
120 int i = 0;
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>]",
130 " help quit",
131 " bt cont [N]",
132 " step [N] next [N]",
133 " stepi [N] nexti [N]",
134 " x <addr> print <expr>",
135 " set <reg> = <expr> set *<addr> = <expr>",
136 " up down",
137 " list <lines> disassemble [<addr>][,<addr>]",
138 " frame <n> finish",
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.",
156 NULL
159 while(helptext[i]) fprintf(stderr,"%s\n", helptext[i++]);
163 /***********************************************************************
164 * DEBUG_HelpInfo
166 * Implementation of the 'help info' command.
168 void DEBUG_HelpInfo(void)
170 int i = 0;
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",
187 NULL
190 while(infotext[i]) fprintf(stderr,"%s\n", infotext[i++]);