From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 125581 invoked by alias); 19 Nov 2019 19:55:27 -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 125562 invoked by uid 89); 19 Nov 2019 19:55:26 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-14.0 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=2019-10-18, 20191018, 1195, HANDLE X-HELO: mx1.osci.io Received: from polly.osci.io (HELO mx1.osci.io) (8.43.85.229) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 19 Nov 2019 19:55:24 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id B9F2F203C1; Tue, 19 Nov 2019 14:55:22 -0500 (EST) Received: from gnutoolchain-gerrit.osci.io (gnutoolchain-gerrit.osci.io [8.43.85.239]) by mx1.osci.io (Postfix) with ESMTP id 4912E201F1; Tue, 19 Nov 2019 14:55:21 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id 1B4CB2816F; Tue, 19 Nov 2019 14:55:21 -0500 (EST) X-Gerrit-PatchSet: 1 Date: Tue, 19 Nov 2019 19:55:00 -0000 From: "Pedro Alves (Code Review)" To: Tom Tromey , gdb-patches@sourceware.org Auto-Submitted: auto-generated X-Gerrit-MessageType: comment Subject: [review] Share handle_exception X-Gerrit-Change-Id: I2efe53c78f5a8e28381e539505f1b703967933c4 X-Gerrit-Change-Number: 425 X-Gerrit-ChangeURL: X-Gerrit-Commit: 99b095d0d12a56e9159666a96ec57f91848cad1f In-Reply-To: References: X-Gerrit-Comment-Date: Tue, 19 Nov 2019 14:55:20 -0500 Reply-To: gnutoolchain-gerrit@osci.io MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline User-Agent: Gerrit/3.0.3-79-g83ff7f88f1 Content-Type: text/plain; charset=UTF-8 Message-Id: <20191119195521.1B4CB2816F@gnutoolchain-gerrit.osci.io> X-SW-Source: 2019-11/txt/msg00603.txt.bz2 Pedro Alves has posted comments on this change. Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/425 ...................................................................... Patch Set 1: (5 comments) | --- /dev/null | +++ /COMMIT_MSG | @@ -1,0 +3,20 @@ Author: Tom Tromey | +AuthorDate: 2019-10-18 13:26:45 -0600 | +Commit: Tom Tromey | +CommitDate: 2019-10-29 10:08:40 -0600 | + | +Share handle_exception | + | +Both gdb and gdbserver have a "handle_exception" function, the bulk of | +which is shared between the two implementations. This patch arranges | +for the entire thing to be moved into nat/windows-nat.c, with the | +differences handled by callbacks. This patch introduces one more | +callback to make this possible. PS1, Line 13: That's: > (windows_nat::handle_ms_vc_exception): New function. There's no reason we couldn't just support thread names in gdbserver as well. It just wasn't done when the original support was added, left forever stuck as a TODO item. You'd just have to install a target_ops::thread_name implementation on win32-low.c as well. | + | +Change-Id: I4e6e0d17b868cd51964c273fb28ec066fea6b767 | + | +gdb/ChangeLog | +2019-10-29 Tom Tromey | + | + * windows-nat.c (MS_VC_EXCEPTION): Move to nat/windows-nat.c. | + (handle_exception_result): Move to nat/windows-nat.h. | + (DEBUG_EXCEPTION_SIMPLE): Remove. | --- gdb/gdbserver/win32-low.c | +++ gdb/gdbserver/win32-low.c | @@ -1287,16 +1187,18 @@ /* Get the next event from the child. */ | static int | -get_child_debug_event (struct target_waitstatus *ourstatus) | +get_child_debug_event (DWORD *continue_status, | + struct target_waitstatus *ourstatus) | { | ptid_t ptid; | | last_sig = GDB_SIGNAL_0; | ourstatus->kind = TARGET_WAITKIND_SPURIOUS; | + *continue_status = DBG_CONTINUE; PS1, Line 1195: Given this... | | /* Check if GDB sent us an interrupt request. */ | check_remote_input_interrupt_request (); | | if (soft_interrupt_requested) | { | soft_interrupt_requested = 0; | fake_breakpoint_event (); | goto gotevent; ... | @@ -1499,17 +1403,18 @@ win32_wait (ptid_t ptid, struct target_waitstatus *ourstatus, int options) | fails). Report it now. */ | *ourstatus = cached_status; | cached_status.kind = TARGET_WAITKIND_IGNORE; | return debug_event_ptid (¤t_event); | } | | while (1) | { | - if (!get_child_debug_event (ourstatus)) | + DWORD continue_status = DBG_CONTINUE; PS1, Line 1411: ... this here doesn't appear necessary. | + if (!get_child_debug_event (&continue_status, ourstatus)) | continue; | | switch (ourstatus->kind) | { | case TARGET_WAITKIND_EXITED: | OUTMSG2 (("Child exited with retcode = %x\n", | ourstatus->value.integer)); | win32_clear_inferiors (); | --- gdb/nat/windows-nat.h | +++ gdb/nat/windows-nat.h | @@ -123,11 +123,19 @@ extern void handle_load_dll (); | /* Handle a DLL unload event. | | This function assumes that this event did not occur during inferior | initialization. | | This function must be supplied by the embedding application. */ | | extern void handle_unload_dll (); | | +/* Handle MS_VC_EXCEPTION when processing a FIXME. PS1, Line 132: FIXME? | + | + Return true if the exception was handled; return false otherwise. | + | + This function must be supplied by the embedding application. */ | + | +extern bool handle_ms_vc_exception (const EXCEPTION_RECORD *rec); | + | | /* Currently executing process */ ... | @@ -195,4 +203,14 @@ extern const char *get_image_name (HANDLE h, void *address, int unicode); | | +typedef enum | +{ | + HANDLE_EXCEPTION_UNHANDLED = 0, | + HANDLE_EXCEPTION_HANDLED, | + HANDLE_EXCEPTION_IGNORED | +} handle_exception_result; | + | +extern handle_exception_result handle_exception | + (struct target_waitstatus *ourstatus, bool debug_exceptions); PS1, Line 212: Two leading spaces: extern handle_exception_result handle_exception (struct target_waitstatus *ourstatus, bool debug_exceptions); See e.g. extension-priv.h. | + | } | | #endif -- Gerrit-Project: binutils-gdb Gerrit-Branch: master Gerrit-Change-Id: I2efe53c78f5a8e28381e539505f1b703967933c4 Gerrit-Change-Number: 425 Gerrit-PatchSet: 1 Gerrit-Owner: Tom Tromey Gerrit-CC: Pedro Alves Gerrit-Comment-Date: Tue, 19 Nov 2019 19:55:20 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment