+2020-04-24 Tom Tromey <tromey@adacore.com>
+
+ * nat/windows-nat.h (struct windows_thread_info)
+ <pc_adjusted>: New member.
+ * windows-nat.c (windows_fetch_one_register): Check
+ pc_adjusted.
+ (windows_nat_target::get_windows_debug_event)
+ (windows_nat_target::wait): Set pc_adjusted.
+
2020-04-24 Tom de Vries <tdevries@suse.de>
* contrib/cc-with-tweaks.sh: Remove <exec>.gdb-index file handling.
breakpoint. This is used to offset the PC when needed. */
bool stopped_at_software_breakpoint = false;
+ /* True if we've adjusted the PC after hitting a software
+ breakpoint, false otherwise. This lets us avoid multiple
+ adjustments if the registers are read multiple times. */
+ bool pc_adjusted = false;
+
/* The name of the thread, allocated by xmalloc. */
gdb::unique_xmalloc_ptr<char> name;
};
else
{
if (th->stopped_at_software_breakpoint
+ && !th->pc_adjusted
&& r == gdbarch_pc_regnum (gdbarch))
{
int size = register_size (gdbarch, r);
value -= gdbarch_decr_pc_after_break (gdbarch);
memcpy (context_offset, &value, size);
}
+ /* Make sure we only rewrite the PC a single time. */
+ th->pc_adjusted = true;
}
regcache->raw_supply (r, context_offset);
}
ptid_t ptid = ptid_t (current_event.dwProcessId, thread_id, 0);
th = thread_rec (ptid, INVALIDATE_CONTEXT);
th->stopped_at_software_breakpoint = true;
+ th->pc_adjusted = false;
}
pending_stops.push_back ({thread_id, *ourstatus, current_event});
thread_id = 0;
|| (current_event.u.Exception.ExceptionRecord.ExceptionCode
== STATUS_WX86_BREAKPOINT))
&& windows_initialization_done)
- current_windows_thread->stopped_at_software_breakpoint = true;
+ {
+ current_windows_thread->stopped_at_software_breakpoint
+ = true;
+ current_windows_thread->pc_adjusted = false;
+ }
}
return result;