From: Simon Marchi <simark@simark.ca>
To: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH v2 7/8] Handle inline functions with dwz
Date: Mon, 9 Feb 2026 22:51:00 -0500 [thread overview]
Message-ID: <6136d297-6822-4a97-bb68-a6d3322a15e6@simark.ca> (raw)
In-Reply-To: <20260126-dw-inline-fixup-pr-symtab-30728-2-v2-7-8ab183d1911c@tromey.com>
On 2026-01-26 16:33, Tom Tromey wrote:
> Currently, gdb does not properly handle inline functions when dwz is
> used. This can be seen by running gdb.cp/breakpoint-locs.exp with the
> cc-with-dwz target board.
>
> The problem here is that inline functions need special handling in the
> dwz case.
>
> First, recall that a DWARF partial unit cannot, in general, be read in
> isolation, as it may not have a language. To handle this, gdb defers
> scanning partial units directly, and instead scans them in the context
> of some including CU.
>
> Entries coming from the PU are attributed to this reading CU. If
> multiple CUs import a PU, gdb has the reader threads race to see which
> one does the actual reading.
>
> However, if an inline function is moved into a partial unit, then that
> means it has potentially been inlined somewhere in every including CU.
>
> Thus, when linespec searches for this function, each such including CU
> should be expanded. But because gdb only attributed the function's
> index entry to one CU, only that particular one is expanded.
>
> This patch fixes this bug. All inclusions of a PU are recorded.
> Entries coming from a PU are attributed to that PU. For most entries
> coming from the PU, a single "canonical" outer CU is chosen to expand.
> However, when an inline function is found, all such CUs are expanded.
>
> A change was also needed to the index writer to handle this case.
> There, entries coming from a PU should note the correct including CU.
> This must be done because, with .debug_names or .gdb_index, gdb does
> not have information about unit imports. Handling inline functions
> here means writing out a separate entry for each outermost CU that
> includes the function's PU.
>
> I did consider changing the cooked indexer to create an internal table
> more similar to what would be created by the .debug_names (e.g.)
> reader: that is, multiple entries for each inline function. However,
> this seemed more expensive at read time, and a main goal of the cooked
> indexer is to be fast.
The description make sense to me. I think the dwz-ing of the DWARF
should be seen as an internal implementation detail to factor common
things, but from the "outside", it's the real CUs/TUs that count.
Semantically, we must do "as-if" there was no factoring out.
Simon
next prev parent reply other threads:[~2026-02-10 3:51 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 " 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 [this message]
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
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=6136d297-6822-4a97-bb68-a6d3322a15e6@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