From: Tom Tromey Date: Sat, 13 Mar 2021 21:55:13 +0000 (-0700) Subject: Update skip_one_die for new abbrev properties X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a2f0ab9310cb2ff235b436e0492fbaa804ce1bc9;p=binutils-gdb.git 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. --- diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 29e1f098d27..0c7a4de7c7d 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. */