Patchwork [review] Share handle_load_dll and handle_unload_dll declarations

login
register
mail settings
Submitter Simon Marchi (Code Review)
Date Nov. 26, 2019, 5:11 p.m.
Message ID <gerrit.1574788288000.I25741fca7402182e069d536e032f1c468d65a68e@gnutoolchain-gerrit.osci.io>
Download mbox | patch
Permalink /patch/36234/
State New
Headers show

Comments

Simon Marchi (Code Review) - Nov. 26, 2019, 5:11 p.m.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/714
......................................................................

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.

gdb/ChangeLog
2019-11-26  Tom Tromey  <tromey@adacore.com>

	* 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-11-26  Tom Tromey  <tromey@adacore.com>

	* 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: I25741fca7402182e069d536e032f1c468d65a68e
---
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(-)
Simon Marchi (Code Review) - Nov. 29, 2019, 7:55 p.m.
Pedro Alves has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/714
......................................................................


Patch Set 1: Code-Review+2

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 25616e2..188da7e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@ 
 2019-11-26  Tom Tromey  <tromey@adacore.com>
 
+	* 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-11-26  Tom Tromey  <tromey@adacore.com>
+
 	* 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 bd20f14..5c4c580 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,5 +1,12 @@ 
 2019-11-26  Tom Tromey  <tromey@adacore.com>
 
+	* 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-11-26  Tom Tromey  <tromey@adacore.com>
+
 	* 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 = &current_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 01c647e..78d0421 100644
--- a/gdb/nat/windows-nat.h
+++ b/gdb/nat/windows-nat.h
@@ -115,6 +115,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 f718a8e..caa71dd 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -773,15 +773,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 = &current_event.u.LoadDll;
   const char *dll_name;
@@ -814,16 +809,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;