public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Tom Tromey <tom@tromey.com>,
	Tom de Vries via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH][gdb/symtab] Redo "Fix assert in set_length"
Date: Tue, 27 Sep 2022 14:44:24 +0200	[thread overview]
Message-ID: <2a17bb80-019d-83f1-3d36-f3073ce6a765@suse.de> (raw)
In-Reply-To: <87sfki19y5.fsf@tromey.com>

On 9/23/22 15:45, Tom Tromey wrote:
>>>>>> "Tom" == Tom de Vries via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
> Tom> The fix is to not use the CU table in a .debug_names section to construct
> Tom> all_comp_units, but instead use create_all_comp_units, and then verify the CU
> Tom> table from .debug_names.  This also fixes PR25969, so remove the KFAIL.
> 
> Note that create_all_comp_units was apparently renamed, so this text
> should be changed.
> 

Ack.

> Part of the point of the indices is to avoid reading .debug_info until
> needed -- so scanning it should not be necessary.

Right.  But the benefit of scanning the CU headers is a way to reduce 
complexity of implementation.  And if we do the same for .gdb_index, we 
can drop the atomic on the length field.

> I assume this change
> would cause a performance drop.
> 
> Checking whether performance suffers would be interesting.
> If it doesn't, I'd be more inclined to do this.
> 

I did the following experiment: I build gdb with -O2 at current master.

I loaded a "usual suspect" using a cooked index:
...
$ time.sh gdb -q -batch -iex "set language c" 
libxul.so-93.0-1.1.x86_64.debug
maxmem: 2817504
real: 4.21
user: 13.01
system: 0.83
...

Then using .debug_names:
...
$ time.sh gdb -q -batch -iex "set language c" 
libxul.so-93.0-1.1.x86_64.debug-with-debug-names
maxmem: 267204
real: 0.86
user: 1.55
system: 0.13
...

Then I rebuild with the patch applied and tried again .debug_names:
...
$ time.sh gdb -q -batch -iex "set language c" 
libxul.so-93.0-1.1.x86_64.debug-with-debug-names
maxmem: 373516
real: 0.89
user: 1.57
system: 0.13
...

Doesn't look like a noticeable performance drop to me.

> Tom> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29572
> 
> In this one I see the comment:
> 
>      This happens fine for CUs, but in this case it's a PU.
> 
> Does .debug_names even work with partial units?  I thought there was
> some hole in this area.  Maybe it is just "dwz -m" that can't work with
> .debug_names?  I don't recall any more.
> 

Sorry, I don't recall such a problem.

> Tom> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=25969
> 
> I'm not sure I understand this one, but it says:
> 
>      AFAIU, to fix this, we'll have to do a top-level scan of the CUs,
>      and build partial symbols for CUs are not contained in any index.
> 
> I think if the index is incomplete, and gdb can detect that, then it
> should simply be discarded and a full scan done.  Trying to use both
> .debug_names and a partial cooked index is going to make everything more
> complicated for, IMO, very little gain.

I guess that's a reasonable approach for an incomplete per-module index.

But is it also for an incomplete per-CU index (that is, per-CU index is 
present for some CUs, but missing for other CUs) ?

If so, I guess that's ok.  But on openSUSE, the linked-in glibc object 
always contain some dwarf, so these will then always add a CU without 
per-CU index, causing incompleteness, and gdb will end up ignoring any 
clang-added per-CU index (unless we build a -nostdlib exec).

Thanks,
- Tom

  reply	other threads:[~2022-09-27 12:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-22 13:00 Tom de Vries
2022-09-23 13:45 ` Tom Tromey
2022-09-27 12:44   ` Tom de Vries [this message]
2023-12-05 20:59 ` Tom Tromey
2023-12-06  9:34   ` Tom de Vries

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=2a17bb80-019d-83f1-3d36-f3073ce6a765@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).