aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2025-01-17 12:01:38 -0700
committerTom Tromey <tromey@adacore.com>2025-01-17 12:59:31 -0700
commitd8c4a58b59eedbe1f77717d4e0537579232e6a10 (patch)
treeae018c05372c9c376942c6cbe82482a2229a5e6a
parent69c9ec4dc1371a40b1a725167999b749ecf6dbfc (diff)
downloadbinutils-d8c4a58b59eedbe1f77717d4e0537579232e6a10.zip
binutils-d8c4a58b59eedbe1f77717d4e0537579232e6a10.tar.gz
binutils-d8c4a58b59eedbe1f77717d4e0537579232e6a10.tar.bz2
Simplify get_frame_unwind_table
This simplifies get_frame_unwind_table, changing it to use the registry 'emplace' method and to pass the initialization iterators to the constructor. This fixes a build problem on x86 -- reported by the auto-builder -- as a side effect. Tested-By: Guinevere Larsen <guinevere@redhat.com>
-rw-r--r--gdb/frame-unwind.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c
index fab9b3c..33b23f9 100644
--- a/gdb/frame-unwind.c
+++ b/gdb/frame-unwind.c
@@ -73,15 +73,10 @@ static std::vector<const frame_unwind *> &
get_frame_unwind_table (struct gdbarch *gdbarch)
{
std::vector<const frame_unwind *> *table = frame_unwind_data.get (gdbarch);
- if (table != nullptr)
- return *table;
-
- table = new std::vector<const frame_unwind *>;
- table->insert (table->begin (), standard_unwinders.begin (),
- standard_unwinders.end ());
-
- frame_unwind_data.set (gdbarch, table);
-
+ if (table == nullptr)
+ table = frame_unwind_data.emplace (gdbarch,
+ standard_unwinders.begin (),
+ standard_unwinders.end ());
return *table;
}