mirror of
https://github.com/azahar-emu/azahar.git
synced 2026-06-08 11:43:40 -04:00
gdb: Remove all stepping support and full CPU halt
This commit is contained in:
parent
86b66c6913
commit
9ce755cd07
5 changed files with 3 additions and 91 deletions
|
|
@ -612,7 +612,7 @@ void ARMul_State::ServeBreak() {
|
|||
Kernel::Thread* thread = system.Kernel().GetCurrentThreadManager().GetCurrentThread();
|
||||
system.GetRunningCore().SaveContext(thread->context);
|
||||
|
||||
if (last_bkpt_hit || GDBStub::IsMemoryBreak() || GDBStub::GetCpuStepFlag()) {
|
||||
if (last_bkpt_hit || GDBStub::IsMemoryBreak()) {
|
||||
last_bkpt_hit = false;
|
||||
GDBStub::Break();
|
||||
GDBStub::SendTrap(thread, 5);
|
||||
|
|
|
|||
|
|
@ -89,16 +89,6 @@ System::ResultStatus System::RunLoop(bool tight_loop) {
|
|||
running_core->SaveContext(thread->context);
|
||||
}
|
||||
GDBStub::HandlePacket(*this);
|
||||
|
||||
// If the loop is halted and we want to step, use a tiny (1) number of instructions to
|
||||
// execute. Otherwise, get out of the loop function.
|
||||
if (GDBStub::GetCpuHaltFlag()) {
|
||||
if (GDBStub::GetCpuStepFlag()) {
|
||||
tight_loop = false;
|
||||
} else {
|
||||
return ResultStatus::Success;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Signal signal{Signal::None};
|
||||
|
|
@ -269,10 +259,6 @@ System::ResultStatus System::RunLoop(bool tight_loop) {
|
|||
}
|
||||
}
|
||||
|
||||
if (GDBStub::IsServerEnabled()) {
|
||||
GDBStub::SetCpuStepFlag(false);
|
||||
}
|
||||
|
||||
Reschedule();
|
||||
|
||||
return status;
|
||||
|
|
|
|||
|
|
@ -137,8 +137,6 @@ static Kernel::Thread* current_thread = nullptr;
|
|||
// so default to a port outside of that range.
|
||||
u16 gdbstub_port = 24689;
|
||||
|
||||
bool halt_loop = true;
|
||||
bool step_loop = false;
|
||||
bool send_trap = false;
|
||||
|
||||
// If set to false, the server will never be started and no
|
||||
|
|
@ -666,7 +664,6 @@ static void ReadCommand() {
|
|||
return;
|
||||
} else if (c == 0x03) {
|
||||
LOG_INFO(Debug_GDBStub, "gdb: found break command\n");
|
||||
halt_loop = true;
|
||||
SendSignal(current_thread, SIGTRAP);
|
||||
return;
|
||||
} else if (c != GDB_STUB_START) {
|
||||
|
|
@ -916,18 +913,6 @@ void Break(bool is_memory_break) {
|
|||
memory_break = is_memory_break;
|
||||
}
|
||||
|
||||
/// Tell the CPU that it should perform a single step.
|
||||
static void Step() {
|
||||
if (command_length > 1) {
|
||||
RegWrite(PC_REGISTER, GdbHexToInt(command_buffer + 1), current_thread);
|
||||
UpdateCPUThreadContext();
|
||||
}
|
||||
step_loop = true;
|
||||
halt_loop = true;
|
||||
send_trap = true;
|
||||
ClearAllInstructionCache();
|
||||
}
|
||||
|
||||
bool IsMemoryBreak() {
|
||||
if (!IsConnected()) {
|
||||
return false;
|
||||
|
|
@ -939,8 +924,6 @@ bool IsMemoryBreak() {
|
|||
/// Tell the CPU to continue executing.
|
||||
static void Continue() {
|
||||
memory_break = false;
|
||||
step_loop = false;
|
||||
halt_loop = false;
|
||||
ClearAllInstructionCache();
|
||||
}
|
||||
|
||||
|
|
@ -1132,7 +1115,8 @@ void HandlePacket(Core::System& system) {
|
|||
WriteMemory();
|
||||
break;
|
||||
case 's':
|
||||
Step();
|
||||
// Single step, return ENOTSUP
|
||||
SendReply("E5F");
|
||||
return;
|
||||
case 'C':
|
||||
case 'c':
|
||||
|
|
@ -1181,17 +1165,9 @@ void DeferStart() {
|
|||
|
||||
static void Init(u16 port) {
|
||||
if (!server_enabled) {
|
||||
// Set the halt loop to false in case the user enabled the gdbstub mid-execution.
|
||||
// This way the CPU can still execute normally.
|
||||
halt_loop = false;
|
||||
step_loop = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// Setup initial gdbstub status
|
||||
halt_loop = true;
|
||||
step_loop = false;
|
||||
|
||||
breakpoints_execute.clear();
|
||||
breakpoints_read.clear();
|
||||
breakpoints_write.clear();
|
||||
|
|
@ -1239,9 +1215,6 @@ static void Init(u16 port) {
|
|||
if (gdbserver_socket < 0) {
|
||||
// In the case that we couldn't start the server for whatever reason, just start CPU
|
||||
// execution like normal.
|
||||
halt_loop = false;
|
||||
step_loop = false;
|
||||
|
||||
LOG_ERROR(Debug_GDBStub, "Failed to accept gdb client");
|
||||
} else {
|
||||
LOG_INFO(Debug_GDBStub, "Client connected.\n");
|
||||
|
|
@ -1285,22 +1258,6 @@ bool IsConnected() {
|
|||
return IsServerEnabled() && gdbserver_socket != -1;
|
||||
}
|
||||
|
||||
bool GetCpuHaltFlag() {
|
||||
return halt_loop;
|
||||
}
|
||||
|
||||
void SetCpuHaltFlag(bool halt) {
|
||||
halt_loop = halt;
|
||||
}
|
||||
|
||||
bool GetCpuStepFlag() {
|
||||
return step_loop;
|
||||
}
|
||||
|
||||
void SetCpuStepFlag(bool is_step) {
|
||||
step_loop = is_step;
|
||||
}
|
||||
|
||||
void SendTrap(Kernel::Thread* thread, int trap) {
|
||||
if (!send_trap) {
|
||||
return;
|
||||
|
|
@ -1310,7 +1267,6 @@ void SendTrap(Kernel::Thread* thread, int trap) {
|
|||
|
||||
SendSignal(thread, trap);
|
||||
|
||||
halt_loop = true;
|
||||
send_trap = false;
|
||||
}
|
||||
}; // namespace GDBStub
|
||||
|
|
|
|||
|
|
@ -92,26 +92,6 @@ BreakpointAddress GetNextBreakpointFromAddress(VAddr addr, GDBStub::BreakpointTy
|
|||
*/
|
||||
bool CheckBreakpoint(VAddr addr, GDBStub::BreakpointType type);
|
||||
|
||||
// If set to true, the CPU will halt at the beginning of the next CPU loop.
|
||||
bool GetCpuHaltFlag();
|
||||
|
||||
/**
|
||||
* If set to true, the CPU will halt at the beginning of the next CPU loop.
|
||||
*
|
||||
* @param halt whether to halt on the next loop
|
||||
*/
|
||||
void SetCpuHaltFlag(bool halt);
|
||||
|
||||
// If set to true and the CPU is halted, the CPU will step one instruction.
|
||||
bool GetCpuStepFlag();
|
||||
|
||||
/**
|
||||
* When set to true, the CPU will step one instruction when the CPU is halted next.
|
||||
*
|
||||
* @param is_step
|
||||
*/
|
||||
void SetCpuStepFlag(bool is_step);
|
||||
|
||||
/**
|
||||
* Send trap signal from thread back to the gdbstub server.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -23,9 +23,6 @@ enum class Status {
|
|||
|
||||
static std::atomic<Status> request_status{Status::NoRequest};
|
||||
|
||||
static std::atomic<bool> was_halted = false;
|
||||
static std::atomic<bool> was_stepping = false;
|
||||
|
||||
} // namespace
|
||||
|
||||
/**
|
||||
|
|
@ -97,14 +94,9 @@ void SetHioRequest(Core::System& system, const VAddr addr) {
|
|||
current_hio_request_addr = addr;
|
||||
request_status = Status::NotSent;
|
||||
|
||||
was_halted = GetCpuHaltFlag();
|
||||
was_stepping = GetCpuStepFlag();
|
||||
|
||||
// Now halt, so that no further instructions are executed until the request
|
||||
// is processed by the client. We will continue after the reply comes back
|
||||
Break();
|
||||
SetCpuHaltFlag(true);
|
||||
SetCpuStepFlag(false);
|
||||
system.GetRunningCore().ClearInstructionCache();
|
||||
}
|
||||
|
||||
|
|
@ -195,8 +187,6 @@ void HandleHioReply(Core::System& system, const u8* const command_buffer,
|
|||
request_status = Status::NoRequest;
|
||||
|
||||
// Restore state from before the request came in
|
||||
SetCpuStepFlag(was_stepping);
|
||||
SetCpuHaltFlag(was_halted);
|
||||
system.GetRunningCore().ClearInstructionCache();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue