* [PATCH] Fix debugging of WOW64 processes
[not found] <20200409145201.18111-1-ssbssa.ref@yahoo.de>
@ 2020-04-09 14:52 ` Hannes Domani
2020-04-09 21:15 ` Tom Tromey
0 siblings, 1 reply; 3+ messages in thread
From: Hannes Domani @ 2020-04-09 14:52 UTC (permalink / raw)
To: gdb-patches
The new code regarding pending stops only checks for EXCEPTION_BREAKPOINT,
but for WOW64 processes STATUS_WX86_BREAKPOINT is necessary as well.
Also, ignore_first_breakpoint is used now in nat/windows-nat.c as well,
but was not available there.
gdb/ChangeLog:
2020-04-09 Hannes Domani <ssbssa@yahoo.de>
* nat/windows-nat.c (STATUS_WX86_BREAKPOINT, STATUS_WX86_SINGLE_STEP):
Move to...
* nat/windows-nat.h (STATUS_WX86_BREAKPOINT, STATUS_WX86_SINGLE_STEP):
... here.
* windows-nat.c (windows_nat_target::get_windows_debug_event):
Check for STATUS_WX86_BREAKPOINT.
(windows_nat_target::wait): Same.
---
gdb/nat/windows-nat.c | 7 ++++---
gdb/nat/windows-nat.h | 8 ++++++++
gdb/windows-nat.c | 9 ++++++---
3 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/gdb/nat/windows-nat.c b/gdb/nat/windows-nat.c
index 94e7f572c0..cd7c1d177c 100644
--- a/gdb/nat/windows-nat.c
+++ b/gdb/nat/windows-nat.c
@@ -20,9 +20,6 @@
#include "nat/windows-nat.h"
#include "gdbsupport/common-debug.h"
-#define STATUS_WX86_BREAKPOINT 0x4000001F
-#define STATUS_WX86_SINGLE_STEP 0x4000001E
-
namespace windows_nat
{
@@ -44,6 +41,10 @@ DWORD desired_stop_thread_id = -1;
std::vector<pending_stop> pending_stops;
EXCEPTION_RECORD siginfo_er;
+#ifdef __x86_64__
+bool ignore_first_breakpoint = false;
+#endif
+
/* Note that 'debug_events' must be locally defined in the relevant
functions. */
#define DEBUG_EVENTS(x) if (debug_events) debug_printf x
diff --git a/gdb/nat/windows-nat.h b/gdb/nat/windows-nat.h
index 0597120c21..aea1519672 100644
--- a/gdb/nat/windows-nat.h
+++ b/gdb/nat/windows-nat.h
@@ -25,6 +25,9 @@
#include "gdbsupport/gdb_optional.h"
#include "target/waitstatus.h"
+#define STATUS_WX86_BREAKPOINT 0x4000001F
+#define STATUS_WX86_SINGLE_STEP 0x4000001E
+
namespace windows_nat
{
@@ -202,6 +205,11 @@ extern std::vector<pending_stop> pending_stops;
/* Contents of $_siginfo */
extern EXCEPTION_RECORD siginfo_er;
+#ifdef __x86_64__
+/* Ignore first breakpoint exception of WOW64 process */
+extern bool ignore_first_breakpoint;
+#endif
+
/* Return the name of the DLL referenced by H at ADDRESS. UNICODE
determines what sort of string is read from the inferior. Returns
the name of the DLL, or NULL on error. If a name is returned, it
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 4fddaa3ffa..9ba27c73a1 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -235,7 +235,6 @@ static int saw_create;
static int open_process_used = 0;
#ifdef __x86_64__
static bool wow64_process = false;
-static bool ignore_first_breakpoint = false;
#endif
/* User options. */
@@ -1657,7 +1656,9 @@ windows_nat_target::get_windows_debug_event (int pid,
if (current_event.dwDebugEventCode == EXCEPTION_DEBUG_EVENT
&& (current_event.u.Exception.ExceptionRecord.ExceptionCode
- == EXCEPTION_BREAKPOINT)
+ == EXCEPTION_BREAKPOINT
+ || current_event.u.Exception.ExceptionRecord.ExceptionCode
+ == STATUS_WX86_BREAKPOINT)
&& windows_initialization_done)
{
ptid_t ptid = ptid_t (current_event.dwProcessId, thread_id, 0);
@@ -1737,7 +1738,9 @@ windows_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
current_windows_thread->stopped_at_software_breakpoint = false;
if (current_event.dwDebugEventCode == EXCEPTION_DEBUG_EVENT
&& (current_event.u.Exception.ExceptionRecord.ExceptionCode
- == EXCEPTION_BREAKPOINT)
+ == EXCEPTION_BREAKPOINT
+ || current_event.u.Exception.ExceptionRecord.ExceptionCode
+ == STATUS_WX86_BREAKPOINT)
&& windows_initialization_done)
current_windows_thread->stopped_at_software_breakpoint = true;
}
--
2.26.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix debugging of WOW64 processes
2020-04-09 14:52 ` [PATCH] Fix debugging of WOW64 processes Hannes Domani
@ 2020-04-09 21:15 ` Tom Tromey
2020-04-10 11:03 ` Hannes Domani
0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2020-04-09 21:15 UTC (permalink / raw)
To: Hannes Domani via Gdb-patches
>>>>> "Hannes" == Hannes Domani via Gdb-patches <gdb-patches@sourceware.org> writes:
Hannes> Also, ignore_first_breakpoint is used now in nat/windows-nat.c as well,
Hannes> but was not available there.
Sorry about that.
Hannes> 2020-04-09 Hannes Domani <ssbssa@yahoo.de>
Hannes> * nat/windows-nat.c (STATUS_WX86_BREAKPOINT, STATUS_WX86_SINGLE_STEP):
Hannes> Move to...
Hannes> * nat/windows-nat.h (STATUS_WX86_BREAKPOINT, STATUS_WX86_SINGLE_STEP):
Hannes> ... here.
Hannes> * windows-nat.c (windows_nat_target::get_windows_debug_event):
Hannes> Check for STATUS_WX86_BREAKPOINT.
Hannes> (windows_nat_target::wait): Same.
Hannes> && (current_event.u.Exception.ExceptionRecord.ExceptionCode
Hannes> - == EXCEPTION_BREAKPOINT)
Hannes> + == EXCEPTION_BREAKPOINT
Hannes> + || current_event.u.Exception.ExceptionRecord.ExceptionCode
Hannes> + == STATUS_WX86_BREAKPOINT)
This needs extra parens and indentation like
&& (current_event.u.Exception.ExceptionRecord.ExceptionCode
== EXCEPTION_BREAKPOINT)
== EXCEPTION_BREAKPOINT
|| (current_event.u.Exception.ExceptionRecord.ExceptionCode
== STATUS_WX86_BREAKPOINT)
Hannes> && (current_event.u.Exception.ExceptionRecord.ExceptionCode
Hannes> - == EXCEPTION_BREAKPOINT)
Hannes> + == EXCEPTION_BREAKPOINT
Hannes> + || current_event.u.Exception.ExceptionRecord.ExceptionCode
Hannes> + == STATUS_WX86_BREAKPOINT)
Likewise. Ok with this fix.
Tom
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix debugging of WOW64 processes
2020-04-09 21:15 ` Tom Tromey
@ 2020-04-10 11:03 ` Hannes Domani
0 siblings, 0 replies; 3+ messages in thread
From: Hannes Domani @ 2020-04-10 11:03 UTC (permalink / raw)
To: Gdb-patches
Am Donnerstag, 9. April 2020, 23:15:59 MESZ hat Tom Tromey <tom@tromey.com> Folgendes geschrieben:
> >>>>> "Hannes" == Hannes Domani via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> Hannes> Also, ignore_first_breakpoint is used now in nat/windows-nat.c as well,
> Hannes> but was not available there.
>
> Sorry about that.
>
> Hannes> 2020-04-09 Hannes Domani <ssbssa@yahoo.de>
>
> Hannes> * nat/windows-nat.c (STATUS_WX86_BREAKPOINT, STATUS_WX86_SINGLE_STEP):
> Hannes> Move to...
> Hannes> * nat/windows-nat.h (STATUS_WX86_BREAKPOINT, STATUS_WX86_SINGLE_STEP):
> Hannes> ... here.
> Hannes> * windows-nat.c (windows_nat_target::get_windows_debug_event):
> Hannes> Check for STATUS_WX86_BREAKPOINT.
> Hannes> (windows_nat_target::wait): Same.
>
> Hannes> && (current_event.u.Exception.ExceptionRecord.ExceptionCode
> Hannes> - == EXCEPTION_BREAKPOINT)
> Hannes> + == EXCEPTION_BREAKPOINT
> Hannes> + || current_event.u.Exception.ExceptionRecord.ExceptionCode
> Hannes> + == STATUS_WX86_BREAKPOINT)
>
> This needs extra parens and indentation like
>
>
> && (current_event.u.Exception.ExceptionRecord.ExceptionCode
> == EXCEPTION_BREAKPOINT)
> == EXCEPTION_BREAKPOINT
> || (current_event.u.Exception.ExceptionRecord.ExceptionCode
> == STATUS_WX86_BREAKPOINT)
>
>
> Hannes> && (current_event.u.Exception.ExceptionRecord.ExceptionCode
> Hannes> - == EXCEPTION_BREAKPOINT)
> Hannes> + == EXCEPTION_BREAKPOINT
> Hannes> + || current_event.u.Exception.ExceptionRecord.ExceptionCode
> Hannes> + == STATUS_WX86_BREAKPOINT)
>
> Likewise. Ok with this fix.
Pushed with these changes, thanks.
Hannes
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-04-10 11:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20200409145201.18111-1-ssbssa.ref@yahoo.de>
2020-04-09 14:52 ` [PATCH] Fix debugging of WOW64 processes Hannes Domani
2020-04-09 21:15 ` Tom Tromey
2020-04-10 11:03 ` Hannes Domani
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).