public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [review] Make add_separate_debug_objfile static
@ 2019-11-04  1:34 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:34 UTC (permalink / raw)
  To: gdb-patches

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

Make add_separate_debug_objfile static

This changes objfile::make to take a "parent" parameter, and makes
add_separate_debug_objfile static.

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

	* symfile.c (symbol_file_add_with_addrs): Pass "parent" to
	objfile::make.
	* objfiles.h (struct objjfile) <make>: No longer inline.
	(add_separate_debug_objfile): Don't declare.
	* objfiles.c (add_separate_debug_objfile): Now static.
	(objfile::make): Move from objfiles.h.  Call
	add_separate_debug_objfile.  Add "parent" parameter.

Change-Id: I631f43bb71738dea6ae0697317bf8ef4a0db4617
---
M gdb/ChangeLog
M gdb/objfiles.c
M gdb/objfiles.h
M gdb/symfile.c
4 files changed, 26 insertions(+), 11 deletions(-)



diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index bfb60c3..fbcc3de 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,15 @@
 2019-11-03  Tom Tromey  <tom@tromey.com>
 
+	* symfile.c (symbol_file_add_with_addrs): Pass "parent" to
+	objfile::make.
+	* objfiles.h (struct objjfile) <make>: No longer inline.
+	(add_separate_debug_objfile): Don't declare.
+	* objfiles.c (add_separate_debug_objfile): Now static.
+	(objfile::make): Move from objfiles.h.  Call
+	add_separate_debug_objfile.  Add "parent" parameter.
+
+2019-11-03  Tom Tromey  <tom@tromey.com>
+
 	* symfile.c (symbol_file_add_with_addrs): Use objfile::make.
 	* objfiles.h (struct objfile): Make constructor private.
 	<make>: New static method.
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index b5bc09f..0ee5720 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -520,7 +520,7 @@
 
 /* Add OBJFILE as a separate debug objfile of PARENT.  */
 
-void
+static void
 add_separate_debug_objfile (struct objfile *objfile, struct objfile *parent)
 {
   gdb_assert (objfile && parent);
@@ -541,6 +541,18 @@
   put_objfile_before (objfile, parent);
 }
 
+/* See objfiles.h.  */
+
+objfile *
+objfile::make (bfd *bfd_, const char *name_, objfile_flags flags_,
+	       objfile *parent)
+{
+  objfile *result = new objfile (bfd_, name_, flags_);
+  if (parent != nullptr)
+    add_separate_debug_objfile (result, parent);
+  return result;
+}
+
 /* Free all separate debug objfile of OBJFILE, but don't free OBJFILE
    itself.  */
 
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index eb47cad..f658a22 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -402,10 +402,8 @@
 public:
 
   /* Create an objfile.  */
-  static objfile *make (bfd *bfd_, const char *name_, objfile_flags flags_)
-  {
-    return new objfile (bfd_, name_, flags_);
-  }
+  static objfile *make (bfd *bfd_, const char *name_, objfile_flags flags_,
+			objfile *parent = nullptr);
 
   ~objfile ();
 
@@ -649,8 +647,6 @@
 
 extern void build_objfile_section_table (struct objfile *);
 
-extern void add_separate_debug_objfile (struct objfile *, struct objfile *);
-
 extern void free_objfile_separate_debug (struct objfile *);
 
 extern void free_all_objfiles (void);
diff --git a/gdb/symfile.c b/gdb/symfile.c
index b14f291..a5d8504 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1093,10 +1093,7 @@
 
   if (mainline)
     flags |= OBJF_MAINLINE;
-  objfile = objfile::make (abfd, name, flags);
-
-  if (parent)
-    add_separate_debug_objfile (objfile, parent);
+  objfile = objfile::make (abfd, name, flags, parent);
 
   /* We either created a new mapped symbol table, mapped an existing
      symbol table file which has not had initial symbol reading

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

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

* [pushed] Make add_separate_debug_objfile static
  2019-11-04  1:34 [review] Make add_separate_debug_objfile static 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/+/493
......................................................................

Make add_separate_debug_objfile static

This changes objfile::make to take a "parent" parameter, and makes
add_separate_debug_objfile static.

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

	* symfile.c (symbol_file_add_with_addrs): Pass "parent" to
	objfile::make.
	* objfiles.h (struct objjfile) <make>: No longer inline.
	(add_separate_debug_objfile): Don't declare.
	* objfiles.c (add_separate_debug_objfile): Now static.
	(objfile::make): Move from objfiles.h.  Call
	add_separate_debug_objfile.  Add "parent" parameter.

Change-Id: I631f43bb71738dea6ae0697317bf8ef4a0db4617
---
M gdb/ChangeLog
M gdb/objfiles.c
M gdb/objfiles.h
M gdb/symfile.c
4 files changed, 26 insertions(+), 11 deletions(-)



diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 393d43e..7bcd2c7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,15 @@
 2019-12-12  Tom Tromey  <tom@tromey.com>
 
+	* symfile.c (symbol_file_add_with_addrs): Pass "parent" to
+	objfile::make.
+	* objfiles.h (struct objjfile) <make>: No longer inline.
+	(add_separate_debug_objfile): Don't declare.
+	* objfiles.c (add_separate_debug_objfile): Now static.
+	(objfile::make): Move from objfiles.h.  Call
+	add_separate_debug_objfile.  Add "parent" parameter.
+
+2019-12-12  Tom Tromey  <tom@tromey.com>
+
 	* symfile.c (symbol_file_add_with_addrs): Use objfile::make.
 	* objfiles.h (struct objfile): Make constructor private.
 	<make>: New static method.
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index b5bc09f..0ee5720 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -520,7 +520,7 @@
 
 /* Add OBJFILE as a separate debug objfile of PARENT.  */
 
-void
+static void
 add_separate_debug_objfile (struct objfile *objfile, struct objfile *parent)
 {
   gdb_assert (objfile && parent);
@@ -541,6 +541,18 @@
   put_objfile_before (objfile, parent);
 }
 
+/* See objfiles.h.  */
+
+objfile *
+objfile::make (bfd *bfd_, const char *name_, objfile_flags flags_,
+	       objfile *parent)
+{
+  objfile *result = new objfile (bfd_, name_, flags_);
+  if (parent != nullptr)
+    add_separate_debug_objfile (result, parent);
+  return result;
+}
+
 /* Free all separate debug objfile of OBJFILE, but don't free OBJFILE
    itself.  */
 
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index b5c04eb..663e639 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -402,10 +402,8 @@
 public:
 
   /* Create an objfile.  */
-  static objfile *make (bfd *bfd_, const char *name_, objfile_flags flags_)
-  {
-    return new objfile (bfd_, name_, flags_);
-  }
+  static objfile *make (bfd *bfd_, const char *name_, objfile_flags flags_,
+			objfile *parent = nullptr);
 
   ~objfile ();
 
@@ -649,8 +647,6 @@
 
 extern void build_objfile_section_table (struct objfile *);
 
-extern void add_separate_debug_objfile (struct objfile *, struct objfile *);
-
 extern void free_objfile_separate_debug (struct objfile *);
 
 extern void free_all_objfiles (void);
diff --git a/gdb/symfile.c b/gdb/symfile.c
index eef27a8..8e3cf7f 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1093,10 +1093,7 @@
 
   if (mainline)
     flags |= OBJF_MAINLINE;
-  objfile = objfile::make (abfd, name, flags);
-
-  if (parent)
-    add_separate_debug_objfile (objfile, parent);
+  objfile = objfile::make (abfd, name, flags, parent);
 
   /* We either created a new mapped symbol table, mapped an existing
      symbol table file which has not had initial symbol reading

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

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

* [pushed] Make add_separate_debug_objfile static
  2019-11-04  1:34 [review] Make add_separate_debug_objfile static 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/+/493
......................................................................

Make add_separate_debug_objfile static

This changes objfile::make to take a "parent" parameter, and makes
add_separate_debug_objfile static.

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

	* symfile.c (symbol_file_add_with_addrs): Pass "parent" to
	objfile::make.
	* objfiles.h (struct objjfile) <make>: No longer inline.
	(add_separate_debug_objfile): Don't declare.
	* objfiles.c (add_separate_debug_objfile): Now static.
	(objfile::make): Move from objfiles.h.  Call
	add_separate_debug_objfile.  Add "parent" parameter.

Change-Id: I631f43bb71738dea6ae0697317bf8ef4a0db4617
---
M gdb/ChangeLog
M gdb/objfiles.c
M gdb/objfiles.h
M gdb/symfile.c
4 files changed, 26 insertions(+), 11 deletions(-)


diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 393d43e..7bcd2c7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,15 @@
 2019-12-12  Tom Tromey  <tom@tromey.com>
 
+	* symfile.c (symbol_file_add_with_addrs): Pass "parent" to
+	objfile::make.
+	* objfiles.h (struct objjfile) <make>: No longer inline.
+	(add_separate_debug_objfile): Don't declare.
+	* objfiles.c (add_separate_debug_objfile): Now static.
+	(objfile::make): Move from objfiles.h.  Call
+	add_separate_debug_objfile.  Add "parent" parameter.
+
+2019-12-12  Tom Tromey  <tom@tromey.com>
+
 	* symfile.c (symbol_file_add_with_addrs): Use objfile::make.
 	* objfiles.h (struct objfile): Make constructor private.
 	<make>: New static method.
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index b5bc09f..0ee5720 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -520,7 +520,7 @@
 
 /* Add OBJFILE as a separate debug objfile of PARENT.  */
 
-void
+static void
 add_separate_debug_objfile (struct objfile *objfile, struct objfile *parent)
 {
   gdb_assert (objfile && parent);
@@ -541,6 +541,18 @@
   put_objfile_before (objfile, parent);
 }
 
+/* See objfiles.h.  */
+
+objfile *
+objfile::make (bfd *bfd_, const char *name_, objfile_flags flags_,
+	       objfile *parent)
+{
+  objfile *result = new objfile (bfd_, name_, flags_);
+  if (parent != nullptr)
+    add_separate_debug_objfile (result, parent);
+  return result;
+}
+
 /* Free all separate debug objfile of OBJFILE, but don't free OBJFILE
    itself.  */
 
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index b5c04eb..663e639 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -402,10 +402,8 @@
 public:
 
   /* Create an objfile.  */
-  static objfile *make (bfd *bfd_, const char *name_, objfile_flags flags_)
-  {
-    return new objfile (bfd_, name_, flags_);
-  }
+  static objfile *make (bfd *bfd_, const char *name_, objfile_flags flags_,
+			objfile *parent = nullptr);
 
   ~objfile ();
 
@@ -649,8 +647,6 @@
 
 extern void build_objfile_section_table (struct objfile *);
 
-extern void add_separate_debug_objfile (struct objfile *, struct objfile *);
-
 extern void free_objfile_separate_debug (struct objfile *);
 
 extern void free_all_objfiles (void);
diff --git a/gdb/symfile.c b/gdb/symfile.c
index eef27a8..8e3cf7f 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1093,10 +1093,7 @@
 
   if (mainline)
     flags |= OBJF_MAINLINE;
-  objfile = objfile::make (abfd, name, flags);
-
-  if (parent)
-    add_separate_debug_objfile (objfile, parent);
+  objfile = objfile::make (abfd, name, flags, parent);
 
   /* We either created a new mapped symbol table, mapped an existing
      symbol table file which has not had initial symbol reading

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I631f43bb71738dea6ae0697317bf8ef4a0db4617
Gerrit-Change-Number: 493
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:34 [review] Make add_separate_debug_objfile static 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).