aboutsummaryrefslogtreecommitdiff
path: root/gdb/infcmd.c
diff options
context:
space:
mode:
authorCarl Love <cel@us.ibm.com>2023-01-18 11:13:17 -0500
committerCarl Love <cel@us.ibm.com>2023-01-18 11:13:17 -0500
commitb986eec55f460a9c77a0c06ec30d7280293f7a8c (patch)
tree0d78a889928fc6a76904b3689d36f134fe4d17b7 /gdb/infcmd.c
parent15d2b36c5b60795067cec773a66d2627d2bf9266 (diff)
downloadgdb-b986eec55f460a9c77a0c06ec30d7280293f7a8c.zip
gdb-b986eec55f460a9c77a0c06ec30d7280293f7a8c.tar.gz
gdb-b986eec55f460a9c77a0c06ec30d7280293f7a8c.tar.bz2
Revert "X86: reverse-finish fix"
This reverts commit b22548ddb30bfb167708e82d3bb932461c1b703a. This patch is being reverted since the patch series is causing regressions.
Diffstat (limited to 'gdb/infcmd.c')
-rw-r--r--gdb/infcmd.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 5fcd2ab..7d5ec77 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -1719,10 +1719,19 @@ finish_backward (struct finish_command_fsm *sm)
sal = find_pc_line (func_addr, 0);
- frame_info_ptr frame = get_selected_frame (nullptr);
+ tp->control.proceed_to_finish = 1;
+ /* Special case: if we're sitting at the function entry point,
+ then all we need to do is take a reverse singlestep. We
+ don't need to set a breakpoint, and indeed it would do us
+ no good to do so.
+
+ Note that this can only happen at frame #0, since there's
+ no way that a function up the stack can have a return address
+ that's equal to its entry point. */
if (sal.pc != pc)
{
+ frame_info_ptr frame = get_selected_frame (nullptr);
struct gdbarch *gdbarch = get_frame_arch (frame);
/* Set a step-resume at the function's entry point. Once that's
@@ -1732,22 +1741,16 @@ finish_backward (struct finish_command_fsm *sm)
sr_sal.pspace = get_frame_program_space (frame);
insert_step_resume_breakpoint_at_sal (gdbarch,
sr_sal, null_frame_id);
+
+ proceed ((CORE_ADDR) -1, GDB_SIGNAL_DEFAULT);
}
else
{
- /* We are exactly at the function entry point. Note that this
- can only happen at frame #0.
-
- When setting a step range, need to call set_step_info
- to setup the current_line/symtab fields as well. */
- set_step_info (tp, frame, find_pc_line (pc, 0));
-
- /* Return using a step range so we will keep stepping back
- to the first instruction in the source code line. */
- tp->control.step_range_start = sal.pc;
- tp->control.step_range_end = sal.pc;
+ /* We're almost there -- we just need to back up by one more
+ single-step. */
+ tp->control.step_range_start = tp->control.step_range_end = 1;
+ proceed ((CORE_ADDR) -1, GDB_SIGNAL_DEFAULT);
}
- proceed ((CORE_ADDR) -1, GDB_SIGNAL_DEFAULT);
}
/* finish_forward -- helper function for finish_command. FRAME is the
@@ -1773,6 +1776,9 @@ finish_forward (struct finish_command_fsm *sm, frame_info_ptr frame)
set_longjmp_breakpoint (tp, frame_id);
+ /* We want to print return value, please... */
+ tp->control.proceed_to_finish = 1;
+
proceed ((CORE_ADDR) -1, GDB_SIGNAL_DEFAULT);
}