diff options
author | Tom Tromey <tom@tromey.com> | 2022-05-21 09:50:13 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2022-05-31 14:46:11 -0600 |
commit | e2904e1ff0b0158cf6d8d335ca3f80ff7dc9eb6c (patch) | |
tree | a964217ffa81df1df4ec9236cb0a3696bf2ff3e4 /gdb/progspace.h | |
parent | ebad7c66133526eb9ea9b21dad2df49a65200df0 (diff) | |
download | gdb-e2904e1ff0b0158cf6d8d335ca3f80ff7dc9eb6c.zip gdb-e2904e1ff0b0158cf6d8d335ca3f80ff7dc9eb6c.tar.gz gdb-e2904e1ff0b0158cf6d8d335ca3f80ff7dc9eb6c.tar.bz2 |
Use unique_ptr for objfiles
A while back, I changed objfiles to be held via a shared_ptr. The
idea at the time was that this was a step toward writing to the index
cache in the background, and this would let gdb keep a reference alive
to do so. However, since then we've rewritten the DWARF reader, and
the new index can do this without requiring a shared pointer -- in
fact there are patches pending to implement this.
This patch switches objfile management to unique_ptr, which makes more
sense now.
Regression tested on x86-64 Fedora 34.
Diffstat (limited to 'gdb/progspace.h')
-rw-r--r-- | gdb/progspace.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gdb/progspace.h b/gdb/progspace.h index 73beb7a..662e569 100644 --- a/gdb/progspace.h +++ b/gdb/progspace.h @@ -41,9 +41,9 @@ struct program_space_data; struct address_space_data; struct so_list; -typedef std::list<std::shared_ptr<objfile>> objfile_list; +typedef std::list<std::unique_ptr<objfile>> objfile_list; -/* An iterator that wraps an iterator over std::shared_ptr<objfile>, +/* An iterator that wraps an iterator over std::unique_ptr<objfile>, and dereferences the returned object. This is useful for iterating over a list of shared pointers and returning raw pointers -- which helped avoid touching a lot of code when changing how objfiles are @@ -234,7 +234,7 @@ struct program_space /* 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 (std::shared_ptr<objfile> &&objfile, + void add_objfile (std::unique_ptr<objfile> &&objfile, struct objfile *before); /* Remove OBJFILE from the list of objfiles. */ @@ -354,7 +354,7 @@ struct program_space struct objfile *symfile_object_file = NULL; /* All known objfiles are kept in a linked list. */ - std::list<std::shared_ptr<objfile>> objfiles_list; + std::list<std::unique_ptr<objfile>> objfiles_list; /* List of shared objects mapped into this space. Managed by solib.c. */ |