* [review] Introduce program_space::remove_objfile
@ 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:50 ` 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/+/496
......................................................................
Introduce program_space::remove_objfile
This introduces a new method, program_space::remove_objfile, and
changes the objfile destructor not to unlink an objfile from the
program space's list.
This is cleaner because, like the previous patch, it treats the
program space more like a container for objfiles. Also, this makes it
possible to keep an objfile alive even though it has been unlinked
from the program space's list, which is important for processing in a
worker thread.
gdb/ChangeLog
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.
(objfile::unlink): Call remove_objfile.
(objfile): Don't call unlink_objfile.
Change-Id: I22f768827723dce21886fae9b3664532c8349e68
---
M gdb/ChangeLog
M gdb/objfiles.c
M gdb/progspace.c
M gdb/progspace.h
4 files changed, 36 insertions(+), 28 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9efaa24..d12cc21 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
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.
+ (objfile::unlink): Call remove_objfile.
+ (objfile): Don't call unlink_objfile.
+
+2019-11-03 Tom Tromey <tom@tromey.com>
+
* progspace.h (struct program_space) <add_objfile>: Declare
method.
* progspace.c (program_space::add_objfile): New method.
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index b4fb6f2..34f6a29 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -456,27 +456,6 @@
return *this;
}
-/* Unlink OBJFILE from the list of known objfiles. */
-
-static void
-unlink_objfile (struct objfile *objfile)
-{
- struct objfile **objpp;
-
- for (objpp = &object_files; *objpp != NULL; objpp = &((*objpp)->next))
- {
- if (*objpp == objfile)
- {
- *objpp = (*objpp)->next;
- objfile->next = NULL;
- return;
- }
- }
-
- internal_error (__FILE__, __LINE__,
- _("unlink_objfile: objfile already unlinked"));
-}
-
/* Add OBJFILE as a separate debug objfile of PARENT. */
static void
@@ -519,6 +498,7 @@
void
objfile::unlink ()
{
+ current_program_space->remove_objfile (this);
delete this;
}
@@ -609,13 +589,6 @@
else
delete per_bfd;
- /* Remove it from the chain of all objfiles. */
-
- unlink_objfile (this);
-
- if (this == symfile_objfile)
- symfile_objfile = NULL;
-
/* Before the symbol table code was redone to make it easier to
selectively load and remove information particular to a specific
linkage unit, gdb used to do these things whenever the monolithic
diff --git a/gdb/progspace.c b/gdb/progspace.c
index 5aa7a3d..e6c4f55 100644
--- a/gdb/progspace.c
+++ b/gdb/progspace.c
@@ -175,6 +175,31 @@
}
+/* See progspace.h. */
+
+void
+program_space::remove_objfile (struct objfile *objfile)
+{
+ struct objfile **objpp;
+
+ for (objpp = &object_files; *objpp != NULL; objpp = &((*objpp)->next))
+ {
+ if (*objpp == objfile)
+ {
+ *objpp = (*objpp)->next;
+ objfile->next = NULL;
+
+ if (objfile == symfile_object_file)
+ symfile_object_file = NULL;
+
+ return;
+ }
+ }
+
+ internal_error (__FILE__, __LINE__,
+ _("remove_objfile: objfile already unlinked"));
+}
+
/* 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 bb10c4b..e1fcc3c 100644
--- a/gdb/progspace.h
+++ b/gdb/progspace.h
@@ -170,6 +170,8 @@
list. */
void add_objfile (struct objfile *objfile, struct objfile *before);
+ /* Remove OBJFILE from the list of objfiles. */
+ void remove_objfile (struct objfile *objfile);
/* Pointer to next in linked list. */
struct program_space *next = NULL;
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I22f768827723dce21886fae9b3664532c8349e68
Gerrit-Change-Number: 496
Gerrit-PatchSet: 1
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newchange
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pushed] Introduce program_space::remove_objfile
2019-11-04 1:35 [review] Introduce program_space::remove_objfile Tom Tromey (Code Review)
@ 2019-12-12 23:50 ` Sourceware to Gerrit sync (Code Review)
2019-12-12 23:50 ` 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
Sourceware to Gerrit sync has submitted this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/496
......................................................................
Introduce program_space::remove_objfile
This introduces a new method, program_space::remove_objfile, and
changes the objfile destructor not to unlink an objfile from the
program space's list.
This is cleaner because, like the previous patch, it treats the
program space more like a container for objfiles. Also, this makes it
possible to keep an objfile alive even though it has been unlinked
from the program space's list, which is important for processing in a
worker thread.
gdb/ChangeLog
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.
(objfile::unlink): Call remove_objfile.
(objfile): Don't call unlink_objfile.
Change-Id: I22f768827723dce21886fae9b3664532c8349e68
---
M gdb/ChangeLog
M gdb/objfiles.c
M gdb/progspace.c
M gdb/progspace.h
4 files changed, 36 insertions(+), 28 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0163611..c6345c0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
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.
+ (objfile::unlink): Call remove_objfile.
+ (objfile): Don't call unlink_objfile.
+
+2019-12-12 Tom Tromey <tom@tromey.com>
+
* progspace.h (struct program_space) <add_objfile>: Declare
method.
* progspace.c (program_space::add_objfile): New method.
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index b4fb6f2..34f6a29 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -456,27 +456,6 @@
return *this;
}
-/* Unlink OBJFILE from the list of known objfiles. */
-
-static void
-unlink_objfile (struct objfile *objfile)
-{
- struct objfile **objpp;
-
- for (objpp = &object_files; *objpp != NULL; objpp = &((*objpp)->next))
- {
- if (*objpp == objfile)
- {
- *objpp = (*objpp)->next;
- objfile->next = NULL;
- return;
- }
- }
-
- internal_error (__FILE__, __LINE__,
- _("unlink_objfile: objfile already unlinked"));
-}
-
/* Add OBJFILE as a separate debug objfile of PARENT. */
static void
@@ -519,6 +498,7 @@
void
objfile::unlink ()
{
+ current_program_space->remove_objfile (this);
delete this;
}
@@ -609,13 +589,6 @@
else
delete per_bfd;
- /* Remove it from the chain of all objfiles. */
-
- unlink_objfile (this);
-
- if (this == symfile_objfile)
- symfile_objfile = NULL;
-
/* Before the symbol table code was redone to make it easier to
selectively load and remove information particular to a specific
linkage unit, gdb used to do these things whenever the monolithic
diff --git a/gdb/progspace.c b/gdb/progspace.c
index 5aa7a3d..e6c4f55 100644
--- a/gdb/progspace.c
+++ b/gdb/progspace.c
@@ -175,6 +175,31 @@
}
+/* See progspace.h. */
+
+void
+program_space::remove_objfile (struct objfile *objfile)
+{
+ struct objfile **objpp;
+
+ for (objpp = &object_files; *objpp != NULL; objpp = &((*objpp)->next))
+ {
+ if (*objpp == objfile)
+ {
+ *objpp = (*objpp)->next;
+ objfile->next = NULL;
+
+ if (objfile == symfile_object_file)
+ symfile_object_file = NULL;
+
+ return;
+ }
+ }
+
+ internal_error (__FILE__, __LINE__,
+ _("remove_objfile: objfile already unlinked"));
+}
+
/* 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 bb10c4b..e1fcc3c 100644
--- a/gdb/progspace.h
+++ b/gdb/progspace.h
@@ -170,6 +170,8 @@
list. */
void add_objfile (struct objfile *objfile, struct objfile *before);
+ /* Remove OBJFILE from the list of objfiles. */
+ void remove_objfile (struct objfile *objfile);
/* Pointer to next in linked list. */
struct program_space *next = NULL;
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I22f768827723dce21886fae9b3664532c8349e68
Gerrit-Change-Number: 496
Gerrit-PatchSet: 2
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: merged
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pushed] Introduce program_space::remove_objfile
2019-11-04 1:35 [review] Introduce program_space::remove_objfile Tom Tromey (Code Review)
2019-12-12 23:50 ` [pushed] " Sourceware to Gerrit sync (Code Review)
@ 2019-12-12 23:50 ` 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/+/496
......................................................................
Introduce program_space::remove_objfile
This introduces a new method, program_space::remove_objfile, and
changes the objfile destructor not to unlink an objfile from the
program space's list.
This is cleaner because, like the previous patch, it treats the
program space more like a container for objfiles. Also, this makes it
possible to keep an objfile alive even though it has been unlinked
from the program space's list, which is important for processing in a
worker thread.
gdb/ChangeLog
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.
(objfile::unlink): Call remove_objfile.
(objfile): Don't call unlink_objfile.
Change-Id: I22f768827723dce21886fae9b3664532c8349e68
---
M gdb/ChangeLog
M gdb/objfiles.c
M gdb/progspace.c
M gdb/progspace.h
4 files changed, 36 insertions(+), 28 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0163611..c6345c0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
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.
+ (objfile::unlink): Call remove_objfile.
+ (objfile): Don't call unlink_objfile.
+
+2019-12-12 Tom Tromey <tom@tromey.com>
+
* progspace.h (struct program_space) <add_objfile>: Declare
method.
* progspace.c (program_space::add_objfile): New method.
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index b4fb6f2..34f6a29 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -456,27 +456,6 @@
return *this;
}
-/* Unlink OBJFILE from the list of known objfiles. */
-
-static void
-unlink_objfile (struct objfile *objfile)
-{
- struct objfile **objpp;
-
- for (objpp = &object_files; *objpp != NULL; objpp = &((*objpp)->next))
- {
- if (*objpp == objfile)
- {
- *objpp = (*objpp)->next;
- objfile->next = NULL;
- return;
- }
- }
-
- internal_error (__FILE__, __LINE__,
- _("unlink_objfile: objfile already unlinked"));
-}
-
/* Add OBJFILE as a separate debug objfile of PARENT. */
static void
@@ -519,6 +498,7 @@
void
objfile::unlink ()
{
+ current_program_space->remove_objfile (this);
delete this;
}
@@ -609,13 +589,6 @@
else
delete per_bfd;
- /* Remove it from the chain of all objfiles. */
-
- unlink_objfile (this);
-
- if (this == symfile_objfile)
- symfile_objfile = NULL;
-
/* Before the symbol table code was redone to make it easier to
selectively load and remove information particular to a specific
linkage unit, gdb used to do these things whenever the monolithic
diff --git a/gdb/progspace.c b/gdb/progspace.c
index 5aa7a3d..e6c4f55 100644
--- a/gdb/progspace.c
+++ b/gdb/progspace.c
@@ -175,6 +175,31 @@
}
+/* See progspace.h. */
+
+void
+program_space::remove_objfile (struct objfile *objfile)
+{
+ struct objfile **objpp;
+
+ for (objpp = &object_files; *objpp != NULL; objpp = &((*objpp)->next))
+ {
+ if (*objpp == objfile)
+ {
+ *objpp = (*objpp)->next;
+ objfile->next = NULL;
+
+ if (objfile == symfile_object_file)
+ symfile_object_file = NULL;
+
+ return;
+ }
+ }
+
+ internal_error (__FILE__, __LINE__,
+ _("remove_objfile: objfile already unlinked"));
+}
+
/* 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 bb10c4b..e1fcc3c 100644
--- a/gdb/progspace.h
+++ b/gdb/progspace.h
@@ -170,6 +170,8 @@
list. */
void add_objfile (struct objfile *objfile, struct objfile *before);
+ /* Remove OBJFILE from the list of objfiles. */
+ void remove_objfile (struct objfile *objfile);
/* Pointer to next in linked list. */
struct program_space *next = NULL;
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I22f768827723dce21886fae9b3664532c8349e68
Gerrit-Change-Number: 496
Gerrit-PatchSet: 2
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newpatchset
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-12-12 23:50 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] Introduce program_space::remove_objfile Tom Tromey (Code Review)
2019-12-12 23:50 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-12-12 23:50 ` 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).