Commit Graph

135 Commits

Author SHA1 Message Date
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 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 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
Alexandre Julliard a4fbe12f97 winedbg: Remove some redundant length arguments.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-11-19 22:42:41 +01:00
Andrew Eikum 52fecef1a2 winedbg: In gdbproxy file, allow wine paths with spaces.
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-24 22:41:30 +02:00
Zebediah Figura e525e49976 winedbg/gdbproxy: Silence some noisy debug messages.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-20 09:07:55 +02:00
Zebediah Figura 05e54ac6e6 winedbg: Ignore EXCEPTION_INVALID_HANDLE.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-16 11:07:37 +02:00
Zebediah Figura 1dbab1cd0d winedbg/gdbproxy: Simplify packet_verbose().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-16 11:07:37 +02:00
Zebediah Figura 00349e3f2a winedbg/gdbproxy: Don't try to single-step a terminated process.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-16 11:07:37 +02:00
Zebediah Figura 6159431cd7 winedbg/gdbproxy: Use the WINEDEBUG interface for debugging winedbg.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-16 11:07:37 +02:00
Michael Stefaniuc 0c8e555e4c winedbg: Use the available ARRAY_SIZE() macro.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-06-19 20:48:52 +02:00
Zebediah Figura c1adb6ea1c winedbg/gdbproxy: Handle VS thread renaming.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-06-15 12:56:48 +02:00
Zebediah Figura 1244759036 winedbg/gdbproxy: Store the register map inside the be_cpu struct.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-06-14 09:29:12 +02:00
Zebediah Figura cf349cea69 winedbg: Add a backend-specific vector for setting a thread's context.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-06-13 22:13:27 +02:00
Zebediah Figura 2326179312 winedbg: Add a backend-specific vector for retrieving a thread's context.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-06-13 22:13:27 +02:00
Zebediah Figura 45e0654591 winedbg: Use WOW64_CONTEXT instead of CONTEXT for i386 backend.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-06-13 22:13:27 +02:00
Zebediah Figura b459c88caa winedbg/gdbproxy: Remove unnecessary checks for supported context flags.
And simplify the assignment to use CONTEXT_ALL instead. If we don't support
reading from a register then we just ignore its value.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-06-13 22:13:27 +02:00
Zebediah Figura 42bbeedbe4 winedbg: Make be_cpu process-specific.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-06-13 22:13:27 +02:00
Zebediah Figura a602405efd winedbg: Use gdb's default handling of breakpoints.
We're essentially doing the same thing, so there's no reason not to leave
the handling entirely to gdb.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-05-18 16:33:20 +02:00
Zebediah Figura 3849270aa7 winedbg: Add support for starting on a user-supplied port.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-05-03 10:36:33 +02:00
Martin Storsjo e0780c258f ntdll: Update the ARM64 CONTEXT struct to match Win SDK 10.0.16299.0.
Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-03-19 13:13:59 +01:00
Henri Verbeet fc3ea7d1ef winedbg: Handle byte-sized registers in cpu_register() and cpu_register_hex_from().
Like for example the recently added floating-point TagWord on AMD64.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-02-07 19:38:30 +01:00
Vladimir Bespalov 57ccf8221f winedbg: Fix enum value compilation warning.
Signed-off-by: Vlad Bespalov <vlad.botanic@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-02-07 19:38:29 +01:00
Zebediah Figura eb63a5f3c3 winedbg/gdbproxy: Replace memory read over a breakpoint with the real value.
Normally, when we hit a breakpoint, we remove it before stopping and add it
after continuing. gdb, however, reads the process memory before requesting
that the breakpoint be removed, and apparently caches it until the `stepi`
instruction is executed; as a result, it thinks that the interrupt byte that
is present in the code is an actual interrupt and not a breakpoint, and so
tries to step over it as one byte instead of executing the real instruction
at that location.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-01-19 12:12:02 +01:00
Zebediah Figura d1e9694eda winedbg/gdbproxy: Add support for floating-point registers on x86 and x86_64.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-01-19 12:12:02 +01:00
Alexandre Julliard 21c12ddc64 ntdll: Fix CONTEXT definition for ARM64.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-12-05 20:30:01 +01:00
Alexandre Julliard eb337adcc2 ntdll: Fix CONTEXT definition for ARM.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-12-05 13:21:31 +01:00
Gerald Pfeifer cf48fbcf36 winedbg: Extend buffer in packet_query_monitor_process to avoid avoid overrun/truncation.
Signed-off-by: Gerald Pfeifer <gerald@pfeifer.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-10-03 11:51:32 +02:00