mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-10 03:18:55 +02:00
Save JIT context on exit so the debugger reads up-to-date registers
This commit is contained in:
parent
9a19e7ce7f
commit
6c21530e43
1 changed files with 13 additions and 0 deletions
|
|
@ -50,6 +50,14 @@ void PhysicalCore::RunThread(Kernel::KThread* thread) {
|
|||
};
|
||||
|
||||
const auto ExitContext = [&]() {
|
||||
// Save the JIT context back to the thread so the debugger can
|
||||
// read the current register state. Debug halt paths (step,
|
||||
// breakpoint, watchpoint) return from RunThread without going
|
||||
// through the scheduler's Unload/SaveContext.
|
||||
if (system.DebuggerEnabled()) {
|
||||
interface->GetContext(thread->GetContext());
|
||||
}
|
||||
|
||||
// Unlock the thread.
|
||||
interface->UnlockThread(thread);
|
||||
|
||||
|
|
@ -116,6 +124,11 @@ void PhysicalCore::RunThread(Kernel::KThread* thread) {
|
|||
if (breakpoint || prefetch_abort) {
|
||||
if (breakpoint) {
|
||||
interface->RewindBreakpointInstruction();
|
||||
// RewindBreakpointInstruction sets the JIT state to the
|
||||
// saved breakpoint context. Update the thread context to
|
||||
// match, since ExitContext already saved the post-execution
|
||||
// state.
|
||||
interface->GetContext(thread->GetContext());
|
||||
}
|
||||
if (system.DebuggerEnabled()) {
|
||||
system.GetDebugger().NotifyThreadStopped(thread);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue