1WINEDBG(1)                  Wine Developers Manual                  WINEDBG(1)
2
3
4

NAME

6       winedbg - Wine's debugger
7

SYNOPSIS

9       winedbg [ options ] [ program name [ program arguments ] | pid ]
10
11       winedbg --gdb [ options ] [ program name [ program arguments ] | pid ]
12
13       winedbg --auto pid
14
15       winedbg --minidump [ file.mdmp ] pid
16
17       winedbg file.mdmp
18

DESCRIPTION

20       winedbg is a debugger for Wine. It allows:
21           + debugging native Win32 applications
22           + debugging Winelib applications.
23           + being a drop-in replacement for Dr Watson
24

MODES

26       winedbg  can  be used in five modes.  The first argument to the program
27       determines the mode winedbg will run in.
28
29       default
30              Without any explicit mode, this is  standard  winedbg  operating
31              mode. winedbg will act as the front end for the user.
32
33       --gdb  winedbg  will  be used as a proxy for gdb. gdb will be the front
34              end for command handling, and winedbg will proxy  all  debugging
35              requests from gdb to the Win32 APIs.
36
37       --auto This  mode  is  used  when winedbg is set up in AeDebug registry
38              entry as the default debugger. winedbg will then  display  basic
39              information  about  a  crash. This is useful for users who don't
40              want to debug a crash, but rather  gather  relevant  information
41              about the crash to be sent to developers.
42
43       --minidump
44              This  mode  is similar to the --auto one, except that instead of
45              printing the information on the screen (as  --auto  does),  it's
46              saved  into  a  minidump  file.  The  name of the file is either
47              passed on the command line, or generated by WineDbg when none is
48              given.   This  file  could later on be reloaded into winedbg for
49              further examination.
50
51       file.mdmp
52              This mode allows to reload into winedbg the state of a  debuggee
53              which  has  been  saved  into  a  minidump  file. See either the
54              minidump command below, or the --minidump mode.
55
56

OPTIONS

58       When in default mode, the following options are available:
59
60       --command <string>
61              winedbg will execute the command <string> as if it was keyed  on
62              winedbg's  command  line,  and then will exit. This can be handy
63              for getting the pid  of  running  processes  (winedbg  --command
64              "info proc").
65
66       --file <filename>
67              winedbg  will  execute  the  list  of commands contained in file
68              <filename> as if they were keyed on winedbg's command line,  and
69              then will exit.
70
71       When in gdb proxy mode, the following options are available:
72
73       --no-start
74              gdb  will not be automatically started. Relevant information for
75              starting gdb are printed on screen. This is somehow useful  when
76              not  directly  using gdb but some graphical front-ends, like ddd
77              or kgbd.
78
79       --with-xterm
80              This will run gdb in its own xterm instead of using the  current
81              Unix console for textual display.
82
83       In  all  modes,  the  rest of the command line, when passed, is used to
84       identify which programs, if any, has to debugged:
85
86       program name
87              This is the name of an executable to start for a debugging  ses‐
88              sion.   winedbg  will  actually  create a process with this exe‐
89              cutable. If programs arguments are also given, they will be used
90              as arguments for creating the process to be debugged.
91
92       pid    winedbg  will attach to the process which pid is pid (pids refer
93              to Win32 pids, not Unix pids). Use the info proc winedbg command
94              to list running processes and their Win32 pids.
95
96       default
97              If nothing is specified, you will enter the debugger without any
98              run nor attached process. You'll have to do the job yourself.
99
100

COMMANDS

102   Default mode, and while reloading a minidump file:
103       Most of commands used in winedbg are similar  to  the  ones  from  gdb.
104       Please  refer  to the gdb documentations for some more details. See the
105       gdb differences section later on to get a list of variations  from  gdb
106       commands.
107
108       Misc. commands
109
110       abort  Aborts the debugger.
111
112       quit   Exits the debugger.
113
114       attach N
115              Attach  to a Wine-process (N is its ID, numeric or hexadecimal).
116              IDs can be obtained using the info process  command.   Note  the
117              info process command returns hexadecimal values
118
119       detach Detach from a Wine-process.
120
121       Help commands
122
123       help   Prints some help on the commands.
124
125       help info
126              Prints some help on info commands
127
128       Flow control commands
129
130       cont   Continue execution until next breakpoint or exception.
131
132       pass   Pass the exception event up to the filter chain.
133
134       step   Continue  execution  until  next C line of code (enters function
135              call)
136
137       next   Continue execution until next C  line  of  code  (doesn't  enter
138              function call)
139
140       stepi  Execute next assembly instruction (enters function call)
141
142       nexti  Execute next assembly instruction (doesn't enter function call)
143
144       finish Execute until return of current function is reached.
145
146       cont,  step, next, stepi, nexti can be postfixed by a number (N), mean‐
147       ing that the command  must  be  executed  N  times  before  control  is
148       returned to the user.
149
150       Breakpoints, watchpoints
151
152       enable N
153              Enables (break|watch)-point #N
154
155       disable
156              Disables (break|watch)-point #N
157
158       delete Deletes (break|watch)-point #N
159
160       cond N Removes any existing condition to (break|watch)-point N
161
162       cond N <expr>
163              Adds  condition <expr> to (break|watch)-point #N. <expr> will be
164              evaluated each time  the  (break|watch)-point  is  hit.  If  the
165              result is a zero value, the breakpoint isn't triggered.
166
167       break * N
168              Adds a breakpoint at address N
169
170       break <id>
171              Adds a breakpoint at the address of symbol <id>
172
173       break <id> N
174              Adds a breakpoint at the line N inside symbol <id>.
175
176       break N
177              Adds a breakpoint at line N of current source file.
178
179       break  Adds a breakpoint at current PC address.
180
181       watch * N
182              Adds a watch command (on write) at address N (on 4 bytes).
183
184       watch <id>
185              Adds  a  watch command (on write) at the address of symbol <id>.
186              Size depends on size of <id>.
187
188       rwatch * N
189              Adds a watch command (on read) at address N (on 4 bytes).
190
191       rwatch <id>
192              Adds a watch command (on read) at the address  of  symbol  <id>.
193              Size depends on size of <id>.
194
195       info break
196              Lists all (break|watch)-points (with their state).
197
198       You  can  use the symbol EntryPoint to stand for the entry point of the
199       Dll.
200
201       When setting a (break|watch)-point by <id>, if  the  symbol  cannot  be
202       found  (for  example,  the symbol is contained in a not yet loaded mod‐
203       ule), winedbg will recall the name of the symbol and will  try  to  set
204       the breakpoint each time a new module is loaded (until it succeeds).
205
206       Stack manipulation
207
208       bt     Print calling stack of current thread.
209
210       bt N   Print calling stack of thread of ID N. Note: this doesn't change
211              the position of the current frame as manipulated by the up &  dn
212              commands).
213
214       up     Goes up one frame in current thread's stack
215
216       up N   Goes up N frames in current thread's stack
217
218       dn     Goes down one frame in current thread's stack
219
220       dn N   Goes down N frames in current thread's stack
221
222       frame N
223              Sets N as the current frame for current thread's stack.
224
225       info locals
226              Prints  information  on  local  variables  for  current function
227              frame.
228
229       Directory & source file manipulation
230
231       show dir
232              Prints the list of dir:s where source files are looked for.
233
234       dir <pathname>
235              Adds <pathname> to the list of dir:s where to  look  for  source
236              files
237
238       dir    Deletes the list of dir:s where to look for source files
239
240       symbolfile <pathname>
241              Loads external symbol definition symbolfile <pathname>
242
243       symbolfile <pathname> N
244              Loads external symbol definition symbolfile <pathname> (applying
245              an offset of N to addresses)
246
247       list   Lists 10 source lines forwards from current position.
248
249       list - Lists 10 source lines backwards from current position
250
251       list N Lists 10 source lines from line #N in current file
252
253       list <pathname>:N
254              Lists 10 source lines from line #N in file <pathname>
255
256       list <id>
257              Lists 10 source lines of function <id>
258
259       list * N
260              Lists 10 source lines from address N
261
262       You can specify the end target (to change the 10 lines value) using the
263       ',' separator. For example:
264
265       list 123, 234
266              lists source lines from line 123 up to line 234 in current file
267
268       list foo.c:1,56
269              lists source lines from line 1 up to 56 in file foo.c
270
271       Displaying
272
273       A  display is an expression that's evaluated and printed after the exe‐
274       cution of any winedbg's command.
275
276       display
277
278       info display
279              Lists the active displays
280
281       display <expr>
282              Adds a display for expression expr>
283
284       display /fmt <expr>
285              Adds a display for expression <expr>. Printing evaluated  <expr>
286              is  done  using  the given format (see print command for more on
287              formats)
288
289       del display N
290
291       undisplay N
292              Deletes display #N
293
294       Disassembly
295
296       disas  Disassemble from current position
297
298       disas <expr>
299              Disassemble from address <expr>
300
301       disas <expr>,<expr>
302              Disassembles  code  between  addresses  specified  by  the   two
303              <expr>:s
304
305       Memory (reading, writing, typing)
306
307       x <expr>
308              Examines memory at <expr> address
309
310       x /fmt <expr>
311              Examines memory at <expr> address using format /fmt
312
313       print <expr>
314              Prints the value of <expr> (possibly using its type)
315
316       print /fmt <expr>
317              Prints the value of <expr> (possibly using its type)
318
319       set <var> = <expr>
320              Writes the value of <expr> in <var> variable.
321
322       whatis <expr>
323              Prints the C type of expression <expr>
324
325       /fmt   is either /<letter> or /<count><letter>. <letter> can be:
326
327           s      an ASCII string
328
329           u      a UTF16 Unicode string
330
331           i      instructions (disassemble)
332
333           x      32 bit unsigned hexadecimal integer
334
335           d      32 bit signed decimal integer
336
337           w      16 bit unsigned hexadecimal integer
338
339           c      character (only printable 0x20-0x7f are actually printed)
340
341           b      8 bit unsigned hexadecimal integer
342
343           g      Win32 GUID
344
345       Expressions
346
347       Expressions  in  Wine Debugger are mostly written in a C form. However,
348       there are a few discrepancies:
349
350           Identifiers can take a '!' in their names. This  allows  mainly  to
351           specify  a  module where to look the module from: USER32!CreateWin‐
352           dowExA.
353
354           In cast operation, when specifying a structure  or  an  union,  you
355           must  use the struct or union key word (even if your program uses a
356           typedef).
357
358       When specifying an identifier <id>, if several symbols with  this  name
359       exist, the debugger will prompt for the symbol you want to use. Pick up
360       the one you want from its number.
361
362       Misc.
363
364       minidump file.mdmp
365              saves the debugging context of the debuggee into a minidump file
366              called file.mdmp
367
368       Information on Wine's internals
369
370       info class
371              Lists all Windows' class registered in Wine
372
373       info class <id>
374              Prints information on Windows's class <id>
375
376       info share
377              Lists  all  the dynamic libraries loaded in the debugged program
378              (including .so files, NE and PE DLLs)
379
380       info share N
381              Prints information on module at address N
382
383       info regs
384              Prints the value of the CPU registers
385
386       info all-regs
387              Prints the value of the CPU and Floating Point registers
388
389       info segment
390              Lists all allocated segments (i386 only)
391
392       info segment N
393              Prints information on segment N (i386 only)
394
395       info stack
396              Prints the values on top of the stack
397
398       info map
399              Lists all virtual mappings used by the debugged program
400
401       info map N
402              Lists all virtual mappings used by the program of pid N
403
404       info wnd
405              Displays the window hierarchy starting from the desktop window
406
407       info wnd N
408              Prints information of Window of handle N
409
410       info process
411              Lists all w-processes in Wine session
412
413       info thread
414              Lists all w-threads in Wine session
415
416       info frame
417              Lists the exception frames (starting from current stack  frame).
418              You can also pass, as optional argument, a thread id (instead of
419              current thread) to examine its exception frames.
420
421       Debug messages can be turned on and off as you are debugging using  the
422       set command, but only for channels initialized with the WINEDEBUG envi‐
423       ronment variable.
424
425       set warn + win
426              Turns on warn on 'win' channel
427
428       set + win
429              Turns on warn/fixme/err/trace on 'win' channel
430
431       set - win
432              Turns off warn/fixme/err/trace on 'win' channel
433
434       set fixme - all
435              Turns off the 'fixme' class on all channels
436
437   Gdb mode:
438       See the gdb documentation for all the gdb commands.
439
440       However, a few Wine's extension are available, through the monitor com‐
441       mand:
442
443       monitor wnd
444              Lists all window in the Wine session
445
446       monitor proc
447              Lists all processes in the Wine session
448
449       monitor mem
450              Displays memory mapping of debugged process
451
452   Auto and minidump modes:
453       Since no user input is possible, no commands are available.
454
455

ENVIRONMENT

457       WINE_GDB
458              When  used  in  gdb proxy mode, WINE_GDB specifies the name (and
459              the path) of the executable to be used for gdb. "gdb" is used by
460              default.
461

FILES

463       No specific files are used (yet).
464

BUGS

466       A lot.
467

AUTHORS

469       The first version was written by Eric Youngdale.
470
471       See Wine developer's list for the rest of contributors.
472

SEE ALSO

474       winedbg's README file
475       The Winelib User Guide
476       The Wine Developers Guide
477
478
479
480Wine 1.3.24                      October 2005                       WINEDBG(1)
Impressum