From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 34069 invoked by alias); 2 Nov 2015 21:01:52 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 33570 invoked by uid 89); 2 Nov 2015 21:01:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 X-HELO: usevmg20.ericsson.net Received: from usevmg20.ericsson.net (HELO usevmg20.ericsson.net) (198.24.6.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 02 Nov 2015 21:01:50 +0000 Received: from EUSAAHC004.ericsson.se (Unknown_Domain [147.117.188.84]) by usevmg20.ericsson.net (Symantec Mail Security) with SMTP id 4A.8E.32596.10E67365; Mon, 2 Nov 2015 15:06:57 +0100 (CET) Received: from [142.133.110.144] (147.117.188.8) by smtp-am.internal.ericsson.com (147.117.188.86) with Microsoft SMTP Server id 14.3.248.2; Mon, 2 Nov 2015 16:01:47 -0500 Subject: Re: [PATCH 08/11] [C++/mingw] Simplify first chance exception handling To: Pedro Alves , References: <1446492970-21432-1-git-send-email-palves@redhat.com> <1446492970-21432-9-git-send-email-palves@redhat.com> From: Simon Marchi Message-ID: <5637CF3B.9060806@ericsson.com> Date: Mon, 02 Nov 2015 21:01:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <1446492970-21432-9-git-send-email-palves@redhat.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-11/txt/msg00052.txt.bz2 On 15-11-02 02:36 PM, Pedro Alves wrote: > I can't figure out why we treat first chance exceptions any different > here. > > We set last_sig to 1, and then call windows_resume passing signal==1, > so the DBG_EXCEPTION_NOT_HANDLED code path in win32_resume is taken: > > ~~~ > if (sig != GDB_SIGNAL_0) > { > if (current_event.dwDebugEventCode != EXCEPTION_DEBUG_EVENT) > { > OUTMSG (("Cannot continue with signal %d here.\n", sig)); > } > else if (sig == last_sig) > continue_status = DBG_EXCEPTION_NOT_HANDLED; > else > OUTMSG (("Can only continue with recieved signal %d.\n", last_sig)); > } > ~~~ > > Fix this by removing this special casing. gdbserver also goes > straight to continuing with DBG_EXCEPTION_NOT_HANDLED, AFAICS. > > gdb/ChangeLog: > 2015-11-01 Pedro Alves > > * windows-nat.c (handle_exception): Return 0 for first chance > exceptions. > (get_windows_debug_event): Adjust. > --- > gdb/windows-nat.c | 24 ++++++------------------ > 1 file changed, 6 insertions(+), 18 deletions(-) > > diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c > index 2e12493..cfbd74a 100644 > --- a/gdb/windows-nat.c > +++ b/gdb/windows-nat.c > @@ -1124,7 +1124,7 @@ handle_exception (struct target_waitstatus *ourstatus) > default: > /* Treat unhandled first chance exceptions specially. */ > if (current_event.u.Exception.dwFirstChance) > - return -1; > + return 0; > printf_unfiltered ("gdb: unknown target exception 0x%08x at %s\n", > (unsigned) current_event.u.Exception.ExceptionRecord.ExceptionCode, > host_address_to_string ( > @@ -1491,19 +1491,10 @@ get_windows_debug_event (struct target_ops *ops, > "EXCEPTION_DEBUG_EVENT")); > if (saw_create != 1) > break; > - switch (handle_exception (ourstatus)) > - { > - case 0: > - continue_status = DBG_EXCEPTION_NOT_HANDLED; > - break; > - case 1: > - thread_id = current_event.dwThreadId; > - break; > - case -1: > - last_sig = 1; > - continue_status = -1; > - break; > - } > + if (handle_exception (ourstatus)) > + thread_id = current_event.dwThreadId; > + else > + continue_status = DBG_EXCEPTION_NOT_HANDLED; > break; > > case OUTPUT_DEBUG_STRING_EVENT: /* Message from the kernel. */ > @@ -1529,10 +1520,7 @@ get_windows_debug_event (struct target_ops *ops, > > if (!thread_id || saw_create != 1) > { > - if (continue_status == -1) > - windows_resume (ops, minus_one_ptid, 0, 1); > - else > - CHECK (windows_continue (continue_status, -1, 0)); > + CHECK (windows_continue (continue_status, -1, 0)); > } > else > { > Does this change fix something initially related to C++?