From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 699313858002; Tue, 12 Apr 2022 15:40:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 699313858002 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Update skip_one_die for new abbrev properties X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 696eef26e00a268a2e1346c9d3f1a4db968a6799 X-Git-Newrev: a2f0ab9310cb2ff235b436e0492fbaa804ce1bc9 Message-Id: <20220412154031.699313858002@sourceware.org> Date: Tue, 12 Apr 2022 15:40:31 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Apr 2022 15:40:31 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Da2f0ab9310cb= 2ff235b436e0492fbaa804ce1bc9 commit a2f0ab9310cb2ff235b436e0492fbaa804ce1bc9 Author: Tom Tromey Date: Sat Mar 13 14:55:13 2021 -0700 Update skip_one_die for new abbrev properties =20 This updates skip_one_die to speed it up in the cases where either sibling_offset or size_if_constant are set. Diff: --- gdb/dwarf2/read.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 =3D reader->buffer_end; unsigned int form, i; =20 + if (do_skip_children && abbrev->sibling_offset !=3D (unsigned short) -1) + { + /* We only handle DW_FORM_ref4 here. */ + const gdb_byte *sibling_data =3D info_ptr + abbrev->sibling_offset; + unsigned int offset =3D read_4_bytes (abfd, sibling_data); + const gdb_byte *sibling_ptr =3D buffer + offset; + if (sibling_ptr >=3D info_ptr && sibling_ptr < reader->buffer_end) + return sibling_ptr; + /* Fall through to the slow way. */ + } + else if (abbrev->size_if_constant !=3D 0) + { + info_ptr +=3D abbrev->size_if_constant; + if (do_skip_children && abbrev->has_children) + return skip_children (reader, info_ptr); + return info_ptr; + } + for (i =3D 0; i < abbrev->num_attrs; i++) { /* The only abbrev we care about is DW_AT_sibling. */