[PATCH v3 0/3] Improve debugging of optimized code

Bruno Larsen blarsen@redhat.com
Mon Sep 6 16:23:25 GMT 2021


On 9/5/21 4:15 PM, Bernd Edlinger wrote:
> This update fixes some merge conflicts against recent master.
> 
> The problem this patch tries to resolve is the following:
> gcc debug info of optimized code with inlined functions may
> contain location infos at the end of an inline range, where the
> line number info is from an inlined source code.
> clang on the other hand manages to avoid location infos
> info at the end of an inline range most of the time.
> 
> Therefore the debug experience is sub-optimal since step over
> does often appear to step into an inline function, but at the
> same time the callstack does not show the inline call frame,
> which is very confusing.
> 
> This is due to an inherent ambiguity in the dwarf2 debug info,
> since line table entries at the end of an inline range might be
> either from the inline function or from the calling function.
> Part [1/3] does not change the behaviour.
> Part [2/3] adds a heuristic to determine if a line table
> at the end of an inline range is from the inline function
> or from the calling function.
> Part [3/3] adjusts the breakpoint position of inlined
> subroutines.
> 
> As a side-effect of part [2/3] also empty inline ranges
> may contain line numbers from the inline function.
> This may well be the first sub-range so the breakpoint
> position of an inline function may change in some cases.
> 
> Part [3/3] fixes this breakpoint position to be at the entry-pc,
> instead of using simply the first inline range start position,
> which is currently used as the breakpoint position.
> 
> 
> Bernd Edlinger (3):
>    Introduce a new line table flag is_weak
>    Fix range end handling of inlined subroutines
>    Fix handling of DW_AT_entry_pc of inlined subroutines
> 
>   gdb/block.c                                        |  15 +-
>   gdb/buildsym.c                                     | 103 ++++++++++--
>   gdb/buildsym.h                                     |   3 +
>   gdb/dwarf2/read.c                                  |  98 ++++--------
>   gdb/infcmd.c                                       |   3 +-
>   gdb/infrun.c                                       |  33 +++-
>   gdb/jit.c                                          |   1 +
>   gdb/symmisc.c                                      |  10 +-
>   gdb/symtab.c                                       |  18 +--
>   gdb/symtab.h                                       |   4 +
>   gdb/testsuite/gdb.base/empty-inline.c              |  43 +++++
>   gdb/testsuite/gdb.base/empty-inline.exp            |  50 ++++++
>   gdb/testsuite/gdb.cp/empty-inline.cc               |  33 ++++
>   gdb/testsuite/gdb.cp/empty-inline.exp              |  55 +++++++
>   gdb/testsuite/gdb.cp/step-and-next-inline.cc       |   6 +
>   gdb/testsuite/gdb.cp/step-and-next-inline.exp      | 174 ++++++++-------------
>   .../gdb.dwarf2/dw2-out-of-range-end-of-seq.exp     |   4 +-
>   gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp       |   6 +-
>   gdb/xcoffread.c                                    |   1 +
>   19 files changed, 454 insertions(+), 206 deletions(-)
>   create mode 100644 gdb/testsuite/gdb.base/empty-inline.c
>   create mode 100644 gdb/testsuite/gdb.base/empty-inline.exp
>   create mode 100644 gdb/testsuite/gdb.cp/empty-inline.cc
>   create mode 100644 gdb/testsuite/gdb.cp/empty-inline.exp
> 
I have applied and tested these patches individually. No regressions were added by any patch and this fixes the bug 25987 (https://sourceware.org/bugzilla/show_bug.cgi?id=25987)

Not sure if responding to the cover letter is enough of if I should answer each patch. For the benefit of other readers, the other patches are

[1/3] https://sourceware.org/pipermail/gdb-patches/2021-September/181830.html
[2/3] https://sourceware.org/pipermail/gdb-patches/2021-September/181831.html
[3/3] https://sourceware.org/pipermail/gdb-patches/2021-September/181832.html



More information about the Gdb-patches mailing list