public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [review] Remove MULTI_OBJFILE_P
@ 2019-11-04  1:35 Tom Tromey (Code Review)
  2019-12-12 23:50 ` [pushed] " Sourceware to Gerrit sync (Code Review)
  2019-12-12 23:56 ` Sourceware to Gerrit sync (Code Review)
  0 siblings, 2 replies; 3+ messages in thread
From: Tom Tromey (Code Review) @ 2019-11-04  1:35 UTC (permalink / raw)
  To: gdb-patches

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

Remove MULTI_OBJFILE_P

This removes the MULTI_OBJFILE_P macro in favor of a method on the
program space.

gdb/ChangeLog
2019-11-03  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
---
M gdb/ChangeLog
M gdb/maint.c
M gdb/objfiles.h
M gdb/printcmd.c
M gdb/progspace.c
M gdb/progspace.h
6 files changed, 24 insertions(+), 6 deletions(-)



diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d12cc21..94bbb25 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,14 @@
 2019-11-03  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-11-03  Tom Tromey  <tom@tromey.com>
+
 	* progspace.h (struct program_space) <remove_objfile>: Declare.
 	* progspace.c (program_space::remove_objfile): New method.
 	* objfiles.c (unlink_objfile): Remove.
diff --git a/gdb/maint.c b/gdb/maint.c
index ec9f4ab..9101d73 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -585,7 +585,7 @@
 	  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);
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index bd7077e..68df50d 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -773,10 +773,6 @@
    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);
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 27aaf7a..e018528 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1365,7 +1365,7 @@
 	    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 "
diff --git a/gdb/progspace.c b/gdb/progspace.c
index e6c4f55..a39b34c 100644
--- a/gdb/progspace.c
+++ b/gdb/progspace.c
@@ -200,6 +200,14 @@
 		  _("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.  */
 
diff --git a/gdb/progspace.h b/gdb/progspace.h
index e1fcc3c..86bc22a 100644
--- a/gdb/progspace.h
+++ b/gdb/progspace.h
@@ -173,6 +173,11 @@
   /* 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;
 

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I2779e26ea8909078d63fea8f13bce94cab73948c
Gerrit-Change-Number: 497
Gerrit-PatchSet: 1
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newchange

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pushed] Remove MULTI_OBJFILE_P
  2019-11-04  1:35 [review] Remove MULTI_OBJFILE_P Tom Tromey (Code Review)
@ 2019-12-12 23:50 ` Sourceware to Gerrit sync (Code Review)
  2019-12-12 23:56 ` Sourceware to Gerrit sync (Code Review)
  1 sibling, 0 replies; 3+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2019-12-12 23:50 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

The original change was created by Tom Tromey.

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

Remove MULTI_OBJFILE_P

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
---
M gdb/ChangeLog
M gdb/maint.c
M gdb/objfiles.h
M gdb/printcmd.c
M gdb/progspace.c
M gdb/progspace.h
6 files changed, 24 insertions(+), 6 deletions(-)



diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c6345c0..26f764e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,14 @@
 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.
 	* progspace.c (program_space::remove_objfile): New method.
 	* objfiles.c (unlink_objfile): Remove.
diff --git a/gdb/maint.c b/gdb/maint.c
index dbc949a..f71cb80 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -589,7 +589,7 @@
 	  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);
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index 49b4627..0656cfe 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -773,10 +773,6 @@
    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);
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 480e7f2..77cdd77 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1367,7 +1367,7 @@
 	    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 "
diff --git a/gdb/progspace.c b/gdb/progspace.c
index e6c4f55..a39b34c 100644
--- a/gdb/progspace.c
+++ b/gdb/progspace.c
@@ -200,6 +200,14 @@
 		  _("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.  */
 
diff --git a/gdb/progspace.h b/gdb/progspace.h
index e1fcc3c..86bc22a 100644
--- a/gdb/progspace.h
+++ b/gdb/progspace.h
@@ -173,6 +173,11 @@
   /* 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;
 

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I2779e26ea8909078d63fea8f13bce94cab73948c
Gerrit-Change-Number: 497
Gerrit-PatchSet: 2
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newpatchset

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pushed] Remove MULTI_OBJFILE_P
  2019-11-04  1:35 [review] Remove MULTI_OBJFILE_P Tom Tromey (Code Review)
  2019-12-12 23:50 ` [pushed] " Sourceware to Gerrit sync (Code Review)
@ 2019-12-12 23:56 ` Sourceware to Gerrit sync (Code Review)
  1 sibling, 0 replies; 3+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2019-12-12 23:56 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

Sourceware to Gerrit sync has submitted this change.

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

Remove MULTI_OBJFILE_P

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
---
M gdb/ChangeLog
M gdb/maint.c
M gdb/objfiles.h
M gdb/printcmd.c
M gdb/progspace.c
M gdb/progspace.h
6 files changed, 24 insertions(+), 6 deletions(-)


diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c6345c0..26f764e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,14 @@
 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.
 	* progspace.c (program_space::remove_objfile): New method.
 	* objfiles.c (unlink_objfile): Remove.
diff --git a/gdb/maint.c b/gdb/maint.c
index dbc949a..f71cb80 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -589,7 +589,7 @@
 	  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);
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index 49b4627..0656cfe 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -773,10 +773,6 @@
    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);
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 480e7f2..77cdd77 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1367,7 +1367,7 @@
 	    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 "
diff --git a/gdb/progspace.c b/gdb/progspace.c
index e6c4f55..a39b34c 100644
--- a/gdb/progspace.c
+++ b/gdb/progspace.c
@@ -200,6 +200,14 @@
 		  _("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.  */
 
diff --git a/gdb/progspace.h b/gdb/progspace.h
index e1fcc3c..86bc22a 100644
--- a/gdb/progspace.h
+++ b/gdb/progspace.h
@@ -173,6 +173,11 @@
   /* 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;
 

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I2779e26ea8909078d63fea8f13bce94cab73948c
Gerrit-Change-Number: 497
Gerrit-PatchSet: 2
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: merged

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-12-12 23:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-04  1:35 [review] Remove MULTI_OBJFILE_P Tom Tromey (Code Review)
2019-12-12 23:50 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-12-12 23:56 ` Sourceware to Gerrit sync (Code Review)

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).