]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix debugging of WOW64 processes
authorHannes Domani <ssbssa@yahoo.de>
Thu, 9 Apr 2020 14:33:20 +0000 (16:33 +0200)
committerHannes Domani <ssbssa@yahoo.de>
Fri, 10 Apr 2020 11:01:31 +0000 (13:01 +0200)
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-10  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/ChangeLog
gdb/nat/windows-nat.c
gdb/nat/windows-nat.h
gdb/windows-nat.c

index 2c347fc473d723a4de0b2d015ba6dd7b15c6f0ed..a961511b46ceb79782f311809e78737bffe76352 100644 (file)
@@ -1,3 +1,13 @@
+2020-04-10  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.
+
 2020-04-10  Tom de Vries  <tdevries@suse.de>
 
        PR cli/25808
index 94e7f572c0a46447d477ae2a2609f2c0502d465d..cd7c1d177c6c2453f3feaf3174096cf057ec2368 100644 (file)
@@ -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
index 0597120c2180fba65ec0da5ec08c21811163b0f2..aea1519672d4f72aac0680504be03b5db8b8ad44 100644 (file)
@@ -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
index cdaca8d0cbf6391b7e0f6412b252ad1515356ddc..881240c6934751f1317a63f051a9b9f9ab85058b 100644 (file)
@@ -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.  */
@@ -1721,8 +1720,10 @@ windows_nat_target::get_windows_debug_event (int pid,
                     thread_id, desired_stop_thread_id));
 
       if (current_event.dwDebugEventCode == EXCEPTION_DEBUG_EVENT
-         && (current_event.u.Exception.ExceptionRecord.ExceptionCode
-             == EXCEPTION_BREAKPOINT)
+         && ((current_event.u.Exception.ExceptionRecord.ExceptionCode
+              == 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);
@@ -1801,8 +1802,10 @@ 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)
+                 && ((current_event.u.Exception.ExceptionRecord.ExceptionCode
+                      == EXCEPTION_BREAKPOINT)
+                     || (current_event.u.Exception.ExceptionRecord.ExceptionCode
+                         == STATUS_WX86_BREAKPOINT))
                  && windows_initialization_done)
                current_windows_thread->stopped_at_software_breakpoint = true;
            }