diff options
author | Tom Tromey <tom@tromey.com> | 2019-11-01 16:31:28 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2019-12-12 15:50:52 -0700 |
commit | 7cac64af7bc6a7f7a86f90a1465f7c3d2b6f07e8 (patch) | |
tree | 0ecbee9d6d1b2c03b4a49bc551ae11ade6b1c1b0 /gdb/progspace.h | |
parent | 268e4f09144c48e02f01d82ab3aab359457df214 (diff) | |
download | gdb-7cac64af7bc6a7f7a86f90a1465f7c3d2b6f07e8.zip gdb-7cac64af7bc6a7f7a86f90a1465f7c3d2b6f07e8.tar.gz gdb-7cac64af7bc6a7f7a86f90a1465f7c3d2b6f07e8.tar.bz2 |
Introduce program_space::add_objfile
This introduces a new method, program_space::add_objfile, that adds an
objfile to the program space's list of objfiles. It also changes the
obfile's constructor so that linking an objfile into this list is not
done here.
The former is an improvement because it makes more sense to treat the
program space as a container holding objfiles -- so manipulation of
the list belongs there.
The latter is not strictly needed, but seemed better both because it
is removing a global side effect from a constructor, and for symmetry
reasons, as a subsequent patch will remove unlinking from the
destructor.
gdb/ChangeLog
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.
* objfiles.c (~objfile): Don't unlink objfile.
(put_objfile_before): Remove.
(add_separate_debug_objfile): Don't call put_objfile_before.
(objfile::make): Call add_objfile. Set new_objfiles_available on
the per-program-space data.
Change-Id: I93e8525dda631cb89dcc2046a5c51c7c9f34ccfd
Diffstat (limited to 'gdb/progspace.h')
-rw-r--r-- | gdb/progspace.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/progspace.h b/gdb/progspace.h index c281648..bb10c4b 100644 --- a/gdb/progspace.h +++ b/gdb/progspace.h @@ -165,6 +165,12 @@ struct program_space return objfiles_safe_range (objfiles_head); } + /* Add OBJFILE to the list of objfiles, putting it just before + BEFORE. If BEFORE is nullptr, it will go at the end of the + list. */ + void add_objfile (struct objfile *objfile, struct objfile *before); + + /* Pointer to next in linked list. */ struct program_space *next = NULL; |