Skip to content

Commit

Permalink
Fix single step bug
Browse files Browse the repository at this point in the history
Fixed a bug where single stepping would resume all threads, which caused
the selected thread to change if another thread hit a breakpoint during
the single step.
  • Loading branch information
mossvr committed Oct 15, 2021
1 parent de63eab commit 17c1fa9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion source/gdb_stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ static void print_debug_event(debug_event_t* event)
logf("\t%s\n", exit_type_str[event->exit.type]);
break;
case DEBUG_EVENT_EXCEPTION:
logf("\t%s\n", exception_type_str[event->exception.type]);
logf("\t%s (tid=%lu)\n", exception_type_str[event->exception.type], event->thread_id);
switch(event->exception.type)
{
case DEBUG_EXCEPTION_TRAP:
Expand Down
3 changes: 2 additions & 1 deletion source/gdb_stub_pkt.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,8 @@ static bool gdb_stub_pkt_step(gdb_stub_t* stub, char* packet, size_t length)
}

gdb_stub_enable_breakpoints(stub);
svcContinueDebugEvent(stub->session, 7, NULL, 0u);
u64 tid = stub->thread[idx].tid;
svcContinueDebugEvent(stub->session, 3u, &tid, 1u);
}

return true;
Expand Down

0 comments on commit 17c1fa9

Please sign in to comment.