From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sonic309-24.consmr.mail.ir2.yahoo.com (sonic309-24.consmr.mail.ir2.yahoo.com [77.238.179.82]) by sourceware.org (Postfix) with ESMTPS id BE64A385B835 for ; Thu, 9 Apr 2020 14:52:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BE64A385B835 X-YMail-OSG: uaZSxHoVM1mM4LPLP7gDln29voc4gJpkFC1DDESJUUiXCgByi5lmLZU74NCD3wi fwIrQ_6KVz9CR8krbNeGhrAGdHOMi9EnKrSuGoQ0.HhBp_HGBwdbxxr1e5E8IVNYpycPw3Fdfgmb oOSjhDyP5yhJkwRuEhM_qRdIeS2DKVE5XR28h2Q0hWOhJ4GPcJXWVo6mygnx3WczXjYFi8NBSOG1 zdxyaebO2KUxNdLvf3jPDgiK_gBgIQY4FBeFomcXDgGJJS5Aftv9K22mrGBrfKRmfNhB50E7u_oa jCnbe05MmfZTPEv0IsVbkvtMaR0DF1eoq1yWDqPqayUE6xPHmV12WuRzS0YdEdJmx.tckbzn.jKQ _nS855M1Ho2qcPfO5JvxRoLrPd62itsfQwOl3o2sPH3zGPzXxG0TlIk2iRoopsCrNgsOtzITrCgN mvRy6pvkjiZLr6.gRKch8wyENyI4SZKI1yeJeR7HlDQFNr2tyUIGTs0fyZR0oJc.e_v6OdMVYS9l 2V22l.9km0.XY_eqEJL1mF7BgQmRoSR.zGXA9YdoIDV24JnxWe_S4DPx3uu57KCly6HJ1SwzYC8d HGnoxX3jzG5MhpsY5oTqVzOMLuCY7h7QLzbFMCZBmu7__rOq6bWX1MnObmOk.Mit9ht.1q5TajbM 1DJOvWKgmt4HgVF5G4HC5lRxr_zHuNCBvjhmMwJZt3STtCJPw_xc.YpBCC4OpgxdtXt4LNwzI8Ud aZFda785wGMnNOTzf3J2gW9i_7wYMbZ4ls64Zpfa19kWlLaFwiGPcdXrFC2isgCefK8WqqvViOGi Q1rnWqTT6JudebGSyWvzsJjydQsfgLMRh_tULeovTHcX6vsuVjHtJ.rBAOl1GryS4NUWRsKdyoll R6nTTVgVJB2opsjBZj7.Pvgsmyphdq8GhH0MRHBUBh6shXUrLzc5igex.5AArtUn5_p._ddpOMZ6 x1ZUJOM7kxHZqu.lKRnZHg_b4htlNGes.1FE7WYSqsG4sbUowKwZbFht0xT2LJtIW6sBXn_sVaNy YSQzfQg7kBVAvJsrdlXV_xwglDtBLQbbKdAKxEI1bCFavmMpccZK4xNkokPQqksL8ttmgGwaWBvF Hrw3HXP4y7MkTLcbOP3za5v7Lkqe9NnCh2AssA_Cwkh6Q6h_ZYzODZ.7Yb8jSjJel.pE061fitgr cN9fw83t.CMChs_z3lv7E7Ve0j5Idw3QXsvq2UOgwYNSBT7EmHJHvX7G7EY.BEoxD1coEGF.UuTV qyAtDBfiUwprQ.KEkartfeVCjzt8th8CvBYdPW135aDhy0aMHwh5_iEbxf0j0KegMVdRYDi8sz3F GiQT4.mH6c2PgZqnCGHdN.2SRpgEr4wgqcrbs1H6CGOQ3RVBtNHAx.U6GL6L.J4g9FOsJemRxrHW Ziu7mu_YCldSd75zuL7Y4B1c- Received: from sonic.gate.mail.ne1.yahoo.com by sonic309.consmr.mail.ir2.yahoo.com with HTTP; Thu, 9 Apr 2020 14:52:31 +0000 Received: by smtp423.mail.ir2.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID c3a83e7451a79c42a9ae22d92fb23112; Thu, 09 Apr 2020 14:52:28 +0000 (UTC) From: Hannes Domani To: gdb-patches@sourceware.org Subject: [PATCH] Fix debugging of WOW64 processes Date: Thu, 9 Apr 2020 16:52:01 +0200 Message-Id: <20200409145201.18111-1-ssbssa@yahoo.de> X-Mailer: git-send-email 2.26.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Antivirus: Avast (VPS 200408-4, 04/08/2020), Outbound message X-Antivirus-Status: Clean References: <20200409145201.18111-1-ssbssa.ref@yahoo.de> X-Spam-Status: No, score=-17.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Apr 2020 14:52:35 -0000 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 * 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_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_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