aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-03-13 14:55:13 -0700
committerTom Tromey <tom@tromey.com>2022-04-12 09:31:16 -0600
commita2f0ab9310cb2ff235b436e0492fbaa804ce1bc9 (patch)
treecf4bf4dc825db218dd01ee0eb8481f81fdfb89e8 /gdb
parent696eef26e00a268a2e1346c9d3f1a4db968a6799 (diff)
downloadgdb-a2f0ab9310cb2ff235b436e0492fbaa804ce1bc9.zip
gdb-a2f0ab9310cb2ff235b436e0492fbaa804ce1bc9.tar.gz
gdb-a2f0ab9310cb2ff235b436e0492fbaa804ce1bc9.tar.bz2
Update skip_one_die for new abbrev properties
This updates skip_one_die to speed it up in the cases where either sibling_offset or size_if_constant are set.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/dwarf2/read.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 29e1f09..0c7a4de 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -8393,6 +8393,24 @@ skip_one_die (const struct die_reader_specs *reader, const gdb_byte *info_ptr,
const gdb_byte *buffer_end = reader->buffer_end;
unsigned int form, i;
+ if (do_skip_children && abbrev->sibling_offset != (unsigned short) -1)
+ {
+ /* We only handle DW_FORM_ref4 here. */
+ const gdb_byte *sibling_data = info_ptr + abbrev->sibling_offset;
+ unsigned int offset = read_4_bytes (abfd, sibling_data);
+ const gdb_byte *sibling_ptr = buffer + offset;
+ if (sibling_ptr >= info_ptr && sibling_ptr < reader->buffer_end)
+ return sibling_ptr;
+ /* Fall through to the slow way. */
+ }
+ else if (abbrev->size_if_constant != 0)
+ {
+ info_ptr += abbrev->size_if_constant;
+ if (do_skip_children && abbrev->has_children)
+ return skip_children (reader, info_ptr);
+ return info_ptr;
+ }
+
for (i = 0; i < abbrev->num_attrs; i++)
{
/* The only abbrev we care about is DW_AT_sibling. */