From 58c010877e77ad9dd4e14272f9500d40b75e7429 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Tue, 22 Jun 2021 15:42:51 +0100 Subject: displaced step: pass down target_waitstatus instead of gdb_signal This commit tweaks displaced_step_finish & friends to pass down a target_waitstatus instead of a gdb_signal. This is needed because a patch later in the step-over-{thread-exit,clone] series will want to make displaced_step_buffers::finish handle TARGET_WAITKIND_THREAD_EXITED. It also helps with the TARGET_WAITKIND_THREAD_CLONED patch later in that same series. It's also a bit more logical this way, as we don't have to pass down signals when the thread didn't actually stop for a signal. So we can also think of it as a clean up. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27338 Change-Id: I4c5d338647b028071bc498c4e47063795a2db4c0 Approved-By: Andrew Burgess --- gdb/displaced-stepping.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'gdb/displaced-stepping.c') diff --git a/gdb/displaced-stepping.c b/gdb/displaced-stepping.c index 9f98ea8..3fefdf3 100644 --- a/gdb/displaced-stepping.c +++ b/gdb/displaced-stepping.c @@ -192,12 +192,18 @@ write_memory_ptid (ptid_t ptid, CORE_ADDR memaddr, } static bool -displaced_step_instruction_executed_successfully (gdbarch *arch, - gdb_signal signal) +displaced_step_instruction_executed_successfully + (gdbarch *arch, const target_waitstatus &status) { - if (signal != GDB_SIGNAL_TRAP) + if (status.kind () == TARGET_WAITKIND_STOPPED + && status.sig () != GDB_SIGNAL_TRAP) return false; + /* All other (thread event) waitkinds can only happen if the + instruction fully executed. For example, a fork, or a syscall + entry can only happen if the syscall instruction actually + executed. */ + if (target_stopped_by_watchpoint ()) { if (gdbarch_have_nonsteppable_watchpoint (arch) @@ -210,7 +216,7 @@ displaced_step_instruction_executed_successfully (gdbarch *arch, displaced_step_finish_status displaced_step_buffers::finish (gdbarch *arch, thread_info *thread, - gdb_signal sig) + const target_waitstatus &status) { gdb_assert (thread->displaced_step_state.in_progress ()); @@ -256,7 +262,7 @@ displaced_step_buffers::finish (gdbarch *arch, thread_info *thread, regcache *rc = get_thread_regcache (thread); bool instruction_executed_successfully - = displaced_step_instruction_executed_successfully (arch, sig); + = displaced_step_instruction_executed_successfully (arch, status); if (instruction_executed_successfully) { -- cgit v1.1