summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-02-12 15:45:08 -0700
committerTom Tromey <tom@tromey.com>2020-02-12 15:51:58 -0700
commit4debb2379696829391bfb519ed9a5f415d6e190a (patch)
treecf0fdf38f3b0eb6d2db30921aa57409aef133bb3
parent0d404d447ae34e31bdf58ba09c5d3254db3766e1 (diff)
downloadbinutils-gdb-4debb2379696829391bfb519ed9a5f415d6e190a.tar.gz
Remove a use of the comp_unit backlink
The DWARF frame comp_unit object still has a backlink to the objfile. In order to be truly objfile-independent, this must be removed. This patch removes one such use, by passing the gdbarch to decode_frame_entry directly. gdb/ChangeLog 2020-02-12 Tom Tromey <tom@tromey.com> * dwarf2/frame.c (decode_frame_entry_1): Add gdbarch parameter. (decode_frame_entry): Likewise. (dwarf2_build_frame_info): Update.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/dwarf2/frame.c22
2 files changed, 20 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5b705632af3..9bc686b293f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2020-02-12 Tom Tromey <tom@tromey.com>
+ * dwarf2/frame.c (decode_frame_entry_1): Add gdbarch parameter.
+ (decode_frame_entry): Likewise.
+ (dwarf2_build_frame_info): Update.
+
+2020-02-12 Tom Tromey <tom@tromey.com>
+
* dwarf2/frame.c (struct comp_unit) <obstack>: New member.
(decode_frame_entry_1): Use the comp_unit obstack.
diff --git a/gdb/dwarf2/frame.c b/gdb/dwarf2/frame.c
index 53f90799819..7397a7fbeb2 100644
--- a/gdb/dwarf2/frame.c
+++ b/gdb/dwarf2/frame.c
@@ -1701,7 +1701,8 @@ enum eh_frame_type
EH_CIE_OR_FDE_TYPE_ID = EH_CIE_TYPE_ID | EH_FDE_TYPE_ID
};
-static const gdb_byte *decode_frame_entry (struct comp_unit *unit,
+static const gdb_byte *decode_frame_entry (struct gdbarch *gdbarch,
+ struct comp_unit *unit,
const gdb_byte *start,
int eh_frame_p,
dwarf2_cie_table &cie_table,
@@ -1712,13 +1713,13 @@ static const gdb_byte *decode_frame_entry (struct comp_unit *unit,
Return NULL if invalid input, otherwise the next byte to be processed. */
static const gdb_byte *
-decode_frame_entry_1 (struct comp_unit *unit, const gdb_byte *start,
+decode_frame_entry_1 (struct gdbarch *gdbarch,
+ struct comp_unit *unit, const gdb_byte *start,
int eh_frame_p,
dwarf2_cie_table &cie_table,
dwarf2_fde_table *fde_table,
enum eh_frame_type entry_type)
{
- struct gdbarch *gdbarch = get_objfile_arch (unit->objfile);
const gdb_byte *buf, *end;
ULONGEST length;
unsigned int bytes_read;
@@ -1963,7 +1964,8 @@ decode_frame_entry_1 (struct comp_unit *unit, const gdb_byte *start,
fde->cie = find_cie (cie_table, cie_pointer);
if (fde->cie == NULL)
{
- decode_frame_entry (unit, unit->dwarf_frame_buffer + cie_pointer,
+ decode_frame_entry (gdbarch, unit,
+ unit->dwarf_frame_buffer + cie_pointer,
eh_frame_p, cie_table, fde_table,
EH_CIE_TYPE_ID);
fde->cie = find_cie (cie_table, cie_pointer);
@@ -2014,7 +2016,8 @@ decode_frame_entry_1 (struct comp_unit *unit, const gdb_byte *start,
expect an FDE or a CIE. */
static const gdb_byte *
-decode_frame_entry (struct comp_unit *unit, const gdb_byte *start,
+decode_frame_entry (struct gdbarch *gdbarch,
+ struct comp_unit *unit, const gdb_byte *start,
int eh_frame_p,
dwarf2_cie_table &cie_table,
dwarf2_fde_table *fde_table,
@@ -2026,7 +2029,7 @@ decode_frame_entry (struct comp_unit *unit, const gdb_byte *start,
while (1)
{
- ret = decode_frame_entry_1 (unit, start, eh_frame_p,
+ ret = decode_frame_entry_1 (gdbarch, unit, start, eh_frame_p,
cie_table, fde_table, entry_type);
if (ret != NULL)
break;
@@ -2132,6 +2135,8 @@ dwarf2_build_frame_info (struct objfile *objfile)
dwarf2_cie_table cie_table;
dwarf2_fde_table fde_table;
+ struct gdbarch *gdbarch = get_objfile_arch (objfile);
+
/* Build a minimal decoding of the DWARF2 compilation unit. */
std::unique_ptr<comp_unit> unit (new comp_unit (objfile));
@@ -2165,7 +2170,8 @@ dwarf2_build_frame_info (struct objfile *objfile)
{
frame_ptr = unit->dwarf_frame_buffer;
while (frame_ptr < unit->dwarf_frame_buffer + unit->dwarf_frame_size)
- frame_ptr = decode_frame_entry (unit.get (), frame_ptr, 1,
+ frame_ptr = decode_frame_entry (gdbarch, unit.get (),
+ frame_ptr, 1,
cie_table, &fde_table,
EH_CIE_OR_FDE_TYPE_ID);
}
@@ -2195,7 +2201,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
{
frame_ptr = unit->dwarf_frame_buffer;
while (frame_ptr < unit->dwarf_frame_buffer + unit->dwarf_frame_size)
- frame_ptr = decode_frame_entry (unit.get (), frame_ptr, 0,
+ frame_ptr = decode_frame_entry (gdbarch, unit.get (), frame_ptr, 0,
cie_table, &fde_table,
EH_CIE_OR_FDE_TYPE_ID);
}