winedbg.man.in 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  1. .TH WINEDBG 1 "October 2005" "@PACKAGE_STRING@" "Wine Developers Manual"
  2. .SH NAME
  3. winedbg \- Wine debugger
  4. .SH SYNOPSIS
  5. .B winedbg
  6. .RI "[ " options " ] [ " program_name " [ " program_arguments " ] | " wpid " ]"
  7. .PP
  8. .B winedbg --gdb
  9. .RI "[ " options " ] [ " program_name " [ " program_arguments " ] | " wpid " ]"
  10. .PP
  11. .BI "winedbg --auto " wpid
  12. .PP
  13. .B winedbg --minidump
  14. .RI "[ " file.mdmp " ] " wpid
  15. .PP
  16. .BI "winedbg " file.mdmp
  17. .SH DESCRIPTION
  18. .B winedbg
  19. is a debugger for Wine. It allows:
  20. .RS 4
  21. .nf
  22. + debugging native Win32 applications
  23. + debugging Winelib applications
  24. + being a drop-in replacement for Dr Watson
  25. .fi
  26. .RE
  27. .PP
  28. .SH MODES
  29. \fBwinedbg\fR can be used in five modes. The first argument to the
  30. program determines the mode winedbg will run in.
  31. .IP \fBdefault\fR
  32. Without any explicit mode, this is standard \fBwinedbg\fR operating
  33. mode. \fBwinedbg\fR will act as the front end for the user.
  34. .IP \fB--gdb\fR
  35. \fBwinedbg\fR will be used as a proxy for \fBgdb\fR. \fBgdb\fR will be
  36. the front end for command handling, and \fBwinedbg\fR will proxy all
  37. debugging requests from \fBgdb\fR to the Win32 APIs.
  38. .IP \fB--auto\fR
  39. This mode is used when \fBwinedbg\fR is set up in \fIAeDebug\fR
  40. registry entry as the default debugger. \fBwinedbg\fR will then
  41. display basic information about a crash. This is useful for users
  42. who don't want to debug a crash, but rather gather relevant
  43. information about the crash to be sent to developers.
  44. .IP \fB--minidump\fR
  45. This mode is similar to the \fB--auto\fR one, except that instead of
  46. printing the information on the screen (as \fB--auto\fR does), it's
  47. saved into a minidump file. The name of the file is either passed on
  48. the command line, or generated by \fBWineDbg\fR when none is given.
  49. This file could later on be reloaded into \fBwinedbg\fR for further
  50. examination.
  51. .IP \fBfile.mdmp\fR
  52. In this mode \fBwinedbg\fR reloads the state of a debuggee which
  53. has been saved into a minidump file. See either the \fBminidump\fR
  54. command below, or the \fB--minidump mode\fR.
  55. .SH OPTIONS
  56. When in \fBdefault\fR mode, the following options are available:
  57. .PP
  58. .IP \fB--command\ \fIstring\fR
  59. \fBwinedbg\fR will execute the command \fIstring\fR as if it was keyed on
  60. winedbg command line, and then will exit. This can be handy for
  61. getting the pid of running processes (winedbg --command "info proc").
  62. .IP \fB--file\ \fIfilename\fR
  63. \fBwinedbg\fR will execute the list of commands contained in file
  64. filename as if they were keyed on winedbg command line, and then
  65. will exit.
  66. .PP
  67. When in \fBgdb\fR proxy mode, the following options are available:
  68. .PP
  69. .IP \fB--no-start\fR
  70. \fBgdb\fR will not be automatically
  71. started. Relevant information for starting \fBgdb\fR is printed on
  72. screen. This is somehow useful when not directly using \fBgdb\fR but
  73. some graphical front-ends, like \fBddd\fR or \fBkgbd\fR.
  74. .IP \fB--port\fR\ \fIport\fR
  75. Start the \fBgdb\fR server on the given port. If this option is not
  76. specified, a randomly chosen port will be used. If \fB--no-start\fR is
  77. specified, the port used will be printed on startup.
  78. .IP \fB--with-xterm\fR
  79. This will run \fBgdb\fR in its own xterm instead of using the current
  80. Unix console for textual display.
  81. .PP
  82. In all modes, the rest of the command line, when passed, is used to
  83. identify which programs, if any, has to debugged:
  84. .IP \fIprogram_name\fR
  85. This is the name of an executable to start for a debugging
  86. session. \fBwinedbg\fR will actually create a process with this
  87. executable. If \fIprograms_arguments\fR are also given, they will be
  88. used as arguments for creating the process to be debugged.
  89. .IP \fIwpid\fR
  90. \fBwinedbg\fR will attach to the process which Windows pid is \fIwpid\fR.
  91. Use the \fBinfo proc\fR command within \fBwinedbg\fR to list running processes
  92. and their Windows pids.
  93. .IP \fBdefault\fR
  94. If nothing is specified, you will enter the debugger without any run
  95. nor attached process. You'll have to do the job yourself.
  96. .SH COMMANDS
  97. .SS Default mode, and while reloading a minidump file:
  98. .PP
  99. Most of commands used in \fBwinedbg\fR are similar to the ones from
  100. \fBgdb\fR. Please refer to the \fBgdb\fR documentations for some more
  101. details. See the \fIgdb\ differences\fR section later on to get a list
  102. of variations from \fBgdb\fR commands.
  103. .PP
  104. \fIMisc. commands\fR
  105. .IP \fBabort\fR
  106. Aborts the debugger.
  107. .IP \fBquit\fR
  108. Exits the debugger.
  109. .PP
  110. \fIProcess handling\fR
  111. .IP \fBattach\ \fIN\fR
  112. Attach to a Wine process (\fIN\fR is its Windows ID, numeric or hexadecimal).
  113. IDs can be obtained using the \fBinfo\ process\fR command. Note the
  114. \fBinfo\ process\fR command returns hexadecimal values
  115. .IP
  116. .IP \fBdetach\fR
  117. Detach from a Wine-process.
  118. .IP \fBthread\ \fIN\fR
  119. Change the current thread to \fIN\fR (its Windows TID, numeric or hexadecimal).
  120. .IP
  121. .IP \fBrun\fR
  122. Re-run the same process with the same arguments.
  123. Note: all breakpoints of precedent process are no longer available.
  124. .IP \fBrun\ \fIarg1\ arg2...\fR
  125. Re-run the same process with arguments \fIarg1\ arg2...\fR.
  126. Note: all breakpoints of precedent process are no longer available.
  127. .PP
  128. \fIHelp commands\fR
  129. .IP \fBhelp\fR
  130. Prints some help on the commands.
  131. .IP \fBhelp\ info\fR
  132. Prints some help on info commands
  133. .PP
  134. \fIFlow control commands\fR
  135. .IP \fBcont\fR
  136. Continue execution until next breakpoint or exception.
  137. .IP \fBpass\fR
  138. Pass the exception event up to the filter chain.
  139. .IP \fBstep\fR
  140. Continue execution until next C line of code (enters function call)
  141. .IP \fBnext\fR
  142. Continue execution until next C line of code (doesn't enter function
  143. call)
  144. .IP \fBstepi\fR
  145. Execute next assembly instruction (enters function call)
  146. .IP \fBnexti\fR
  147. Execute next assembly instruction (doesn't enter function call)
  148. .IP \fBfinish\fR
  149. Execute until return of current function is reached.
  150. .PP
  151. \fBcont\fR, \fBstep\fR, \fBnext\fR, \fBstepi\fR, \fBnexti\fR can be
  152. postfixed by a number (N), meaning that the command must be executed N
  153. times before control is returned to the user.
  154. .PP
  155. \fIBreakpoints, watchpoints
  156. .IP \fBenable\ \fIN\fR
  157. Enables (break|watch)-point \fIN\fR
  158. .IP \fBdisable\ \fIN\fR
  159. Disables (break|watch)-point \fIN\fR
  160. .IP \fBdelete\ \fIN\fR
  161. Deletes (break|watch)-point \fIN\fR
  162. .IP \fBcond\ \fIN\fR
  163. Removes any existing condition to (break|watch)-point \fIN\fR
  164. .IP \fBcond\ \fIN\ expr\fR
  165. Adds condition \fIexpr\fR to (break|watch)-point
  166. \fIN\fR. \fIexpr\fR will be evaluated each time the
  167. (break|watch)-point is hit. If the result is a zero value, the
  168. breakpoint isn't triggered.
  169. .IP \fBbreak\ *\ \fIN\fR
  170. Adds a breakpoint at address \fIN\fR
  171. .IP \fBbreak\ \fIid\fR
  172. Adds a breakpoint at the address of symbol \fIid\fR
  173. .IP \fBbreak\ \fIid\ N\fR
  174. Adds a breakpoint at the line \fIN\fR inside symbol \fIid\fR.
  175. .IP \fBbreak\ \fIN\fR
  176. Adds a breakpoint at line \fIN\fR of current source file.
  177. .IP \fBbreak\fR
  178. Adds a breakpoint at current \fB$PC\fR address.
  179. .IP \fBwatch\ *\ \fIN\fR
  180. Adds a watch command (on write) at address \fIN\fR (on 4 bytes).
  181. .IP \fBwatch\ \fIid\fR
  182. Adds a watch command (on write) at the address of symbol
  183. \fIid\fR. Size depends on size of \fIid\fR.
  184. .IP \fBrwatch\ *\ \fIN\fR
  185. Adds a watch command (on read) at address \fIN\fR (on 4 bytes).
  186. .IP \fBrwatch\ \fIid\fR
  187. Adds a watch command (on read) at the address of symbol
  188. \fIid\fR. Size depends on size of \fIid\fR.
  189. .IP \fBinfo\ break\fR
  190. Lists all (break|watch)-points (with their state).
  191. .PP
  192. You can use the symbol \fBEntryPoint\fR to stand for the entry point of the Dll.
  193. .PP
  194. When setting a (break|watch)-point by \fIid\fR, if the symbol cannot
  195. be found (for example, the symbol is contained in a not yet loaded
  196. module), \fBwinedbg\fR will recall the name of the symbol and will try
  197. to set the breakpoint each time a new module is loaded (until it succeeds).
  198. .PP
  199. \fIStack manipulation\fR
  200. .IP \fBbt\fR
  201. Print calling stack of current thread.
  202. .IP \fBbt\ \fIN\fR
  203. Print calling stack of thread of ID \fIN\fR. Note: this doesn't change
  204. the position of the current frame as manipulated by the \fBup\fR &
  205. \fBdn\fR commands).
  206. .IP \fBup\fR
  207. Goes up one frame in current thread's stack
  208. .IP \fBup\ \fIN\fR
  209. Goes up \fIN\fR frames in current thread's stack
  210. .IP \fBdn\fR
  211. Goes down one frame in current thread's stack
  212. .IP \fBdn\ \fIN\fR
  213. Goes down \fIN\fR frames in current thread's stack
  214. .IP \fBframe\ \fIN\fR
  215. Sets \fIN\fR as the current frame for current thread's stack.
  216. .IP \fBinfo\ locals\fR
  217. Prints information on local variables for current function frame.
  218. .PP
  219. \fIDirectory & source file manipulation\fR
  220. .IP \fBshow\ dir\fR
  221. Prints the list of dirs where source files are looked for.
  222. .IP \fBdir\ \fIpathname\fR
  223. Adds \fIpathname\fR to the list of dirs where to look for source
  224. files
  225. .IP \fBdir\fR
  226. Deletes the list of dirs where to look for source files
  227. .IP \fBsymbolfile\ \fIpathname\fR
  228. Loads external symbol definition file \fIpathname\fR
  229. .IP \fBsymbolfile\ \fIpathname\ N\fR
  230. Loads external symbol definition file \fIpathname\fR (applying
  231. an offset of \fIN\fR to addresses)
  232. .IP \fBlist\fR
  233. Lists 10 source lines forwards from current position.
  234. .IP \fBlist\ -\fR
  235. Lists 10 source lines backwards from current position
  236. .IP \fBlist\ \fIN\fR
  237. Lists 10 source lines from line \fIN\fR in current file
  238. .IP \fBlist\ \fIpathname\fB:\fIN\fR
  239. Lists 10 source lines from line \fIN\fR in file \fIpathname\fR
  240. .IP \fBlist\ \fIid\fR
  241. Lists 10 source lines of function \fIid\fR
  242. .IP \fBlist\ *\ \fIN\fR
  243. Lists 10 source lines from address \fIN\fR
  244. .PP
  245. You can specify the end target (to change the 10 lines value) using
  246. the ',' separator. For example:
  247. .IP \fBlist\ 123,\ 234\fR
  248. lists source lines from line 123 up to line 234 in current file
  249. .IP \fBlist\ foo.c:1,56\fR
  250. lists source lines from line 1 up to 56 in file foo.c
  251. .PP
  252. \fIDisplaying\fR
  253. .PP
  254. A display is an expression that's evaluated and printed after the
  255. execution of any \fBwinedbg\fR command.
  256. .IP \fBdisplay\fR
  257. .IP \fBinfo\ display\fR
  258. Lists the active displays
  259. .IP \fBdisplay\ \fIexpr\fR
  260. Adds a display for expression \fIexpr\fR
  261. .IP \fBdisplay\ /\fIfmt\ \fIexpr\fR
  262. Adds a display for expression \fIexpr\fR. Printing evaluated
  263. \fIexpr\fR is done using the given format (see \fBprint\ command\fR
  264. for more on formats)
  265. .IP \fBdel\ display\ \fIN\fR
  266. .IP \fBundisplay\ \fIN\fR
  267. Deletes display \fIN\fR
  268. .PP
  269. \fIDisassembly\fR
  270. .IP \fBdisas\fR
  271. Disassemble from current position
  272. .IP \fBdisas\ \fIexpr\fR
  273. Disassemble from address \fIexpr\fR
  274. .IP \fBdisas\ \fIexpr\fB,\fIexpr\fR
  275. Disassembles code between addresses specified by the two expressions
  276. .PP
  277. \fIMemory\ (reading,\ writing,\ typing)\fR
  278. .IP \fBx\ \fIexpr\fR
  279. Examines memory at address \fIexpr\fR
  280. .IP \fBx\ /\fIfmt\ expr\fR
  281. Examines memory at address \fIexpr\fR using format \fIfmt\fR
  282. .IP \fBprint\ \fIexpr\fR
  283. Prints the value of \fIexpr\fR (possibly using its type)
  284. .IP \fBprint\ /\fIfmt\ expr\fR
  285. Prints the value of \fIexpr\fR (possibly using its type)
  286. .IP \fBset\ \fIvar\fB\ =\ \fIexpr\fR
  287. Writes the value of \fIexpr\fR in \fIvar\fR variable
  288. .IP \fBwhatis\ \fIexpr\fR
  289. Prints the C type of expression \fIexpr\fR
  290. .PP
  291. .IP \fIfmt\fR
  292. is either \fIletter\fR or \fIcount letter\fR, where \fIletter\fR
  293. can be:
  294. .RS 4
  295. .IP s
  296. an ASCII string
  297. .IP u
  298. a UTF16 Unicode string
  299. .IP i
  300. instructions (disassemble)
  301. .IP x
  302. 32-bit unsigned hexadecimal integer
  303. .IP d
  304. 32-bit signed decimal integer
  305. .IP w
  306. 16-bit unsigned hexadecimal integer
  307. .IP c
  308. character (only printable 0x20-0x7f are actually printed)
  309. .IP b
  310. 8-bit unsigned hexadecimal integer
  311. .IP g
  312. Win32 GUID
  313. .RE
  314. .PP
  315. \fIExpressions\fR
  316. .PP
  317. Expressions in Wine Debugger are mostly written in a C form. However,
  318. there are a few discrepancies:
  319. .PP
  320. .RS 4
  321. Identifiers can take a '!' in their names. This allows mainly to
  322. specify a module where to look the ID from, e.g. \fIUSER32!CreateWindowExA\fR.
  323. .PP
  324. In a cast operation, when specifying a structure or a union, you must
  325. use the struct or union keyword (even if your program uses a typedef).
  326. .RE
  327. .PP
  328. When specifying an identifier, if several symbols with
  329. this name exist, the debugger will prompt for the symbol you want to
  330. use. Pick up the one you want from its number.
  331. .PP
  332. \fIMisc.\fR
  333. .PP
  334. .BI "minidump " file.mdmp
  335. saves the debugging context of the debuggee into a minidump file called
  336. \fIfile.mdmp\fR.
  337. .PP
  338. \fIInformation on Wine internals\fR
  339. .IP \fBinfo\ class\fR
  340. Lists all Windows classes registered in Wine
  341. .IP \fBinfo\ class\ \fIid\fR
  342. Prints information on Windows class \fIid\fR
  343. .IP \fBinfo\ share\fR
  344. Lists all the dynamic libraries loaded in the debugged program
  345. (including .so files, NE and PE DLLs)
  346. .IP \fBinfo\ share\ \fIN\fR
  347. Prints information on module at address \fIN\fR
  348. .IP \fBinfo\ regs\fR
  349. Prints the value of the CPU registers
  350. .IP \fBinfo\ all-regs\fR
  351. Prints the value of the CPU and Floating Point registers
  352. .IP \fBinfo\ segment\fR
  353. Lists all allocated segments (i386 only)
  354. .IP \fBinfo\ segment\ \fIN\fR
  355. Prints information on segment \fIN\fR (i386 only)
  356. .IP \fBinfo\ stack\fR
  357. Prints the values on top of the stack
  358. .IP \fBinfo\ map\fR
  359. Lists all virtual mappings used by the debugged program
  360. .IP \fBinfo\ map\ \fIN\fR
  361. Lists all virtual mappings used by the program of Windows pid \fIN\fR
  362. .IP \fBinfo\ wnd\fR
  363. Displays the window hierarchy starting from the desktop window
  364. .IP \fBinfo\ wnd\ \fIN\fR
  365. Prints information of Window of handle \fIN\fR
  366. .IP \fBinfo\ process\fR
  367. Lists all w-processes in Wine session
  368. .IP \fBinfo\ thread\fR
  369. Lists all w-threads in Wine session
  370. .IP \fBinfo\ frame\fR
  371. Lists the exception frames (starting from current stack frame). You
  372. can also pass, as optional argument, a thread id (instead of current
  373. thread) to examine its exception frames.
  374. .PP
  375. Debug messages can be turned on and off as you are debugging using
  376. the \fBset\fR command, but only for channels initialized with the
  377. \fIWINEDEBUG\fR environment variable.
  378. .IP \fBset\ warn\ +\ \fIwin\fR
  379. Turns on warn on \fIwin\fR channel
  380. .IP \fBset\ +\ \fIwin\fR
  381. Turns on warn/fixme/err/trace on \fIwin\fR channel
  382. .IP \fBset\ -\ \fIwin\fR
  383. Turns off warn/fixme/err/trace on \fIwin\fR channel
  384. .IP \fBset\ fixme\ -\ all\fR
  385. Turns off fixme class on all channels
  386. .PP
  387. .SS Gdb mode:
  388. .PP
  389. See the \fBgdb\fR documentation for all the \fBgdb\fR commands.
  390. .PP
  391. However, a few Wine extensions are available, through the
  392. \fBmonitor\fR command:
  393. .IP \fBmonitor\ wnd\fR
  394. Lists all windows in the Wine session
  395. .IP \fBmonitor\ proc\fR
  396. Lists all processes in the Wine session
  397. .IP \fBmonitor\ mem\fR
  398. Displays memory mapping of debugged process
  399. .PP
  400. .SS Auto and minidump modes:
  401. .PP
  402. Since no user input is possible, no commands are available.
  403. .SH ENVIRONMENT
  404. .IP \fBWINE_GDB\fR
  405. When used in \fBgdb\fR proxy mode, \fBWINE_GDB\fR specifies the name
  406. (and the path) of the executable to be used for \fBgdb\fR. "gdb"
  407. is used by default.
  408. .SH AUTHORS
  409. The first version was written by Eric Youngdale.
  410. .PP
  411. See Wine developers list for the rest of contributors.
  412. .SH BUGS
  413. Bugs can be reported on the
  414. .UR https://bugs.winehq.org
  415. .B Wine bug tracker
  416. .UE .
  417. .SH AVAILABILITY
  418. .B winedbg
  419. is part of the Wine distribution, which is available through WineHQ,
  420. the
  421. .UR https://www.winehq.org/
  422. .B Wine development headquarters
  423. .UE .
  424. .SH "SEE ALSO"
  425. .BR wine (1),
  426. .br
  427. .UR https://www.winehq.org/help
  428. .B Wine documentation and support
  429. .UE .