Let the GDB stub listen for commands while running
This is needed to send ctrl+C signals while the CPU thread is running.
This commit is contained in:
parent
39569ed1f8
commit
e03ddc2116
|
@ -55,6 +55,8 @@ static u32 sig = 0;
|
|||
static u32 send_signal = 0;
|
||||
static u32 step_break = 0;
|
||||
|
||||
static CoreTiming::EventType* m_gdbStubUpdateEvent;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 active;
|
||||
|
@ -114,6 +116,12 @@ static void hex2mem(u8* dst, u8* src, u32 len)
|
|||
}
|
||||
}
|
||||
|
||||
void GDBStubUpdateCallback(u64 userdata, s64 cycles_late)
|
||||
{
|
||||
gdb_handle_exception(false);
|
||||
CoreTiming::ScheduleEvent(GDB_UPDATE_CYCLES, m_gdbStubUpdateEvent);
|
||||
}
|
||||
|
||||
static u8 gdb_read_byte()
|
||||
{
|
||||
u8 c = '+';
|
||||
|
@ -732,13 +740,20 @@ static void gdb_remove_bp()
|
|||
gdb_reply("OK");
|
||||
}
|
||||
|
||||
void gdb_handle_exception()
|
||||
|
||||
void gdb_handle_exception(bool loop_until_continue)
|
||||
{
|
||||
while (gdb_active())
|
||||
{
|
||||
if (!gdb_data_available())
|
||||
continue;
|
||||
{
|
||||
if (loop_until_continue)
|
||||
continue;
|
||||
else
|
||||
return;
|
||||
}
|
||||
gdb_read_command();
|
||||
// No more commands
|
||||
if (cmd_len == 0)
|
||||
continue;
|
||||
|
||||
|
@ -868,6 +883,9 @@ static void gdb_init_generic(int domain, const sockaddr* server_addr, socklen_t
|
|||
close(tmpsock);
|
||||
#endif
|
||||
tmpsock = -1;
|
||||
|
||||
m_gdbStubUpdateEvent = CoreTiming::RegisterEvent("GDBStubUpdate", GDBStubUpdateCallback);
|
||||
CoreTiming::ScheduleEvent(GDB_UPDATE_CYCLES, m_gdbStubUpdateEvent);
|
||||
}
|
||||
|
||||
void gdb_deinit()
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
|
||||
#ifndef MSG_WAITALL
|
||||
#define MSG_WAITALL (8)
|
||||
|
@ -26,13 +27,17 @@ typedef enum
|
|||
GDB_BP_TYPE_A
|
||||
} gdb_bp_type;
|
||||
|
||||
const s64 GDB_UPDATE_CYCLES = 100000;
|
||||
|
||||
void GDBStubUpdateCallback(u64 userdata, s64 cycles_late);
|
||||
|
||||
void gdb_init(u32 port);
|
||||
void gdb_init_local(const char* socket);
|
||||
void gdb_deinit();
|
||||
bool gdb_active();
|
||||
void gdb_break();
|
||||
|
||||
void gdb_handle_exception();
|
||||
void gdb_handle_exception(bool loopUntilContinue);
|
||||
int gdb_signal(u32 signal);
|
||||
|
||||
int gdb_bp_x(u32 addr);
|
||||
|
@ -41,3 +46,6 @@ int gdb_bp_w(u32 addr);
|
|||
int gdb_bp_a(u32 addr);
|
||||
|
||||
bool gdb_add_bp(u32 type, u32 addr, u32 len);
|
||||
void gdb_handle_exception(bool loop_until_continue);
|
||||
void SendSignal(u32 signal);
|
||||
} // namespace GDBStub
|
||||
|
|
|
@ -158,7 +158,7 @@ int Interpreter::SingleStepInner()
|
|||
Host_UpdateDisasmDialog();
|
||||
|
||||
gdb_signal(GDB_SIGTRAP);
|
||||
gdb_handle_exception();
|
||||
gdb_handle_exception(true);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue