aboutsummaryrefslogtreecommitdiff
path: root/gdb/infrun.c
diff options
context:
space:
mode:
authorBernd Edlinger <bernd.edlinger@hotmail.de>2024-09-02 17:00:12 +0200
committerAndrew Burgess <aburgess@redhat.com>2024-12-04 14:03:44 +0000
commitcc9be6af06ab5490c31883a4b0ceaf212099cf57 (patch)
tree8947ce0ac3457f67c69a1eaa3f8a6750eedcda14 /gdb/infrun.c
parent215ba4f398c1bfabf50368d7379bcd1337addbe2 (diff)
downloadbinutils-users/aburgess/gdb-opt-code-debug.zip
binutils-users/aburgess/gdb-opt-code-debug.tar.gz
binutils-users/aburgess/gdb-opt-code-debug.tar.bz2
[wip] Fix range end handling of inlined subroutinesusers/aburgess/gdb-opt-code-debug
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.
Diffstat (limited to 'gdb/infrun.c')
-rw-r--r--gdb/infrun.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 43eca81..65ac9f3 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -8200,6 +8200,8 @@ process_event_stop_test (struct execution_control_state *ecs)
infrun_debug_printf ("stepping through inlined function");
if (ecs->event_thread->control.step_over_calls == STEP_OVER_ALL
+ || ecs->event_thread->stop_pc () != stop_pc_sal.pc
+ || !stop_pc_sal.is_stmt
|| inline_frame_is_marked_for_skip (false, ecs->event_thread))
keep_going (ecs);
else
@@ -8248,7 +8250,8 @@ process_event_stop_test (struct execution_control_state *ecs)
end_stepping_range (ecs);
return;
}
- else if (*curr_frame_id == original_frame_id)
+ else if (get_stack_frame_id (frame)
+ == ecs->event_thread->control.step_stack_frame_id)
{
/* We are not at the start of a statement, and we have not changed
frame.