aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-06-20 10:22:01 -0600
committerTom Tromey <tom@tromey.com>2022-04-12 09:31:15 -0600
commit073954a792b3911f07b1dd22a8e0ffcc89ed3080 (patch)
tree92559c4f0f3565d9ef4686644428e88b79e94620 /gdb/dwarf2
parent5c94f93871a094ab4bce2f3c49ccdc8ae322e277 (diff)
downloadgdb-073954a792b3911f07b1dd22a8e0ffcc89ed3080.zip
gdb-073954a792b3911f07b1dd22a8e0ffcc89ed3080.tar.gz
gdb-073954a792b3911f07b1dd22a8e0ffcc89ed3080.tar.bz2
Let skip_one_die not skip children
This patch adds an option to skip_one_die that causes it not to skip child DIEs. This is needed in the new scanner.
Diffstat (limited to 'gdb/dwarf2')
-rw-r--r--gdb/dwarf2/read.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 2ec4a49..af9602d 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -1442,7 +1442,8 @@ static void dwarf2_symbol_mark_computed (const struct attribute *attr,
static const gdb_byte *skip_one_die (const struct die_reader_specs *reader,
const gdb_byte *info_ptr,
- const struct abbrev_info *abbrev);
+ const struct abbrev_info *abbrev,
+ bool do_skip_children = true);
static hashval_t partial_die_hash (const void *item);
@@ -8337,12 +8338,15 @@ skip_children (const struct die_reader_specs *reader, const gdb_byte *info_ptr)
/* Scan the debug information for CU starting at INFO_PTR in buffer BUFFER.
INFO_PTR should point just after the initial uleb128 of a DIE, and the
abbrev corresponding to that skipped uleb128 should be passed in
- ABBREV. Returns a pointer to this DIE's sibling, skipping any
- children. */
+ ABBREV.
+
+ If DO_SKIP_CHILDREN is true, or if the DIE has no children, this
+ returns a pointer to this DIE's sibling, skipping any children.
+ Otherwise, returns a pointer to the DIE's first child. */
static const gdb_byte *
skip_one_die (const struct die_reader_specs *reader, const gdb_byte *info_ptr,
- const struct abbrev_info *abbrev)
+ const struct abbrev_info *abbrev, bool do_skip_children)
{
unsigned int bytes_read;
struct attribute attr;
@@ -8355,7 +8359,7 @@ skip_one_die (const struct die_reader_specs *reader, const gdb_byte *info_ptr,
for (i = 0; i < abbrev->num_attrs; i++)
{
/* The only abbrev we care about is DW_AT_sibling. */
- if (abbrev->attrs[i].name == DW_AT_sibling)
+ if (do_skip_children && abbrev->attrs[i].name == DW_AT_sibling)
{
read_attribute (reader, &attr, &abbrev->attrs[i], info_ptr);
if (attr.form == DW_FORM_ref_addr)
@@ -8472,7 +8476,7 @@ skip_one_die (const struct die_reader_specs *reader, const gdb_byte *info_ptr,
}
}
- if (abbrev->has_children)
+ if (do_skip_children && abbrev->has_children)
return skip_children (reader, info_ptr);
else
return info_ptr;