public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdb: remove deprecated_exec_file_display_hook and associated code
@ 2024-01-19 22:23 Andrew Burgess
  0 siblings, 0 replies; only message in thread
From: Andrew Burgess @ 2024-01-19 22:23 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=81b6f191f71fe0af5dd7b1c7c5b7737c3d249a66

commit 81b6f191f71fe0af5dd7b1c7c5b7737c3d249a66
Author: Andrew Burgess <aburgess@redhat.com>
Date:   Fri Dec 29 09:50:10 2023 +0000

    gdb: remove deprecated_exec_file_display_hook and associated code
    
    This commit removes deprecated_exec_file_display_hook and the
    associated specify_exec_file_hook.
    
    The specify_exec_file_hook is used to add a new hook function to
    deprecated_exec_file_display_hook, but is only used from the insight
    debugger.
    
    I posted a patch to remove the use of specify_exec_file_hook from
    insight, and instead use gdb::observers::executable_changed, this
    patch can be found here (it has now been merged):
    
      https://inbox.sourceware.org/insight/6abeb45e97d9004ec331e94cf2089af00553de76.1702379379.git.aburgess@redhat.com/T/#u
    
    With this merged we can now cleanup the GDB side as this code is now
    unused.
    
    There should be no user visible changes after this commit.
    
    Approved-By: Tom Tromey <tom@tromey.com>

Diff:
---
 gdb/corefile.c | 67 ----------------------------------------------------------
 gdb/exec.c     |  4 ----
 gdb/gdbcore.h  |  5 -----
 3 files changed, 76 deletions(-)

diff --git a/gdb/corefile.c b/gdb/corefile.c
index d033a82e427..bb07ef992a9 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -35,73 +35,6 @@
 #include "gdbarch.h"
 #include "interps.h"
 
-/* You can have any number of hooks for `exec_file_command' command to
-   call.  If there's only one hook, it is set in exec_file_display
-   hook.  If there are two or more hooks, they are set in
-   exec_file_extra_hooks[], and deprecated_exec_file_display_hook is
-   set to a function that calls all of them.  This extra complexity is
-   needed to preserve compatibility with old code that assumed that
-   only one hook could be set, and which called
-   deprecated_exec_file_display_hook directly.  */
-
-typedef void (*hook_type) (const char *);
-
-hook_type deprecated_exec_file_display_hook;	/* The original hook.  */
-static hook_type *exec_file_extra_hooks;	/* Array of additional
-						   hooks.  */
-static int exec_file_hook_count = 0;		/* Size of array.  */
-
-\f
-
-/* If there are two or more functions that wish to hook into
-   exec_file_command, this function will call all of the hook
-   functions.  */
-
-static void
-call_extra_exec_file_hooks (const char *filename)
-{
-  int i;
-
-  for (i = 0; i < exec_file_hook_count; i++)
-    (*exec_file_extra_hooks[i]) (filename);
-}
-
-/* Call this to specify the hook for exec_file_command to call back.
-   This is called from the x-window display code.  */
-
-void
-specify_exec_file_hook (void (*hook) (const char *))
-{
-  hook_type *new_array;
-
-  if (deprecated_exec_file_display_hook != NULL)
-    {
-      /* There's already a hook installed.  Arrange to have both it
-	 and the subsequent hooks called.  */
-      if (exec_file_hook_count == 0)
-	{
-	  /* If this is the first extra hook, initialize the hook
-	     array.  */
-	  exec_file_extra_hooks = XNEW (hook_type);
-	  exec_file_extra_hooks[0] = deprecated_exec_file_display_hook;
-	  deprecated_exec_file_display_hook = call_extra_exec_file_hooks;
-	  exec_file_hook_count = 1;
-	}
-
-      /* Grow the hook array by one and add the new hook to the end.
-	 Yes, it's inefficient to grow it by one each time but since
-	 this is hardly ever called it's not a big deal.  */
-      exec_file_hook_count++;
-      new_array = (hook_type *)
-	xrealloc (exec_file_extra_hooks,
-		  exec_file_hook_count * sizeof (hook_type));
-      exec_file_extra_hooks = new_array;
-      exec_file_extra_hooks[exec_file_hook_count - 1] = hook;
-    }
-  else
-    deprecated_exec_file_display_hook = hook;
-}
-
 void
 reopen_exec_file (void)
 {
diff --git a/gdb/exec.c b/gdb/exec.c
index f72f2eba38a..f17040a7a1b 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -494,10 +494,6 @@ exec_file_attach (const char *filename, int from_tty)
 	 target.  */
       current_program_space->add_target_sections
 	(current_program_space->ebfd.get (), sections);
-
-      /* Tell display code (if any) about the changed file name.  */
-      if (deprecated_exec_file_display_hook)
-	(*deprecated_exec_file_display_hook) (filename);
     }
 
   /* Are are loading the same executable?  */
diff --git a/gdb/gdbcore.h b/gdb/gdbcore.h
index a88ae65e786..3b7eeba63aa 100644
--- a/gdb/gdbcore.h
+++ b/gdb/gdbcore.h
@@ -114,17 +114,12 @@ extern void write_memory_signed_integer (CORE_ADDR addr, int len,
 					 enum bfd_endian byte_order,
 					 LONGEST value);
 \f
-/* Hook for `exec_file_command' command to call.  */
-
-extern void (*deprecated_exec_file_display_hook) (const char *filename);
 
 /* Hook for "file_command", which is more useful than above
    (because it is invoked AFTER symbols are read, not before).  */
 
 extern void (*deprecated_file_changed_hook) (const char *filename);
 
-extern void specify_exec_file_hook (void (*hook) (const char *filename));
-
 /* Binary File Diddler for the core file.  */
 
 #define core_bfd (current_program_space->cbfd.get ())

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-19 22:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-19 22:23 [binutils-gdb] gdb: remove deprecated_exec_file_display_hook and associated code Andrew Burgess

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).