]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: remove unnecessary nullptr check in free_objfile observers
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 4 Oct 2023 02:20:22 +0000 (22:20 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Thu, 5 Oct 2023 17:20:50 +0000 (13:20 -0400)
The free_objfile observable is never called with a nullptr objfile.

Change-Id: I1e990edeb45bc38009ccb129c623911097ab65fe
Approved-By: Tom Tromey <tom@tromey.com>
gdb/breakpoint.c
gdb/printcmd.c
gdb/symfile.c

index f378edf865eaf8bf3b0dbe26e07f4d04c092c5ab..db7d2e6a8e53a723b52ae93456bfd7cde76ad4f3 100644 (file)
@@ -8065,9 +8065,6 @@ disable_breakpoints_in_unloaded_shlib (program_space *pspace, so_list *solib)
 static void
 disable_breakpoints_in_freed_objfile (struct objfile *objfile)
 {
-  if (objfile == NULL)
-    return;
-
   /* OBJF_SHARED|OBJF_USERLOADED objfiles are dynamic modules manually
      managed by the user with add-symbol-file/remove-symbol-file.
      Similarly to how breakpoints in shared libraries are handled in
index 7e5f062caec35f4766eae91e574de9d3408a3ebc..d29a57f89b559645f1617c76c61b6e10e108f231 100644 (file)
@@ -2355,12 +2355,7 @@ disable_display_command (const char *args, int from_tty)
 static void
 clear_dangling_display_expressions (struct objfile *objfile)
 {
-  struct program_space *pspace;
-
-  /* With no symbol file we cannot have a block or expression from it.  */
-  if (objfile == NULL)
-    return;
-  pspace = objfile->pspace;
+  program_space *pspace = objfile->pspace;
   if (objfile->separate_debug_objfile_backlink)
     {
       objfile = objfile->separate_debug_objfile_backlink;
index 0f720d42c417d50bb817f6b93ec0241db89632de..aca31e30d6ece78c91689b1b57ca2a2e5e3dd514 100644 (file)
@@ -3749,8 +3749,7 @@ static void
 symfile_free_objfile (struct objfile *objfile)
 {
   /* Remove the target sections owned by this objfile.  */
-  if (objfile != NULL)
-    current_program_space->remove_target_sections ((void *) objfile);
+  current_program_space->remove_target_sections (objfile);
 }
 
 /* Wrapper around the quick_symbol_functions expand_symtabs_matching "method".