diff options
Diffstat (limited to 'src/core/debugger')
-rw-r--r-- | src/core/debugger/gdbstub.cpp | 28 | ||||
-rw-r--r-- | src/core/debugger/gdbstub_arch.cpp | 14 | ||||
-rw-r--r-- | src/core/debugger/gdbstub_arch.h | 6 |
3 files changed, 21 insertions, 27 deletions
diff --git a/src/core/debugger/gdbstub.cpp b/src/core/debugger/gdbstub.cpp index 9c02b7b31..945ec528e 100644 --- a/src/core/debugger/gdbstub.cpp +++ b/src/core/debugger/gdbstub.cpp @@ -96,7 +96,7 @@ static std::string EscapeXML(std::string_view data) { GDBStub::GDBStub(DebuggerBackend& backend_, Core::System& system_) : DebuggerFrontend(backend_), system{system_} { - if (system.CurrentProcess()->Is64BitProcess()) { + if (system.ApplicationProcess()->Is64BitProcess()) { arch = std::make_unique<GDBStubA64>(); } else { arch = std::make_unique<GDBStubA32>(); @@ -340,15 +340,15 @@ void GDBStub::HandleBreakpointInsert(std::string_view command) { success = true; break; case BreakpointType::WriteWatch: - success = system.CurrentProcess()->InsertWatchpoint(system, addr, size, - Kernel::DebugWatchpointType::Write); + success = system.ApplicationProcess()->InsertWatchpoint(system, addr, size, + Kernel::DebugWatchpointType::Write); break; case BreakpointType::ReadWatch: - success = system.CurrentProcess()->InsertWatchpoint(system, addr, size, - Kernel::DebugWatchpointType::Read); + success = system.ApplicationProcess()->InsertWatchpoint(system, addr, size, + Kernel::DebugWatchpointType::Read); break; case BreakpointType::AccessWatch: - success = system.CurrentProcess()->InsertWatchpoint( + success = system.ApplicationProcess()->InsertWatchpoint( system, addr, size, Kernel::DebugWatchpointType::ReadOrWrite); break; case BreakpointType::Hardware: @@ -391,15 +391,15 @@ void GDBStub::HandleBreakpointRemove(std::string_view command) { break; } case BreakpointType::WriteWatch: - success = system.CurrentProcess()->RemoveWatchpoint(system, addr, size, - Kernel::DebugWatchpointType::Write); + success = system.ApplicationProcess()->RemoveWatchpoint(system, addr, size, + Kernel::DebugWatchpointType::Write); break; case BreakpointType::ReadWatch: - success = system.CurrentProcess()->RemoveWatchpoint(system, addr, size, - Kernel::DebugWatchpointType::Read); + success = system.ApplicationProcess()->RemoveWatchpoint(system, addr, size, + Kernel::DebugWatchpointType::Read); break; case BreakpointType::AccessWatch: - success = system.CurrentProcess()->RemoveWatchpoint( + success = system.ApplicationProcess()->RemoveWatchpoint( system, addr, size, Kernel::DebugWatchpointType::ReadOrWrite); break; case BreakpointType::Hardware: @@ -482,7 +482,7 @@ static std::optional<std::string> GetNameFromThreadType64(Core::Memory::Memory& static std::optional<std::string> GetThreadName(Core::System& system, const Kernel::KThread* thread) { - if (system.CurrentProcess()->Is64BitProcess()) { + if (system.ApplicationProcess()->Is64BitProcess()) { return GetNameFromThreadType64(system.Memory(), thread); } else { return GetNameFromThreadType32(system.Memory(), thread); @@ -555,7 +555,7 @@ void GDBStub::HandleQuery(std::string_view command) { SendReply(fmt::format("TextSeg={:x}", main->first)); } else { SendReply(fmt::format("TextSeg={:x}", - system.CurrentProcess()->PageTable().GetCodeRegionStart())); + system.ApplicationProcess()->PageTable().GetCodeRegionStart())); } } else if (command.starts_with("Xfer:libraries:read::")) { Loader::AppLoader::Modules modules; @@ -729,7 +729,7 @@ void GDBStub::HandleRcmd(const std::vector<u8>& command) { std::string_view command_str{reinterpret_cast<const char*>(&command[0]), command.size()}; std::string reply; - auto* process = system.CurrentProcess(); + auto* process = system.ApplicationProcess(); auto& page_table = process->PageTable(); const char* commands = "Commands:\n" diff --git a/src/core/debugger/gdbstub_arch.cpp b/src/core/debugger/gdbstub_arch.cpp index 4bef09bd7..831c48513 100644 --- a/src/core/debugger/gdbstub_arch.cpp +++ b/src/core/debugger/gdbstub_arch.cpp @@ -41,9 +41,8 @@ static void PutSIMDRegister(std::array<u32, 64>& simd_regs, size_t offset, const // For sample XML files see the GDB source /gdb/features // This XML defines what the registers are for this specific ARM device -std::string GDBStubA64::GetTargetXML() const { - constexpr const char* target_xml = - R"(<?xml version="1.0"?> +std::string_view GDBStubA64::GetTargetXML() const { + return R"(<?xml version="1.0"?> <!DOCTYPE target SYSTEM "gdb-target.dtd"> <target version="1.0"> <architecture>aarch64</architecture> @@ -178,8 +177,6 @@ std::string GDBStubA64::GetTargetXML() const { <reg name="fpcr" bitsize="32"/> </feature> </target>)"; - - return target_xml; } std::string GDBStubA64::RegRead(const Kernel::KThread* thread, size_t id) const { @@ -270,9 +267,8 @@ u32 GDBStubA64::BreakpointInstruction() const { return 0xd4200000; } -std::string GDBStubA32::GetTargetXML() const { - constexpr const char* target_xml = - R"(<?xml version="1.0"?> +std::string_view GDBStubA32::GetTargetXML() const { + return R"(<?xml version="1.0"?> <!DOCTYPE target SYSTEM "gdb-target.dtd"> <target version="1.0"> <architecture>arm</architecture> @@ -378,8 +374,6 @@ std::string GDBStubA32::GetTargetXML() const { <reg name="fpscr" bitsize="32" type="int" group="float" regnum="80"/> </feature> </target>)"; - - return target_xml; } std::string GDBStubA32::RegRead(const Kernel::KThread* thread, size_t id) const { diff --git a/src/core/debugger/gdbstub_arch.h b/src/core/debugger/gdbstub_arch.h index 2540d6456..34530c788 100644 --- a/src/core/debugger/gdbstub_arch.h +++ b/src/core/debugger/gdbstub_arch.h @@ -16,7 +16,7 @@ namespace Core { class GDBStubArch { public: virtual ~GDBStubArch() = default; - virtual std::string GetTargetXML() const = 0; + virtual std::string_view GetTargetXML() const = 0; virtual std::string RegRead(const Kernel::KThread* thread, size_t id) const = 0; virtual void RegWrite(Kernel::KThread* thread, size_t id, std::string_view value) const = 0; virtual std::string ReadRegisters(const Kernel::KThread* thread) const = 0; @@ -27,7 +27,7 @@ public: class GDBStubA64 final : public GDBStubArch { public: - std::string GetTargetXML() const override; + std::string_view GetTargetXML() const override; std::string RegRead(const Kernel::KThread* thread, size_t id) const override; void RegWrite(Kernel::KThread* thread, size_t id, std::string_view value) const override; std::string ReadRegisters(const Kernel::KThread* thread) const override; @@ -47,7 +47,7 @@ private: class GDBStubA32 final : public GDBStubArch { public: - std::string GetTargetXML() const override; + std::string_view GetTargetXML() const override; std::string RegRead(const Kernel::KThread* thread, size_t id) const override; void RegWrite(Kernel::KThread* thread, size_t id, std::string_view value) const override; std::string ReadRegisters(const Kernel::KThread* thread) const override; |