From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id YHPCHjKEa19WYQAAWB0awg (envelope-from ) for ; Wed, 23 Sep 2020 13:21:54 -0400 Received: by simark.ca (Postfix, from userid 112) id 762291EE05; Wed, 23 Sep 2020 13:21:54 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 3EB121EDF4 for ; Wed, 23 Sep 2020 13:21:50 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6EE4D3950C1A; Wed, 23 Sep 2020 17:21:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6EE4D3950C1A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1600881709; bh=j1sSEsF7n0npdiUNcpcv4Z5cb/eVxW0Eqjw5dFmodwc=; h=To:Subject:Date:References:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=fVOfKv0PIfjJMtmDzS5HaBBXu3Yz0CNEy//d5pm71POsf9s4+RFpx6uIvP9efyayW r6wwdMazQd568QQvMJY8/RgcuSZruPdNN0uBEUJxvwxhMfCjq4MlJimQ+4zjBwGJVv q+wM0d8qQgAYPMYhDv4I54EKGEL171ctncLAWCsI= Received: from sonic312-26.consmr.mail.ir2.yahoo.com (sonic312-26.consmr.mail.ir2.yahoo.com [77.238.178.97]) by sourceware.org (Postfix) with ESMTPS id 267053840C18 for ; Wed, 23 Sep 2020 17:21:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 267053840C18 X-YMail-OSG: yCUe8.gVM1m75qDW5JftnnlkTlsq6_4Yp1Ijw2eQ_Ly5gTIj1BoYYexPX9Y1Up6 En300uwn58JmqQlKsCie.4Esyku6XPVDHQzeb_dqwHocZeiJ3.IyAXMSftBp14.UUT2TjWKO3D3X zUxiyV6lN3ipfn5zVPd5ecLed35aGF_xLBTcoo.Nufh7axdZ_gXKAoS.621ot6vwOQ.KJ0tKqEn0 HftUPt.eU1kT22_HWL2D7h2C4F45EF91tZTMPrpaWBKhvZ8ruj5RC1MHcq3KoboDLWHBf74m1r_k loTPmn1dsXHD33LxzAwGQiDJQGJ3p6I4bNUU1YazFwMh86aNxxQ4XS51pmf2r479S7xoyHK2KO0e Zw0tvII.yEhyLSTIEKkn8vMzdzi8uGXs2XAw5EVu0vAXH4vPsatIZ9Q70Ch5Lh4og0BP7A0wRAXA 8o7yl33TWhYBJLWOhde6T2YPlmatUq4XRgpnmr7gTxKOdzlD9P2XphXhkTPPqfRyT4U..LQ4Cn47 KfQkutSKA9q1u9OPI5Zc5PhzXRSKkembASLHv6QERMbUCdOAy9wWZcv_iFGcLjXQMOM9YkAOAvzO _eMTIINTflwb5zMXcaliMkuzC3vR635s6TPTyPlbd1dwFXRk86lSWG3Mn3_z8uMbdGBpi6cE.sV4 kIA9avzM6yHySrBZR9lodopjk24tWU.SwZEHd83CdiYKDn93WA2ph9NK0sOPb_EXluM4xp7Ff0ef EDqORoRZE6FnMj5dxahK_4surnQu2ToIbIN9puk2qBj0UIMApYHT6PlOTcRtawZOwqQ2W65pWKZD gELpvVx9pMMVCEVf7RjBPD3guoTmeCiuhWkPZvs.a1sVJfnU8y0qj6tqRvbXc__RNcgQ6oththAG h1OB35tEDsNMHa9WOfRS_4cu0zGgloG6gSxytgbWNH3CKyNMU7PuR4dQKIHKsBSzRRTUe4yFfUqg np8Qrfi8Ridgu.bMqD137X33qE5Y9oNK7dAhd7Hpp1xEZt2ulXHCNyCR4QCT2dtKwBOUZw1SPPc4 zh0QovIHovb7YcL.IDu3HvHOeEvJK9LJoakw2AO6Lh7Jd7ZqXQUheHIuniRbk3mEdl4hRm8eUz3Z CL5wHojIvbSPiJ_KpL0Ix2lAwzizZjebHRqOAaJdCVFTbt4gkWfaRSUpC1J5UzRkkHGjt6y4m9FK Ua3KO7m2ZPZyNP5DPlyMN9c4fwFhIq3_AO_9FJHgZknfCpKq1K8xcFzX29S.yecvaMHoWASzTOYn X2km8MN83m8auoXozYVTf2WXZfCONXWW0Enbh4SVMJO1y9vXkwSk.k50p7Et61ow8ndjvihZUSqe M_OEGFc5Jq66V7qDioqcTRvgrtVkU2G9fsCpDQTi2GtnrpUTf0di3Ub_RKj.RweizWfqvaGDxJXr _x4v0qBQevom4OnNcPJXmGTnJxy4J1hU8kA50WajnLpFlkctyYnVbr7UZTp6oiXoB5dQntAcuzDf I3HWp_BLoPtCiw1Rc0kp8SRfyoBz5dHRVPBUd70g18bk5leb2d6vH7RXSodfYVOCpStxbv420fA- - Received: from sonic.gate.mail.ne1.yahoo.com by sonic312.consmr.mail.ir2.yahoo.com with HTTP; Wed, 23 Sep 2020 17:21:46 +0000 Received: by smtp405.mail.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 09a9a830d4366d0a19bd006c6c28dbf6; Wed, 23 Sep 2020 17:21:42 +0000 (UTC) To: gdb-patches@sourceware.org Subject: [PATCH 1/3] Handle 64bit breakpoints of WOW64 processes as SIGINT Date: Wed, 23 Sep 2020 19:21:20 +0200 Message-Id: <20200923172122.2089-1-ssbssa@yahoo.de> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Antivirus: Avast (VPS 200923-0, 09/23/2020), Outbound message X-Antivirus-Status: Clean References: <20200923172122.2089-1-ssbssa.ref@yahoo.de> 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: , From: Hannes Domani via Gdb-patches Reply-To: Hannes Domani Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" When a WOW64 process triggers a breakpoint exception in 64bit code (which happens when a 64bit gdb calls DebugBreakProcess for a 32bit target), gdb ignores the breakpoint (because Wow64GetThreadContext can only report the pc of 32bit code, and there is not int3 at this location). But if these 64bit breakpoint exceptions are handled as SIGINT, gdb doesn't check for int3, and always stops the target. gdb/ChangeLog: 2020-09-23 Hannes Domani * nat/windows-nat.c (handle_exception): Handle 64bit breakpoints in WOW64 processes as SIGINT. * nat/windows-nat.h: Make wow64_process a shared variable. * windows-nat.c: Remove static wow64_process variable. gdbserver/ChangeLog: 2020-09-23 Hannes Domani * win32-low.cc: Remove local wow64_process variable. * win32-low.h: Remove local wow64_process variable. --- gdb/nat/windows-nat.c | 8 ++++++++ gdb/nat/windows-nat.h | 2 ++ gdb/windows-nat.c | 1 - gdbserver/win32-low.cc | 4 ---- gdbserver/win32-low.h | 2 -- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/gdb/nat/windows-nat.c b/gdb/nat/windows-nat.c index be6db9719a..a277156138 100644 --- a/gdb/nat/windows-nat.c +++ b/gdb/nat/windows-nat.c @@ -41,6 +41,7 @@ std::vector pending_stops; EXCEPTION_RECORD siginfo_er; #ifdef __x86_64__ +bool wow64_process = false; bool ignore_first_breakpoint = false; #endif @@ -240,6 +241,13 @@ handle_exception (struct target_waitstatus *ourstatus, bool debug_exceptions) ourstatus->kind = TARGET_WAITKIND_SPURIOUS; ignore_first_breakpoint = false; } + else if (wow64_process) + { + DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_BREAKPOINT"); + rec->ExceptionCode = DBG_CONTROL_C; + ourstatus->value.sig = GDB_SIGNAL_INT; + break; + } #endif /* FALLTHROUGH */ case STATUS_WX86_BREAKPOINT: diff --git a/gdb/nat/windows-nat.h b/gdb/nat/windows-nat.h index f742db2acc..9bfcb16865 100644 --- a/gdb/nat/windows-nat.h +++ b/gdb/nat/windows-nat.h @@ -215,6 +215,8 @@ extern std::vector pending_stops; extern EXCEPTION_RECORD siginfo_er; #ifdef __x86_64__ +/* The target is a WOW64 process */ +extern bool wow64_process; /* Ignore first breakpoint exception of WOW64 process */ extern bool ignore_first_breakpoint; #endif diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index ec5e428126..1e8e21446f 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -235,7 +235,6 @@ static std::vector thread_list; static int saw_create; static int open_process_used = 0; #ifdef __x86_64__ -static bool wow64_process = false; static void *wow64_dbgbreak; #endif diff --git a/gdbserver/win32-low.cc b/gdbserver/win32-low.cc index a11cc74092..588a23a643 100644 --- a/gdbserver/win32-low.cc +++ b/gdbserver/win32-low.cc @@ -91,10 +91,6 @@ static int faked_breakpoint = 0; /* True if current_process_handle needs to be closed. */ static bool open_process_used = false; -#ifdef __x86_64__ -bool wow64_process = false; -#endif - const struct target_desc *win32_tdesc; #ifdef __x86_64__ const struct target_desc *wow64_win32_tdesc; diff --git a/gdbserver/win32-low.h b/gdbserver/win32-low.h index f3b44776ae..258eeb3506 100644 --- a/gdbserver/win32-low.h +++ b/gdbserver/win32-low.h @@ -30,8 +30,6 @@ extern const struct target_desc *win32_tdesc; #ifdef __x86_64__ extern const struct target_desc *wow64_win32_tdesc; -extern bool wow64_process; - typedef BOOL (WINAPI *winapi_Wow64GetThreadContext) (HANDLE, PWOW64_CONTEXT); extern winapi_Wow64GetThreadContext win32_Wow64GetThreadContext; #endif -- 2.27.0