Commit Graph

875 Commits

Author SHA1 Message Date
Eric Pouech 5a94f20065 winedbg: Display line number of syntax errors when reading a command file.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-01 18:13:54 +01:00
Eric Pouech dd59222d4d winedbg: Support # as comment delimiter in commands.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-01 18:13:54 +01:00
Eric Pouech 9061634a01 winedbg: Be more strict when detecting a string from an array.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-01 18:13:54 +01:00
Eric Pouech 6cee83a665 winedbg: Protect fetch_float() in CPU backends against buffer overflow.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-26 22:08:55 +01:00
Eric Pouech 0ed49fabc3 winedbg: Protect against incorrect integer size in be_cpu.fetch_integer() method.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-26 22:08:55 +01:00
Eric Pouech c8006d07eb winedbg: Use debuggee pointer size when extracting typed value.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-26 22:08:55 +01:00
Eric Pouech 16fb9640d7 winedbg: Get size of underlying integral types in enums.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-26 22:08:55 +01:00
Eric Pouech 5b54dac338 winedbg: Use macros when manipulating variants.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-26 22:08:55 +01:00
Eric Pouech 07502a0646 winedbg: Replace wine_dbgstr_longlong with I64 width modifier.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-26 22:08:54 +01:00
Eric Pouech a29a8a317a winedbg: Print 'module+disp' instead of 'func+disp' when the address is after the function.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-26 22:08:54 +01:00
Eric Pouech d65edd04cc winedbg: Use I width modifier for DWORD_PTR printf's args.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-26 22:08:54 +01:00
Eric Pouech 14781c7183 winedbg: Use wide-char string literals.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-26 22:08:54 +01:00
Jinoh Kang ebc60f64e1 winedbg: Implement GDB qXfer object exec-file.
Today, when gdbproxy is started with --no-start mode, GDB fails to
recognise the symbol file unless the `file` command or the
`sharedlibrary` command is explicitly issued.

Also, RHEL's downstream GDB complains with the following message:

  Remote gdbserver does not support determining executable automatically.
  RHEL <=6.8 and <=7.2 versions of gdbserver do not support such automatic executable detection.
  The following versions of gdbserver support it:
  - Upstream version of gdbserver (unsupported) 7.10 or later
  - Red Hat Developer Toolset (DTS) version of gdbserver from DTS 4.0 or later (only on x86_64)
  - RHEL-7.3 versions of gdbserver (on any architecture)

Fix this by implementing the qXfer object "exec-file".

Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-23 21:02:13 +01:00
Jinoh Kang f18c0db314 winedbg: Cache GDB qXfer command result for chunked fetching.
GDB does not retrieve the result of a qXfer command at once; instead, it
issues a series of requests to obtain the result one "chunk" at a time,
and concatenates those chunks internally.  Each request contains offset
and length variables that specify which portion of the result shall be
retrieved.

Today, Winedbg handles this by generating the entire result data each
time a request is received and slicing out the requested range for the
response.  This is not only inefficient due to repeated computation,
but also prone to race condition since the result may change between
successive chunk requests due to the dynamic nature of some commands
such as "libraries" and "threads."

Fix this by cacheing the result into a buffer at the first request, and
use the buffer to serve successive chunk requests.  The cache is
invalidated when the remote requests a different object, or the debugger
reaches the end of the result cache buffer.

Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-23 21:02:13 +01:00
Jinoh Kang 595bfdee71 winedbg: Define table for GDB qXfer command handlers.
Define a handler lookup table for qXfer commands and use it.

This facilitates implementing more qXfer commands and cacheing reply
data.

Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-23 21:02:13 +01:00
Jinoh Kang 4c01e00dbd winedbg: Escape XML special characters in qXfer reply.
Some dynamic strings (e.g. loaded image paths) may contain XML special
characters which breaks parsing.

Fix this by escaping all dynamic strings (i.e. character data and
attribute values) that go into the XML replies.

Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-23 21:02:13 +01:00
Jinoh Kang 26aee726fb winedbg: Buffer output of GDB qXfer commands for proper slicing.
Today, gdbproxy reuses the same buffer for both the qXfer reply and the
actual GDB packet reply.  This worked well, since each byte in the qXfer
reply buffer matched 1:1 to each byte in the actual GDB reply packet.

Since we escape special characters now, this property no longer holds
and a single byte in qXfer reply will take up to two bytes in the GDB
reply packet.  This causes offsets to shift, preventing the
offset/length response slicing (part of GDB protocol) from working
correctly.

Fix this by writing the qXfer reply data in a separate buffer, and
performing slicing out of it.

Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-23 21:02:13 +01:00
Jinoh Kang 16df778627 winedbg: Use exponential growth in gdbproxy reply_buffer_grow.
Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-23 21:02:13 +01:00
Jinoh Kang 9b29182ca7 winedbg: Refactor gdb_context::out_{buf*,len} into reply_buffer.
This is required for a subsequent patch that adds buffering for
GDB qXfer reply data.

Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-23 21:02:13 +01:00
Jinoh Kang f3478b4ec9 winedbg: Escape special characters in GDB packet reply.
There are four special characters in GDB's remote serial protocol:

- '$' (0x24): start of packet
- '}' (0x7D): escape
- '*' (0x2A): run-length encoding repeat count delimiter
- '#' (0x23): end of packet; start of checksum

In particular, the '#' and '}' characters are problematic since they
are often used in library filenames.  A few examples:

- %SystemRoot%\assembly\NativeImages_v[.NET ver]\[module+hash]#\*\*.dll
- {CLSID or UUID}\*\.dll

To make GDB happy with those filenames, we scan for those characters and
escape them properly.

While we are at it, also remove the assert in the packet_reply function
that checks for '$' and '#' in the packet payload.

Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-19 18:57:28 +01:00
Jinoh Kang a4b55c620c winedbg: Use unsigned int for offset/length in GDB qXfer handler.
packet_query uses sscanf format "%x" to parse out offset and length
values.  Since %x corresponds to unsigned int in the C standard, adjust
the variable types appropriately.

Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-19 18:52:30 +01:00
Jinoh Kang d8c07c1391 winedbg: Replace packet_realloc() with realloc().
winedbg is now built with msvcrt, so just use realloc() directly
instead of Win32 heap functions.

Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-19 18:52:21 +01:00
Jinoh Kang 820a866f0d winedbg: Set reuseaddr flag for gdb remote socket.
Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-17 16:02:29 +01:00
Jinoh Kang 829c06741b winedbg: Report current thread ID to GDB for all stop replies.
Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-17 16:01:43 +01:00
Eric Pouech 9808c1d8a3 winedbg: Fix command line arguments parsing.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=42030
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-15 20:00:38 +01:00
Eric Pouech ce6eeda018 winedbg: Use inline contexts oriented APIs for stack backtrace.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-27 22:40:50 +02:00
Eric Pouech 8852004170 winedbg: Use SymSetScopeFromAddr() instead of SymSetContext().
This allows to simplify a bit the frame internal storage
(no longer using IMAGEHLP_STACK_FRAME structure).

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-27 22:40:50 +02:00
Eric Pouech 83f85f5c91 winedbg: Add a pair of helpers for accessing frames' internal info.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-27 22:40:50 +02:00
Alexandre Julliard 43e3e1e409 winedbg: Use the standard va_list instead of __ms_va_list.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-25 11:02:19 +02:00
Alexandre Julliard 2a92c58e11 include: Use the standard va_list instead of __ms_va_list when building with msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-15 18:28:01 +02:00
Eric Pouech 01ddc2f8e4 winedbg: Use proper width when printing addresses with leading 0.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-12 18:41:06 +02:00
Eric Pouech 3a869c1f9b winedbg: Simplify some printing of addresses.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-12 18:41:01 +02:00
Eric Pouech ad8b107441 winedbg: Use proper modifier when using sscanf for a DWORD_PTR.
Regression introduced in 0ea9fe999c.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-12 18:40:54 +02:00
Eric Pouech e3fc699afa winedbg: Fix result type in expression's computation.
All internal computation are made with DWORD_PTR and LONG_PTR,
so use corresponding internal type for the result.

Regression introduced in 0ea9fe999c.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-12 18:40:52 +02:00
Eric Pouech 22c1619409 winedbg: Properly print 64bit integers.
Regression introduced in 0ea9fe999c.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-12 18:40:49 +02:00
Alexandre Julliard 97479d3d32 ntdll: Move some exception definitions to winternl.h.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-07 13:52:42 +02:00
Alexandre Julliard 0ea9fe999c winedbg: Build with msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-04 15:20:56 +02:00
Alexandre Julliard 13125b51cd winedbg: Avoid using the 'long double' type.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-04 15:18:38 +02:00
Alexandre Julliard b9046a4936 winedbg: Avoid using 'long' types.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-04 14:50:41 +02:00
Alexandre Julliard 6a2325609c winedbg: Use winsock for the gdb socket.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-04 11:27:43 +02:00
Alexandre Julliard 6ba7773121 makefiles: Add a -mcygwin flag to specify the inverse of -mno-cygwin.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-20 22:45:48 +02:00
Eric Pouech 0646e15665 winedbg: Show dwarf version(s) used for a module.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-15 22:06:55 +02:00
Zhiyi Zhang dacf456ca6 winedbg: Add system DPI awareness settings to the application manifest.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-08 08:54:52 +02:00
Eric Pouech b99d7db835 winedbg: Allow debugging a 32bit target from a 64bit winedbg.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-02 21:57:39 +02:00
Francois Gouget 7d82abd2be winedbg: dbg_get_debuggee_info() is not used anymore. Remove it.
Signed-off-by: Francois Gouget <fgouget@free.fr>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-26 21:49:09 +02:00
Anton Baskanov 384fc71a48 winedbg: Report library load/unload events to GDB.
This allows GDB to load symbols and resolve pending breakpoints for
dynamically loaded DLLs.

Signed-off-by: Anton Baskanov <baskanov@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-21 22:11:37 +02:00
Eric Pouech 40587a620e winedbg: Add helper in gdbproxy mode to get proper address width information.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-02 20:48:48 +02:00
Eric Pouech 6c91e61c40 winedbg: Correct mapping read/write/execute information.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-02 20:48:23 +02:00
Eric Pouech 5d8bad570d winedbg: Fix crash when no process attached in 'info wnd' command.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49625
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-02 20:47:55 +02:00
Eric Pouech 8600ba2934 winedbg: Accept hex values in command line.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-01 22:34:31 +02:00
Bernhard Übelacker 61310dd3b8 winedbg: Try to load debug symbols for executable in gdb mode.
Signed-off-by: Bernhard Übelacker <bernhardu@mailbox.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-25 22:48:48 +02:00
Zhiyi Zhang 7aa1d1cbe1 winedbg: Enable visual styles.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-16 09:00:12 +02:00
Alexandre Julliard 9dcdb90f42 winedbg: Restart 64-bit version from the system32 directory.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-16 11:15:18 +02:00
Alexandre Julliard c050df1250 winedbg: Use GetMappedFileNameW() as fallback when fetching module names.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-13 13:05:29 +02:00
Alexandre Julliard 39b20a2bd3 winedbg: Use QueryFullProcessImageNameW to retrieve the main image name.
Remove the psapi fallback that didn't work anyway.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-13 13:05:29 +02:00
Rémi Bernon 6eff0342ad winedbg: Don't dereference possibly NULL thread pointer.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-10 18:43:22 +01:00
Rémi Bernon da3be6b0b6 ntdll: Print a warning or an error for other exceptions.
Depending on EH_NONCONTINUABLE.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-08 11:04:17 +01:00
Rémi Bernon 6edf3d3b09 ntdll: Print a warning for thread rename exceptions.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-08 11:00:20 +01:00
Qijia Liu 0201aa3b60 winedbg: Distinguish -0 from 0.
According to A8.8.56, A8.8.64 and A8.8.81 of ARM DDI 0406C.d,
0 and -0 generate different instructions.
Manually add "-".

Signed-off-by: Qijia Liu <liumeo@pku.edu.cn>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-04 14:11:35 +01:00
Qijia Liu c20d49026f winedbg: Remove arm_disasm_branchreg.
According to A8.8.18 of ARM DDI 0406C.d, b instruction only takes
immediate argument.

Signed-off-by: Qijia Liu <liumeo@pku.edu.cn>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-29 21:19:31 +01:00
Alexandre Julliard 2e115ab442 Revert "winecrt0: Make the main() and wmain() entry points cdecl."
This reverts commit f2a7405a09.
We now have separate entry points for msvcrt builds.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-04 11:01:41 +01:00
Alexandre Julliard 6ca76dc5e7 include: Remove some no longer used Unicode functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-02 15:38:25 +01:00
Nikolay Sivov 51fbcc0c23 winedbg: Double dll name buffer size for unimplemented function exception.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-21 12:57:09 +02:00
Alexandre Julliard a9a08dbc3d libwine: Remove wine/library.h.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-08 16:26:17 +02:00
Paul Gofman de1cb029f6 include: Define _XSAVE_FORMAT structure.
The structure is defined for both x86_64 and i386 (along with
M128A) in (newer) Windows SDK.

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-20 18:49:38 +02:00
André Hentschel 4ebba43020 winedbg: Remove support for PPC32.
Signed-off-by: André Hentschel <nerv@dawncrow.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-17 16:46:14 +02:00
Zebediah Figura ea753c384e include: Rename the other In*OrderModuleList fields to In*OrderLinks for consistency.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-24 10:13:49 +02:00
Zebediah Figura 09db718d99 include: Rename BaseAddress to DllBase.
To match Microsoft's public definition.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-24 10:13:46 +02:00
Zebediah Figura feeb1c7c24 include: Rename LDR_MODULE to LDR_DATA_TABLE_ENTRY.
This name is used in Microsoft's public winternl.h.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-24 10:13:39 +02:00
Brendan Shanks c181526303 winedbg: Use RtlGetVersion to fix displayed Windows version on Win8.1 or 10 prefix.
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-16 22:10:04 +02:00
Rémi Bernon dafa8b52d0 winedbg: Use debug event code in packet_reply_status.
This will help expand later the cases to tell gdb about the cause of the
break.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-07 20:55:49 +02:00
Rémi Bernon 86ed5e563d winedbg: Don't wait or load the wine loader module.
Sometimes it's not there and now that we have qXfer:libraries:read
request support, we don't need to tell gdb to load it.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-07 20:55:49 +02:00
Rémi Bernon 5c16408e90 winedbg: Recompute signal from debug event as needed.
No real need for a context member for that as well, the mapping is
quite straightforward. It also simplifies handle_exception.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-06 10:44:39 +02:00
Rémi Bernon 263c283735 winedbg: Clean handle_debug_event return value.
As in the previous patch, return TRUE if the debug event should be
ignored or FALSE is we should tell gdb. There's no need to have an
in_trap context member for that.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-06 10:44:27 +02:00
Rémi Bernon 2fcf051fae winedbg: Clean handle_exception return values.
It was returning a mix of TRUE/FALSE and in some cases DBG_CONTINUE.

Let's return TRUE if the exception has been handled and should be
ignored, or FALSE if not and if we should notify gdb.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-06 10:44:19 +02:00
Rémi Bernon 729a2462fb winedbg: Add support for hardware watchpoints.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-06 10:43:57 +02:00
Rémi Bernon 40f1c6693b winedbg: Use target pointer size in indirect string access.
We read it into a void* so we also need to zero initialize it in case
the target pointer size is shorter than ours.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-06 10:43:39 +02:00
Rémi Bernon fd6ea955d4 winedbg: Remove the use of gdb specific register length.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-03 17:22:19 +02:00
Rémi Bernon 99b7e2bb32 winedbg: Support qXfer:features:read request.
This reports the full register sets to gdb, telling it about custom
offsets and sizes. It will make the gdb specific register length not
required anymore.

We also have to report architecture specific vector types and flags
that are normally builtin in gdb as it does not load them anymore when
custom register set is reported.

This makes gdb stop using its incorrect heuristics and actually request
the library list, it now correctly gets PE modules information and is
able to correctly use debug info from mixed modules.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-03 17:22:10 +02:00
Rémi Bernon 771463adbd winedbg: Add gdb register types to the register maps.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-03 17:22:08 +02:00
Rémi Bernon a650b3d80a winedbg: Add gdb register names to the register maps.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-03 17:21:51 +02:00
Rémi Bernon 6bfaa76caa winedbg: Add gdb feature names to the register maps.
In order not to repeat the features, registers are expected to be
ordered and grouped by feature. If feature name is set only on the
first register of a new feature.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-03 17:21:28 +02:00
Rémi Bernon c2a381fbed winedbg: Support qXfer:threads:read request.
As we don't report fork/vfork/exec events, this allows gdb to request
the list of known threads.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-03 17:06:24 +02:00
Rémi Bernon 1e815b372a winedbg: Support qXfer:libraries:read request.
For now gdb does not request it as it still believes it's running a
normal application. It will however, as soon as we advertise support for
qXfer:features:read request and reply with a custom register set.

This also introduces packet_reply_open_xfer / packet_reply_close_xfer
function to allow partial replies. It always allocate the full reply
for simplicity and then truncates to the requested offset and size.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-03 17:06:24 +02:00
Rémi Bernon 38480c5916 winedbg: Remove uses of dbg_curr_thread from gdbproxy.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-01 22:13:07 +02:00
Rémi Bernon 983d02c08e winedbg: Rewrite and simplify step / continue handlers.
The vCont handler used some overcomplicated logic, we only need to
iterate over the actions and apply them on the matching threads that
didn't match yet.

Thanks to DBG_REPLY_LATER we can now continue/step any thread regardless
of whether it is the one that raised the debug event. Just suspend all
active threads after debug event is raised and resume them one by one,
according to the gdb request. If the thread that raised the debug event
should not be resumed, reply with DBG_REPLY_LATER.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-01 22:13:07 +02:00
Rémi Bernon 7af486075a winedbg: Store the current debug event in gdbctx.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-01 22:13:07 +02:00
Rémi Bernon b434af6637 winedbg: Use tid for other/exec thread operations.
Looking up the thread makes us loose track of any/all (0/-1) tids, we
need that for correct continue/step implementation.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-01 22:13:07 +02:00
Rémi Bernon 90e6a52563 winedbg: Simplify individual thread single_step control.
This is still some cleanup, and does not fix much wrt step / continue,
but it introduces dbg_thread_set_single_step that is going to be useful
for individual thread control and let us remove all remaining uses of
gdbctx->context.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-01 22:13:07 +02:00
Rémi Bernon 1ccd2c2be1 winedbg: Simplify and fix register read/write handlers.
This was using some conditional context read and dbg_curr_thread checks,
we can just read the context of the selected thread and write it back as
needed.

Also, packet_reply_register_hex_to was using gdbctx->context, which is
not always the context we want to read.

We still need to keep changes in sync with gdbctx->context as it may be
still be used for step / continue, but step / continue doesn't work well
and we will rewrite it later.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-01 22:13:07 +02:00
Rémi Bernon 443d000730 winedbg: Remove outdated commented code.
This doesn't compile anymore, let's get rid of it instead or pretending
it can still be useful.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-01 22:13:07 +02:00
Rémi Bernon eba6b38ba3 winedbg: Cleanup return for kill and status packets.
There's a special packet_last_f flag to indicate we should quit, use
that on kill packet instead of exiting abruptly.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-31 17:28:46 +02:00
Rémi Bernon 6deb5895d9 winedbg: Explicitly handle MustReplyEmpty packet.
We now always print a warning when packet_error is returned.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-31 17:28:41 +02:00
Rémi Bernon 83284dbad4 winedbg: Support QStartNoAckMode to reduce verbosity.
We don't have to validate and acknowledge the packets as long as this
mode is enabled, this will reduce verbosity especially when tracing.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-31 17:28:38 +02:00
Rémi Bernon ec76cb754e winedbg: Cleanup extract_packets for faster acking.
Sometimes multiple packets are received and we were assuming it was
some repeated requests due to slow ack. We can ack packets first.

It was also dropping some perfectly valid packets and we should process
them all. For instance, lldb frontend sometimes send multiple packets
at a the same time and expects them to be handled.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-31 17:28:34 +02:00
Rémi Bernon 21c3f183e0 winedbg: Force packet data to be NUL terminated.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-31 17:28:32 +02:00
Rémi Bernon 46ec0b956d winedbg: Force read data to be NUL terminated.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-31 17:28:30 +02:00
Francois Gouget 4dfa8a834d winedbg: Fix the spelling of various messages and the README.
Signed-off-by: Francois Gouget <fgouget@free.fr>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-12-10 20:59:19 +01:00
Francois Gouget 9fbfa988f2 winedbg: Avoid unneeded strlen() calls.
Note that target_xml is an array and thus cannot be NULL.

Signed-off-by: Francois Gouget <fgouget@free.fr>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-12-09 23:47:46 +01:00
Conor McCarthy 26df43d8ca winedbg: Add support for x86_64 indirect function call targets.
Signed-off-by: Conor McCarthy <cmccarthy@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-22 18:02:12 +01:00