core/debugger: Implement new GDB stub debugger

This commit is contained in:
Liam 2022-05-30 19:35:01 -04:00
parent f6c47df671
commit fb4b3c127f
27 changed files with 1500 additions and 42 deletions

View file

@ -17,6 +17,7 @@
#include "core/core.h"
#include "core/core_timing.h"
#include "core/cpu_manager.h"
#include "core/debugger/debugger.h"
#include "core/device_memory.h"
#include "core/file_sys/bis_factory.h"
#include "core/file_sys/mode.h"
@ -171,6 +172,10 @@ struct System::Impl {
}
}
void InitializeDebugger(System& system, u16 port) {
debugger = std::make_unique<Debugger>(system, port);
}
SystemResultStatus Init(System& system, Frontend::EmuWindow& emu_window) {
LOG_DEBUG(Core, "initialized OK");
@ -329,6 +334,7 @@ struct System::Impl {
gpu_core->NotifyShutdown();
}
debugger.reset();
services.reset();
service_manager.reset();
cheat_engine.reset();
@ -436,6 +442,9 @@ struct System::Impl {
/// Network instance
Network::NetworkInstance network_instance;
/// Debugger
std::unique_ptr<Core::Debugger> debugger;
SystemResultStatus status = SystemResultStatus::Success;
std::string status_details = "";
@ -472,10 +481,6 @@ SystemResultStatus System::Pause() {
return impl->Pause();
}
SystemResultStatus System::SingleStep() {
return SystemResultStatus::Success;
}
void System::InvalidateCpuInstructionCaches() {
impl->kernel.InvalidateAllInstructionCaches();
}
@ -496,6 +501,10 @@ void System::UnstallCPU() {
impl->UnstallCPU();
}
void System::InitializeDebugger() {
impl->InitializeDebugger(*this, Settings::values.gdbstub_port.GetValue());
}
SystemResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath,
u64 program_id, std::size_t program_index) {
return impl->Load(*this, emu_window, filepath, program_id, program_index);
@ -809,6 +818,18 @@ bool System::IsMulticore() const {
return impl->is_multicore;
}
bool System::DebuggerEnabled() const {
return Settings::values.use_gdbstub.GetValue();
}
Core::Debugger& System::GetDebugger() {
return *impl->debugger;
}
const Core::Debugger& System::GetDebugger() const {
return *impl->debugger;
}
void System::RegisterExecuteProgramCallback(ExecuteProgramCallback&& callback) {
impl->execute_program_callback = std::move(callback);
}