Commit graph

913 commits

Author SHA1 Message Date
Eric Pouech fdd1c1c776 winedbg: Detect debuggee termination before first exception.
When a crash in a program happens, and the debugger in launched in --auto
mode, in some cases the program terminates before the debugger has gotten
proper context on debuggee.
(Could be a watchdog in programs checking if it's debugged and terminating
itself if so).

Detect debuggee termination and still provide some information on debuggee
(threads, modules, system info). The backtrace will not be available as
no exception is gotten from debuggee.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55187
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-07-07 12:20:23 +02:00
Eric Pouech 7ada0e2239 winedbg: Add 'info system' command.
Letting the information displayed in '--auto' mode be available
as a command.
Simplify a bit the --auto mode handling.

Note:
- the WOW64 status of the debuggee used to be printed in system
  information, which is a bit ackward as system info shouldn't be
  tied to a given process.
- replaced it with supported guest machines (for the record, a
  64-bit only setup incorrectly returns i386 as supported guest;
  I guess we shouldn't care).
- now printing the wow64 status of a process when displaying an
  exception information instead.

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-07-07 12:19:42 +02:00
Eric Pouech bde065746e winedbg: Cache wow64 status inside struct process.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-07-07 12:19:42 +02:00
Alexandre Julliard f20710d9b3 winedbg: Use nameless unions/structs. 2023-06-20 15:58:05 +02:00
Eric Pouech f01ce56a49 winedbg: Improve size management in watch command.
- support 8 byte targets
- default to CPU pointer size if size isn't present nor supported.
- detect unaligned requests

Signed-off-by: Eric Pouech <eric.pouech@codeweavers.com>
2023-04-18 18:18:19 +02:00
Eric Pouech adde76fabd winedbg: Simplify watch command implementation.
This also correctly initialize some lvalue.
Context of the bug has changed, but the underlying issue remained the same.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=39495
Signed-off-by: Eric Pouech <eric.pouech@codeweavers.com>
2023-04-18 18:18:16 +02:00
Eric Pouech 812b4b1ca3 dbghelp: Use source file path as stored in debug info format.
Currently, dbghelp returns the source file either:
- in DOS format when native module option isn't enabled
- as stored in debug info format otherwise

This used to work for PE modules inside ELF shared libraries but is broken
since evolution to REAL modules. This generates several issues:
- winedbg does not always set the native module option when calling dbghelp
  for source file related functions, leading to heterogenous output to user
- some dbghelp function rely on matching source paths, hence leading to
  errors in winedbg when mixing the two formats for the same source file.

Introduce a new Wine only dbghelp option to return the source paths as they
are stored inside debug information format, and activate it unconditionaly
inside winedbg.

This fixes some failure cases of command 'break <NN>' in winedbg.

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-04-18 18:17:44 +02:00
Eric Pouech fd87ddfae7 winedbg: Let 'break symbol : line' command work again.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-04-18 18:17:44 +02:00
Eric Pouech 24069aad30 winedbg: Don't crash when no search path has been set.
Note: it's anyway wrong to search source files inside modules' path
(a proper fix will require revisiting source file handling).
This fix will actually be sufficient when running wine from within
its build tree.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2023-04-05 15:24:41 +02:00
Alexandre Julliard 1774db388b winedbg: Use the Zydis library for disassembly. 2023-02-27 16:36:22 +01:00
Eric Pouech 234943344f winedbg: Don't expose module whose machine isn't the process' one to gdb.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2023-02-06 22:34:44 +01:00
Eric Pouech 71dbcbce26 winedbg: Handle multi-machine process in command 'info share'.
- filter out native machine on wow64 configuration.
- add option to info share to print all modules.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2023-02-06 22:34:44 +01:00
Eric Pouech 433bc12709 winedbg: Fix read access to variables with thread local storage.
No longer relying on loaded module info (getting index address out of
PE image, and caching it in struct dbg_module).

Co-authored-by: Evan Tang <etang@codeweavers.com>
2023-01-26 22:05:13 +01:00
Eric Pouech 224b33c2be winedbg: Track loaded modules.
Co-authored-by: Evan Tang <etang@codeweavers.com>
2023-01-26 22:05:13 +01:00
Eric Pouech 5fc54e3219 winedbg: Use debuggee's bitness for 'examine /a' command.
Also fixes stack dump in crash summary and 'info stack' command.
(We were using debugger's bitness instead).

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2023-01-24 20:14:52 +01:00
Eric Pouech a89975f731 dbghelp: Expose the real path to the module in SymGetModuleInfo*().
Expose the real path of a loaded module (potentially read from
WINEDLLDIR or WINEBUILDDIR or overriden load order or ...).  This
improves gdb integration by passing the real path to the loaded
modules (instead of the paths in c:\windows\ system subdirectories).
Introduce new Wine only dbghelp's extended option to enable the
feature.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54250
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2023-01-24 18:25:58 +01:00
Eric Pouech 3055653c1e winedbg: Pass loaded image's file handle to dbghelp.
In some cases (running from build tree, overriding load order...), the
path to the module from the load DLL debug event isn't the real path
to the loaded module. So pass the handle to loaded module's image from
winedbg to dbghelp (to avoid image lookup).

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54250
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2023-01-24 18:24:13 +01:00
Eric Pouech a922577986 winedbg: Avoid passing a non allocated buffer to HeapFree.
Latest changes to heap management can lead to a crash in this situation.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-12-09 17:52:25 +01:00
Alexandre Julliard 57c58be77d winedbg: Fix printf format warnings on ARM platforms. 2022-12-08 18:11:23 +01:00
Eric Pouech 41221452c8 winedbg: Don't use invalid address mode in exception prolog.
Removes a GCC 12.2 warning about printing NULL string.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-11-14 13:13:02 +01:00
Eric Pouech 001665d735 winedbg: Enhance printing of variables or fields.
Prints 'int a[10]' (instead of 'int[10] a').
Ditto for variables/fields of type function pointer.

And for pure type printing, no longer prints --none-- for
arrays and function pointers.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-09-30 21:20:28 +02:00
Eric Pouech 16bcc3bc29 winedbg: Synthetize pointer to type when not available.
This ensures that we always have a type as pointer to a known <type>
(either because it exists in <type>'s module, or it's synthetized inside
debugger).

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-07-29 18:55:32 +02:00
Eric Pouech dd977e4a85 winedbg: Store result of types_get_info(TI_GET_TYPE) in dbg_type.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-07-29 18:55:30 +02:00
Brendan Shanks 2dba29a653 winedbg: Prefer thread name from GetThreadDescription() in GDB proxy mode. 2022-07-27 23:07:06 +02:00
Brendan Shanks f89c8be852 winedbg: Prefer thread name from GetThreadDescription() in 'info thread' listing. 2022-07-27 23:07:06 +02:00
Brendan Shanks d3b72d0ff1 winedbg: Implement GDB qGetTIBAddr query. 2022-07-27 22:36:31 +02:00
Eric Pouech 890e3baaba winedbg: Use CRT allocation functions.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-07-25 11:22:18 +02:00
Eric Pouech 674ef559e0 winedbg: Do proper error management when reallocating memory.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-07-25 11:22:12 +02:00
Eric Pouech f8d3c2b203 winedbg: No longer hide current WineDbg process from 'info proc'.
We used to hide current WineDbg instance when displaying processes' list
(command 'info proc'). This can potentially generate some "dangling"
processes in the hierarchy (related to this WineDbg instance):
- conhost.exe
- start.exe (when launched from unix shell without full path
  to winedbg.exe)

Also, print a more comprehensive error message when trying to attach to
itself (now that debugger's PID is more easily available).

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-06-29 23:23:41 +02:00
Jinoh Kang f815c2642e winedbg: Clarify options specific to GDB proxy mode.
Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
2022-06-24 22:38:47 +02:00
Jinoh Kang beee5160a8 winedbg: Fix typos in manpage.
Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
2022-06-20 10:37:59 +02:00
Eric Pouech 30313d23a3 winedbg: Remove FORCE_DEREF expressions.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-05-24 20:09:59 +02:00
Eric Pouech 5020371eab winedbg: Extend 'print' command to work with types.
'print struct foo' will show all fields of structure
'print enum bar' will show all definitions inside of enum (and their value)
'print /d <type>' will show the type size (in bytes)

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-05-24 20:09:51 +02:00
Eric Pouech 73770ce573 winedbg: Do type / id discrimination when parsing.
- Get rid of struct type_expr_t
- Enable back typecasts (and rewrite the typecast to fit the type parsing scheme)

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-05-24 20:09:17 +02:00
Eric Pouech af0c59bcc8 winedbg: Use data model for basic type on input.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-05-24 20:09:14 +02:00
Eric Pouech 2d8b709021 winedbg: Redefine internal types with predefined sizes.
This will help mapping a name to a basic type.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-05-24 20:09:07 +02:00
Eric Pouech 685126e857 winedbg: Fix retrieving integral values.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-05-24 20:09:04 +02:00
Eric Pouech 66c3b8176b winedbg: Simplify character output.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-05-24 20:09:02 +02:00
Nikolay Sivov 61f31d149c include: Move minidump types to a separate header.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-18 08:53:42 +02:00
Eric Pouech 6eb18ae692 winedbg: Add 'set' command to change data model.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-13 22:11:41 +02:00
Eric Pouech 96ecee3211 winedbg: Introduce struct data_model to describe the various models for base types.
Detect data model to be used with current debuggee
PE & ELF 32 bit => ILP32
PE 64 bit       => LP64
ELF 64 bit      => LLP64

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-13 22:11:41 +02:00
Eric Pouech a596da54f6 winedbg: Correctly read register values through dbg_lvalue structure.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-02 11:39:10 +02:00
Huw Davies 86a075a027 winedbg: Accept "continue".
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-25 11:50:55 +02:00
Eric Pouech 42f5ff44bd winedbg: Simplify printf for 64 bit integers.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-11 10:14:08 +02:00
Eric Pouech 27c6ac5689 winedbg: Trace 64-bit integers with I64 width modifier.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-08 11:50:36 +02:00
Eric Pouech 9fa624583e winedbg: Get rid of dbg_W2A helper.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-21 11:43:40 +01:00
Eric Pouech fd886c726d winedbg: Use Unicode APIs for process/thread enumeration.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-21 11:43:17 +01:00
Eric Pouech 0046d6eccc winedbg: Get rid of dbg_outputW helper.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-21 11:43:10 +01:00
Brendan Shanks b2d9fbd578 winedbg: Print thread names in 'info thread' listing.
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-01 22:41:15 +01:00
Brendan Shanks 88457bf68e winedbg: Don't set initial thread->name to the tid.
Currently the name is only used by GDB, send the tid there.

Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-01 22:41:15 +01:00