Remove MULTI_OBJFILE_P
authorTom Tromey <tom@tromey.com>
Sun, 20 Jan 2019 04:33:50 +0000 (21:33 -0700)
committerTom Tromey <tom@tromey.com>
Thu, 12 Dec 2019 22:50:53 +0000 (15:50 -0700)
This removes the MULTI_OBJFILE_P macro in favor of a method on the
program space.

gdb/ChangeLog
2019-12-12  Tom Tromey  <tom@tromey.com>

* progspace.c (program_space::multi_objfile_p): New method.
* printcmd.c (info_symbol_command): Update.
* maint.c (maintenance_translate_address): Update.
* objfiles.h (MULTI_OBJFILE_P): Remove.
* progspace.h (struct program_space) <multi_objfile_p>: New
method.

Change-Id: I2779e26ea8909078d63fea8f13bce94cab73948c

gdb/ChangeLog
gdb/maint.c
gdb/objfiles.h
gdb/printcmd.c
gdb/progspace.c
gdb/progspace.h

index c6345c0d63fcafb5accee1087ce726571787417d..26f764e174b0b7a506d64fa7892e709e39519c25 100644 (file)
@@ -1,3 +1,12 @@
+2019-12-12  Tom Tromey  <tom@tromey.com>
+
+       * progspace.c (program_space::multi_objfile_p): New method.
+       * printcmd.c (info_symbol_command): Update.
+       * maint.c (maintenance_translate_address): Update.
+       * objfiles.h (MULTI_OBJFILE_P): Remove.
+       * progspace.h (struct program_space) <multi_objfile_p>: New
+       method.
+
 2019-12-12  Tom Tromey  <tom@tromey.com>
 
        * progspace.h (struct program_space) <remove_objfile>: Declare.
index dbc949a61c0a69d7b0c7c5925942f6b3583d97f3..f71cb80cec688dcb99598e5ed2fcb5c471a41a0d 100644 (file)
@@ -589,7 +589,7 @@ maintenance_translate_address (const char *arg, int from_tty)
          gdb_assert (sect->objfile && objfile_name (sect->objfile));
          obj_name = objfile_name (sect->objfile);
 
-         if (MULTI_OBJFILE_P ())
+         if (current_program_space->multi_objfile_p ())
            printf_filtered (_("%s + %s in section %s of %s\n"),
                             symbol_name, symbol_offset,
                             section_name, obj_name);
index 49b4627d67cc5e27370d24cbcc86fc369e15cae6..0656cfe4a12f1f6e0280b804a49573e18c48c41c 100644 (file)
@@ -773,10 +773,6 @@ extern void default_iterate_over_objfiles_in_search_order
    uninitialized section index.  */
 #define SECT_OFF_BSS(objfile) (objfile)->sect_index_bss
 
-/* Answer whether there is more than one object file loaded.  */
-
-#define MULTI_OBJFILE_P() (object_files && object_files->next)
-
 /* Reset the per-BFD storage area on OBJ.  */
 
 void set_objfile_per_bfd (struct objfile *obj);
index 480e7f22390e54c3295442f336297a6f1259b984..77cdd77a16115e7bce27deec51ffab0d9ea10759 100644 (file)
@@ -1367,7 +1367,7 @@ info_symbol_command (const char *arg, int from_tty)
            gdb_assert (osect->objfile && objfile_name (osect->objfile));
            obj_name = objfile_name (osect->objfile);
 
-           if (MULTI_OBJFILE_P ())
+           if (current_program_space->multi_objfile_p ())
              if (pc_in_unmapped_range (addr, osect))
                if (section_is_overlay (osect))
                  printf_filtered (_("%s in load address range of "
index e6c4f55c4e8b1c39dda555ff7a019d3ec84f4a89..a39b34c923394863b42a01b8bb25fa9383969d02 100644 (file)
@@ -200,6 +200,14 @@ program_space::remove_objfile (struct objfile *objfile)
                  _("remove_objfile: objfile already unlinked"));
 }
 
+/* See progspace.h.  */
+
+bool
+program_space::multi_objfile_p () const
+{
+  return objfiles_head != nullptr && objfiles_head->next != nullptr;
+}
+
 /* Copies program space SRC to DEST.  Copies the main executable file,
    and the main symbol file.  Returns DEST.  */
 
index e1fcc3c68d2e00932aaa68bee77f8fc080db2271..86bc22acc22c61ae0cd7df69debc7065b3282a5b 100644 (file)
@@ -173,6 +173,11 @@ struct program_space
   /* Remove OBJFILE from the list of objfiles.  */
   void remove_objfile (struct objfile *objfile);
 
+  /* Return true if there is more than one object file loaded; false
+     otherwise.  */
+  bool multi_objfile_p () const;
+
+
   /* Pointer to next in linked list.  */
   struct program_space *next = NULL;
 
This page took 0.035445 seconds and 4 git commands to generate.