From: Simon Marchi <simark@simark.ca>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v2 8/8] Update .debug_names documentation
Date: Tue, 10 Feb 2026 15:25:31 -0500 [thread overview]
Message-ID: <72ab46ea-9db9-4af7-9dc0-9165f2853013@simark.ca> (raw)
In-Reply-To: <87ikc41im3.fsf@tromey.com>
On 2026-02-10 14:52, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:
>
>>> For a variable to be shared in a PU, either it will just be a
>>> declaration and each including CU will have a separate definition that
>>> refers to it; or alternatively every such variable will have the same
>>> address. But in the latter case they are the same variable.
>
> Simon> You can't have a DW_TAG_variable in a PU that will represent a definition
> Simon> in all the included CUs? For instance, if you have
>
> Simon> static const char *my_var;
>
> Simon> inside a C header file included by many C source files. And then, in
> Simon> the DWARF, we "factor out" that DW_TAG_variable into a PU that is
> Simon> "DW_TAG_imported_unit"-imported by many CUs. In that case, wouldn't we
> Simon> have a my_var definition in all CUs?
>
> This approach would make a different variable in each CU. They would
> all share a name but have different addresses. So while it's possible
> to share some of this in a PU (like, the name, type, and source
> location), each CU would still end up with a separate DIE describing the
> address.
Ah, thanks.
>
> Simon> Ok, so a use case for this would be: the user types "break
> Simon> my_inlined_func", and then you want to find all CUs where
> Simon> my_inlined_func is defined (even through a PU), to find all the inline
> Simon> sites, to put breakpoints on all of them?
>
> Yes. That's the failure addressed by the series.
Perfect, thanks.
>>> BTW the DWARF approach to inline functions will also hamper incremental
>>> CU expansion (if we ever get there). At the very least when finding an
>>> inline function gdb will have to scan all DIEs in the CUs just in case.
>
> Simon> That's a bummer, I hope we can find a way around this.
>
> Since the reader pre-loads all the DIEs I am thinking it probably won't
> be super expensive to also iterate over them. Or alternatively we could
> have the DIE-loading process notice all the spots where an inlined
> function is seen.
I was actually wondering if we could avoid pre-loading all the DIEs from
the start. But if we need to to a full scan for something like this...
IWBN to measure how long it takes to just read the DIEs, and then to
iterate over all DIEs doing nothing. Then we'll know if we need to care
about that part or not.
Simon
next prev parent reply other threads:[~2026-02-10 20:25 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-26 21:33 [PATCH v2 0/8] Correctly handle inline functions with dwz Tom Tromey
2026-01-26 21:33 ` [PATCH v2 1/8] Don't call add_dependence from index_imported_unit Tom Tromey
2026-01-26 21:33 ` [PATCH v2 2/8] Skip partial units in process_psymtab_comp_unit Tom Tromey
2026-01-26 21:33 ` [PATCH v2 3/8] Don't consider DW_TAG_inlined_subroutine as interesting Tom Tromey
2026-01-26 21:33 ` [PATCH v2 4/8] Combine two cases in cooked_index_functions::search Tom Tromey
2026-01-26 21:33 ` [PATCH v2 5/8] Remove C++ special case from process_imported_unit_die Tom Tromey
2026-01-26 21:33 ` [PATCH v2 6/8] Have iterate_over_one_compunit_symtab search included symtabs Tom Tromey
2026-01-30 22:04 ` Simon Marchi
2026-01-31 15:04 ` Tom Tromey
2026-01-26 21:33 ` [PATCH v2 7/8] Handle inline functions with dwz Tom Tromey
2026-02-10 3:51 ` Simon Marchi
2026-01-26 21:33 ` [PATCH v2 8/8] Update .debug_names documentation Tom Tromey
2026-02-10 4:26 ` Simon Marchi
2026-02-10 16:14 ` Tom Tromey
2026-02-10 17:03 ` Simon Marchi
2026-02-10 19:52 ` Tom Tromey
2026-02-10 20:25 ` Simon Marchi [this message]
2026-02-10 20:46 ` Tom Tromey
2026-01-26 21:42 ` [PATCH v2 0/8] Correctly handle inline functions with dwz Simon Marchi
2026-01-26 23:31 ` Tom Tromey
2026-01-26 22:05 ` Tom de Vries
2026-01-30 22:06 ` Simon Marchi
2026-03-05 18:53 ` Tom Tromey
2026-02-06 19:14 ` 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=72ab46ea-9db9-4af7-9dc0-9165f2853013@simark.ca \
--to=simark@simark.ca \
--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