Re: [PATCH] [gdb] Fix missing print frame when stepping out of function

Tom de Vries
2026-04-03T15:18:19Z

On 3/12/26 1:02 PM, Tom de Vries wrote:
> No longer refreshing the stepping info in the "stepped to a different frame,
> but it's not the start of a statement" case does fix the problem.
>
> But the refreshing is needed to be able to handle stepping out of say function
> f1 into function f2 and immediately stepping back into f1 again. If we don't
> refresh in between, it looks like we stayed in f1.

FWIW, in order to test this theory, I did:
...
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 2e53d2a6c30..ec2697dd437 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -8303,6 +8303,7 @@ process_event_stop_test (struct
execution_control_state *ecs)
stop_pc_sal.line = 0;
infrun_debug_printf ("stepped to a different frame, but "
"it's not the start of a statement");
+ refresh_step_info = false;
}
}

...
and ran into a failure here:
...
(gdb) PASS: gdb.dwarf2/dw2-step-out-of-function-no-stmt.exp: continue to
breakpoint: bar
step^M
0x0000000000401116 in foo ()^M
(gdb) FAIL: gdb.dwarf2/dw2-step-out-of-function-no-stmt.exp: step
...

I haven't looked into exactly why this is failing, but the apparently
the refresh_step_info does have a function here.

Thanks,
- Tom