mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-03 13:23:00 +08:00
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.
This commit is contained in:
@ -174,7 +174,7 @@ program_space::free_all_objfiles ()
|
||||
/* See progspace.h. */
|
||||
|
||||
void
|
||||
program_space::add_objfile (std::shared_ptr<objfile> &&objfile,
|
||||
program_space::add_objfile (std::unique_ptr<objfile> &&objfile,
|
||||
struct objfile *before)
|
||||
{
|
||||
if (before == nullptr)
|
||||
@ -182,7 +182,7 @@ program_space::add_objfile (std::shared_ptr<objfile> &&objfile,
|
||||
else
|
||||
{
|
||||
auto iter = std::find_if (objfiles_list.begin (), objfiles_list.end (),
|
||||
[=] (const std::shared_ptr<::objfile> &objf)
|
||||
[=] (const std::unique_ptr<::objfile> &objf)
|
||||
{
|
||||
return objf.get () == before;
|
||||
});
|
||||
@ -203,7 +203,7 @@ program_space::remove_objfile (struct objfile *objfile)
|
||||
reinit_frame_cache ();
|
||||
|
||||
auto iter = std::find_if (objfiles_list.begin (), objfiles_list.end (),
|
||||
[=] (const std::shared_ptr<::objfile> &objf)
|
||||
[=] (const std::unique_ptr<::objfile> &objf)
|
||||
{
|
||||
return objf.get () == objfile;
|
||||
});
|
||||
|
Reference in New Issue
Block a user