Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC][gdb/symtab] Lazy expansion of full symbol table
Date: Mon, 21 Jun 2021 11:18:33 +0200	[thread overview]
Message-ID: <25c649a5-6019-3500-7486-e909bac56f92@suse.de> (raw)
In-Reply-To: <87tulsw17w.fsf@tromey.com>

On 6/21/21 1:44 AM, Tom Tromey wrote:
> Tom> Tried the updated branch and ran into a race condition, fixed in
> Tom> attached patch.
> 
> How did you observe it?
> 

Download and extract
https://download.opensuse.org/tumbleweed/repo/debug/x86_64/glibc-debuginfo-2.33-8.1.x86_64.rpm
.

Then:
...
$ gdb -q -batch
~/reproduce/usr/lib/debug/usr/lib64/ld-2.33.so-2.33-8.1.x86_64.debug
Dwarf Error: DW_FORM_line_strp used without .debug_line_str section [in
module
/home/vries/reproduce/usr/lib/debug/usr/lib64/ld-2.33.so-2.33-8.1.x86_64.debug]
...

> Tom> +  static std::mutex mutex;
> Tom>    asection *sectp;
> Tom>    bfd *abfd;
> Tom>    gdb_byte *buf, *retbuf;
>  
> Tom> +  std::lock_guard<std::mutex> guard (mutex);
> Tom>    if (readin)
> Tom>      return;
> Tom>    buffer = NULL;
> 
> I don't think we want to do this, because BFD isn't thread-safe, and
> I've been avoiding touching it.  Instead I think we'll have to track
> down the problems spots and arrange for the required sections to be read
> in before any threaded work is started.
> 

Ack, I see.

---

I rebuild the updated branch and ran the tests and investigated this
dwarf error:
...
(gdb) file
/home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.arch/amd64-disp-step-avx/amd64-disp-step-avx^M
Reading symbols from
/home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.arch/amd64-disp-step-avx/amd64-disp-step-avx...^M
Dwarf Error: Could not find abbrev number 2391 in CU at offset 0x29 [in
module
/home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.arch/amd64-disp-step-avx/amd64-disp-step-avx]^M
...
when using gcc-11.

I managed to fix that using this patch:
...
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 265ebee1de8..f98acfa33ed 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -7204,7 +7204,8 @@ skip_one_die (const struct die_reader_specs
*reader, const gdb_b
yte *info_ptr,
       /* 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;
+      const gdb_byte *sibling_ptr
+       = buffer + to_underlying (cu->header.sect_off) + offset;
       if (sibling_ptr >= info_ptr && sibling_ptr < reader->buffer_end)
        return sibling_ptr;
       /* Fall through to the slow way.  */
...

The DW_FORM_ref4 offset is relative to the start of the CU, but buffer
points to the start of .debug_info.

Thanks,
- Tom

  reply	other threads:[~2021-06-21  9:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-14  9:39 Tom de Vries
2021-06-14 20:54 ` Tom Tromey
2021-06-14 23:36   ` Tom de Vries
2021-06-15 13:26     ` Tom Tromey
2021-06-16 10:20       ` Tom de Vries
2021-06-18  2:30         ` Tom Tromey
2021-06-19 19:36           ` Tom de Vries
2021-06-20  9:41             ` Tom de Vries
2021-06-20 18:17               ` Tom Tromey
2021-06-22  9:16                 ` Tom de Vries
2021-06-20 23:44             ` Tom Tromey
2021-06-21  9:18               ` Tom de Vries [this message]
2021-06-27 22:24                 ` Tom Tromey
2021-06-28  0:48               ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=25c649a5-6019-3500-7486-e909bac56f92@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox