Re: [PATCH 0/7] Inline Function Optimised Code Debug Improvements

Sam James
2025-08-01T15:41:49Z

Andrew Burgess <aburgess@redhat.com> writes:

> This series presents some improvements to debugging inline functions,
> especially in optimised code.
>
> The first two patches of this series have been posted previously here:
>
> https://inbox.sourceware.org/gdb-patches/cover.1736865029.git.aburgess@redhat.com
>
> This series replaces that earlier work, though the patches are
> basically unchanged.
>
> This entire series is an alternative solution to the patches that were
> posted here:
>
> https://inbox.sourceware.org/gdb-patches/AS1PR01MB946510286FBF2497A6F03E83E4922@AS1PR01MB9465.eurprd01.prod.exchangelabs.com/
>
> My reasons for writing an alternative patch set can be found in the
> commit messages of patches (2) and (7), I'm not going to repeat them
> here. However, Bernd, the original patch author, did amazing work
> identifying the problems GDB was having, and these patches likely
> wouldn't exist without the original patch series, so a big thanks
> there.
>
> For reviewing, this series can be considered in 3 parts:
>
> + Patches (1) and (2) are independent from the rest of the series,
> though related in theme. Both these patches could be approved and
> merged ahead of remaining work, and do offer an improvement to GDB
> on their own.
>
> + Patches (3), (4), (5), and (6) are refactoring work to support the
> last patch. These can be reviewed, but shouldn't be merged until
> the last patch is approved.
>
> + Patch (7) covers the final parts of this work, which deal with
> non-empty inline functions.
>
> All thoughts and feedback are welcome.

There hasn't been anything else so I don't feel too guilty about being
noisy: thanks again for these to you and Bernd. I'd stopped using the
patches when they ceased to apply a few months ago and then applied
these and found I could immediately spot the difference with `list`
working correctly inside/out of an inlined function.

All I need now is PR32381 and I'm a very happy debugger indeed!

Anyway, thank you. I'll continue to test them out.

>
> Thanks,
> Andrew
>
> ---
>
> Andrew Burgess (7):
> gdb: improve line number lookup around inline functions
> gdb: handle empty ranges for inline subroutines
> gdb: split dwarf line table parsing in two
> gdb: move block range recording into its own function
> gdb: create address map after parsing all DIE
> gdb: record block end addresses while parsing DIEs
> gdb: fix-up truncated inline function block ranges
>
> gdb/buildsym.c | 42 +-
> gdb/buildsym.h | 13 +-
> gdb/dwarf2/cu.h | 7 +
> gdb/dwarf2/read.c | 288 +++++++--
> gdb/symtab.c | 25 +-
> gdb/testsuite/gdb.cp/step-and-next-inline.exp | 171 ++++--
> .../gdb.dwarf2/dw2-empty-inline-low-high.c | 39 ++
> .../gdb.dwarf2/dw2-empty-inline-low-high.exp | 128 ++++
> .../gdb.dwarf2/dw2-empty-inline-ranges.c | 54 ++
> .../gdb.dwarf2/dw2-empty-inline-ranges.exp | 260 ++++++++
> .../gdb.dwarf2/dw2-extend-inline-block.c | 78 +++
> .../gdb.dwarf2/dw2-extend-inline-block.exp | 574 ++++++++++++++++++
> gdb/testsuite/gdb.dwarf2/dw2-inline-bt.c | 79 +++
> gdb/testsuite/gdb.dwarf2/dw2-inline-bt.exp | 227 +++++++
> .../gdb.dwarf2/dw2-unexpected-entry-pc.exp | 75 ++-
> gdb/testsuite/gdb.opt/empty-inline-cxx.cc | 65 ++
> gdb/testsuite/gdb.opt/empty-inline-cxx.exp | 95 +++
> gdb/testsuite/gdb.opt/empty-inline.c | 40 ++
> gdb/testsuite/gdb.opt/empty-inline.exp | 130 ++++
> gdb/testsuite/gdb.opt/inline-bt.c | 28 +
> gdb/testsuite/gdb.opt/inline-bt.exp | 119 ++--
> 21 files changed, 2342 insertions(+), 195 deletions(-)
> create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-empty-inline-low-high.c
> create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-empty-inline-low-high.exp
> create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-empty-inline-ranges.c
> create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-empty-inline-ranges.exp
> create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-extend-inline-block.c
> create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-extend-inline-block.exp
> create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-inline-bt.c
> create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-inline-bt.exp
> create mode 100644 gdb/testsuite/gdb.opt/empty-inline-cxx.cc
> create mode 100644 gdb/testsuite/gdb.opt/empty-inline-cxx.exp
> create mode 100644 gdb/testsuite/gdb.opt/empty-inline.c
> create mode 100644 gdb/testsuite/gdb.opt/empty-inline.exp
>
>
> base-commit: cfbf9925c1c34f9e9d47c8b29d165866557663e3