]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
[wip] Fix range end handling of inlined subroutines users/aburgess/gdb-opt-code-debug
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Mon, 2 Sep 2024 15:00:12 +0000 (17:00 +0200)
committerAndrew Burgess <aburgess@redhat.com>
Wed, 4 Dec 2024 14:03:44 +0000 (14:03 +0000)
commitcc9be6af06ab5490c31883a4b0ceaf212099cf57
tree8947ce0ac3457f67c69a1eaa3f8a6750eedcda14
parent215ba4f398c1bfabf50368d7379bcd1337addbe2
[wip] Fix range end handling of inlined subroutines

Currently there is a problem when debugging
optimized code when the inferior stops at an inline
sub-range end PC.  It is unclear if that location
is from the inline function or from the calling
function.  Therefore the call stack is often
wrong.

This patch detects the "weak" line table entries
which are likely part of the previous inline block,
and if we have such a location, it assumes the
location belongs to the previous block.

Additionally it may happen that the infrun machinery
steps from one inline range to another inline range
of the same inline function.  That can look like
jumping back and forth from the calling program
to the inline function, while really the inline
function just jumps from a hot to a cold section
of the code, i.e. error handling.

Additionally it may happen that one inline sub-range
is empty or the inline is completely empty.  But
filtering that information away is not the right
solution, since although there is no actual code
from the inline, it is still possible that variables
from an inline function can be inspected here.

The issue with the empty ranges is also discussed here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94474

Conceptually this patch uses a heuristic to work around
a deficiency in the dwarf-4 and dwarf-5 rnglists structure.
There should be a location view number for each inline
sub-range begin PC and end PC, similar to the DW_AT_GNU_entry_view
which is the location view for the inline entry point.
gdb/block.c
gdb/dwarf2/read.c
gdb/infcmd.c
gdb/infrun.c
gdb/symtab.c