public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Update skip_one_die for new abbrev properties
@ 2022-04-12 15:40 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2022-04-12 15:40 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a2f0ab9310cb2ff235b436e0492fbaa804ce1bc9

commit a2f0ab9310cb2ff235b436e0492fbaa804ce1bc9
Author: Tom Tromey <tom@tromey.com>
Date:   Sat Mar 13 14:55:13 2021 -0700

    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:
---
 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 = 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.  */


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-12 15:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-12 15:40 [binutils-gdb] Update skip_one_die for new abbrev properties Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).