From patchwork Tue Oct 29 17:57:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Simon Marchi (Code Review)" X-Patchwork-Id: 35437 Received: (qmail 116952 invoked by alias); 29 Oct 2019 18:05:59 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 116791 invoked by uid 89); 29 Oct 2019 18:05:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy= 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, 29 Oct 2019 18:05:56 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id 5B6242132D; Tue, 29 Oct 2019 13:58:10 -0400 (EDT) Received: from gnutoolchain-gerrit.osci.io (gnutoolchain-gerrit.osci.io [8.43.85.239]) by mx1.osci.io (Postfix) with ESMTP id 16EB92134D for ; Tue, 29 Oct 2019 13:57:56 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id 0BD5420AF6 for ; Tue, 29 Oct 2019 13:57:56 -0400 (EDT) X-Gerrit-PatchSet: 1 Date: Tue, 29 Oct 2019 13:57:56 -0400 From: "Tom Tromey (Code Review)" To: gdb-patches@sourceware.org Message-ID: Auto-Submitted: auto-generated X-Gerrit-MessageType: newchange Subject: [review] Share handle_load_dll and handle_unload_dll declarations X-Gerrit-Change-Id: I3ef08b0696174d281cca225e0f7dc237c10b7b32 X-Gerrit-Change-Number: 423 X-Gerrit-ChangeURL: X-Gerrit-Commit: a3d7b81f7beceed167af18ebce35a93d7934f2eb References: Reply-To: tromey@sourceware.org, gdb-patches@sourceware.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/3.0.3-74-g460fb0f7e9 Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/423 ...................................................................... Share handle_load_dll and handle_unload_dll declarations This changes nat/windows-nat.h to declare handle_load_dll and handle_unload_dll. The embedding application is required to implement these -- while the actual code was difficult to share due to some other differences between the two programs, sharing the declaration lets a subsequent patch share more code that uses these as callbacks. Change-Id: I25741fca7402182e069d536e032f1c468d65a68e gdb/ChangeLog 2019-10-29 Tom Tromey * windows-nat.c (windows_nat::handle_load_dll) (windows_nat::handle_unload_dll): Rename. No longer static. * nat/windows-nat.h (handle_load_dll, handle_unload_dll): Declare. gdb/gdbserver/ChangeLog 2019-10-29 Tom Tromey * win32-low.c (windows_nat::handle_load_dll): Rename from handle_load_dll. No longer static. (windows_nat::handle_unload_dll): Rename from handle_unload_dll. No longer static. Change-Id: I3ef08b0696174d281cca225e0f7dc237c10b7b32 --- M gdb/ChangeLog M gdb/gdbserver/ChangeLog M gdb/gdbserver/win32-low.c M gdb/nat/windows-nat.h M gdb/windows-nat.c 5 files changed, 45 insertions(+), 33 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8484dc2..c8e9228 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,12 @@ 2019-10-29 Tom Tromey + * windows-nat.c (windows_nat::handle_load_dll) + (windows_nat::handle_unload_dll): Rename. No longer static. + * nat/windows-nat.h (handle_load_dll, handle_unload_dll): + Declare. + +2019-10-29 Tom Tromey + * complaints.h (stop_whining): Declare at top-level. (complaint): Don't declare stop_whining. diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 72418f8..d3ce252 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,5 +1,12 @@ 2019-10-29 Tom Tromey + * win32-low.c (windows_nat::handle_load_dll): Rename from + handle_load_dll. No longer static. + (windows_nat::handle_unload_dll): Rename from handle_unload_dll. + No longer static. + +2019-10-29 Tom Tromey + * win32-low.c (handle_output_debug_string): Add parameter. Change return type. (win32_kill, get_child_debug_event): Update. diff --git a/gdb/gdbserver/win32-low.c b/gdb/gdbserver/win32-low.c index 7825630..3fcd2a6 100644 --- a/gdb/gdbserver/win32-low.c +++ b/gdb/gdbserver/win32-low.c @@ -1111,15 +1111,10 @@ typedef BOOL (WINAPI *winapi_Module32First) (HANDLE, LPMODULEENTRY32); typedef BOOL (WINAPI *winapi_Module32Next) (HANDLE, LPMODULEENTRY32); -/* Handle a DLL load event. +/* See nat/windows-nat.h. */ - This function assumes that this event did not occur during inferior - initialization, where their event info may be incomplete (see - do_initial_child_stuff and win32_add_all_dlls for more info on - how we handle DLL loading during that phase). */ - -static void -handle_load_dll (void) +void +windows_nat::handle_load_dll () { LOAD_DLL_DEBUG_INFO *event = ¤t_event.u.LoadDll; const char *dll_name; @@ -1132,15 +1127,10 @@ win32_add_one_solib (dll_name, (CORE_ADDR) (uintptr_t) event->lpBaseOfDll); } -/* Handle a DLL unload event. +/* See nat/windows-nat.h. */ - This function assumes that this event did not occur during inferior - initialization, where their event info may be incomplete (see - do_initial_child_stuff and win32_add_one_solib for more info - on how we handle DLL loading during that phase). */ - -static void -handle_unload_dll (void) +void +windows_nat::handle_unload_dll () { CORE_ADDR load_addr = (CORE_ADDR) (uintptr_t) current_event.u.UnloadDll.lpBaseOfDll; diff --git a/gdb/nat/windows-nat.h b/gdb/nat/windows-nat.h index 5eedb54..695170e 100644 --- a/gdb/nat/windows-nat.h +++ b/gdb/nat/windows-nat.h @@ -111,6 +111,25 @@ This function must be supplied by the embedding application. */ extern int handle_output_debug_string (struct target_waitstatus *ourstatus); +/* Handle a DLL load event. + + This function assumes that the current event did not occur during + inferior initialization. + + This function must be supplied by the embedding application. */ + +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 (); + + /* Currently executing process */ extern HANDLE current_process_handle; extern DWORD current_process_id; diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index d175bd7..8bad871 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -748,15 +748,10 @@ return so; } -/* Handle a DLL load event, and return 1. +/* See nat/windows-nat.h. */ - This function assumes that this event did not occur during inferior - initialization, where their event info may be incomplete (see - do_initial_windows_stuff and windows_add_all_dlls for more info - on how we handle DLL loading during that phase). */ - -static void -handle_load_dll () +void +windows_nat::handle_load_dll () { LOAD_DLL_DEBUG_INFO *event = ¤t_event.u.LoadDll; const char *dll_name; @@ -789,16 +784,10 @@ xfree (so); } -/* Handle a DLL unload event. - Return 1 if successful, or zero otherwise. +/* See nat/windows-nat.h. */ - This function assumes that this event did not occur during inferior - initialization, where their event info may be incomplete (see - do_initial_windows_stuff and windows_add_all_dlls for more info - on how we handle DLL loading during that phase). */ - -static void -handle_unload_dll () +void +windows_nat::handle_unload_dll () { LPVOID lpBaseOfDll = current_event.u.UnloadDll.lpBaseOfDll; struct so_list *so;