mirror of
https://github.com/stenzek/duckstation.git
synced 2025-06-07 12:05:52 +00:00
GDBServer: Stub out thread commands
This commit is contained in:
parent
7bae23d79d
commit
541af8d5de
@ -2363,17 +2363,20 @@ ALWAYS_INLINE_RELEASE bool CPU::CheckBreakpointList(BreakpointType type, Virtual
|
|||||||
{
|
{
|
||||||
System::PauseSystem(true);
|
System::PauseSystem(true);
|
||||||
|
|
||||||
|
TinyString msg;
|
||||||
if (bp.auto_clear)
|
if (bp.auto_clear)
|
||||||
{
|
{
|
||||||
Host::ReportDebuggerMessage(fmt::format("Stopped execution at 0x{:08X}.", pc));
|
msg.format("Stopped execution at 0x{:08X}.", pc);
|
||||||
|
Host::ReportDebuggerMessage(msg);
|
||||||
bplist.erase(bplist.begin() + i);
|
bplist.erase(bplist.begin() + i);
|
||||||
count--;
|
count--;
|
||||||
UpdateDebugDispatcherFlag();
|
UpdateDebugDispatcherFlag();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Host::ReportDebuggerMessage(fmt::format("Hit {} breakpoint {} at 0x{:08X}, Hit Count {}.",
|
msg.format("Hit {} breakpoint {} at 0x{:08X}, Hit Count {}.", GetBreakpointTypeName(type), bp.number, address,
|
||||||
GetBreakpointTypeName(type), bp.number, address, bp.hit_count));
|
bp.hit_count);
|
||||||
|
Host::ReportDebuggerMessage(msg);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ LOG_CHANNEL(GDBServer);
|
|||||||
namespace GDBServer {
|
namespace GDBServer {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class ClientSocket final : public BufferedStreamSocket
|
class ClientSocket final : public BufferedStreamSocket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -43,6 +44,7 @@ private:
|
|||||||
|
|
||||||
bool m_seen_resume = false;
|
bool m_seen_resume = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
static u8 ComputeChecksum(std::string_view str);
|
static u8 ComputeChecksum(std::string_view str);
|
||||||
@ -50,6 +52,7 @@ static u8 ComputeChecksum(std::string_view str);
|
|||||||
static bool Cmd$_questionMark(ClientSocket* client, std::string_view data);
|
static bool Cmd$_questionMark(ClientSocket* client, std::string_view data);
|
||||||
static bool Cmd$g(ClientSocket* client, std::string_view data);
|
static bool Cmd$g(ClientSocket* client, std::string_view data);
|
||||||
static bool Cmd$G(ClientSocket* client, std::string_view data);
|
static bool Cmd$G(ClientSocket* client, std::string_view data);
|
||||||
|
static bool Cmd$H(ClientSocket* client, std::string_view data);
|
||||||
static bool Cmd$m(ClientSocket* client, std::string_view data);
|
static bool Cmd$m(ClientSocket* client, std::string_view data);
|
||||||
static bool Cmd$M(ClientSocket* client, std::string_view data);
|
static bool Cmd$M(ClientSocket* client, std::string_view data);
|
||||||
static bool Cmd$s(ClientSocket* client, std::string_view data);
|
static bool Cmd$s(ClientSocket* client, std::string_view data);
|
||||||
@ -69,10 +72,10 @@ static bool ProcessPacket(ClientSocket* socket, std::string_view data);
|
|||||||
using LargeReplyPacket = SmallStackString<768>;
|
using LargeReplyPacket = SmallStackString<768>;
|
||||||
|
|
||||||
/// Number of registers in GDB remote protocol for MIPS III.
|
/// Number of registers in GDB remote protocol for MIPS III.
|
||||||
constexpr int NUM_GDB_REGISTERS = 73;
|
static constexpr int NUM_GDB_REGISTERS = 73;
|
||||||
|
|
||||||
/// List of GDB remote protocol registers for MIPS III (excluding FP).
|
/// List of GDB remote protocol registers for MIPS III (excluding FP).
|
||||||
static const std::array<u32*, 38> REGISTERS{
|
static constexpr std::array<u32*, 38> REGISTERS{
|
||||||
&CPU::g_state.regs.r[0],
|
&CPU::g_state.regs.r[0],
|
||||||
&CPU::g_state.regs.r[1],
|
&CPU::g_state.regs.r[1],
|
||||||
&CPU::g_state.regs.r[2],
|
&CPU::g_state.regs.r[2],
|
||||||
@ -119,6 +122,7 @@ static constexpr std::pair<std::string_view, bool (*)(ClientSocket*, std::string
|
|||||||
{"?", Cmd$_questionMark},
|
{"?", Cmd$_questionMark},
|
||||||
{"g", Cmd$g},
|
{"g", Cmd$g},
|
||||||
{"G", Cmd$G},
|
{"G", Cmd$G},
|
||||||
|
{"H", Cmd$H},
|
||||||
{"m", Cmd$m},
|
{"m", Cmd$m},
|
||||||
{"M", Cmd$M},
|
{"M", Cmd$M},
|
||||||
{"s", Cmd$s},
|
{"s", Cmd$s},
|
||||||
@ -203,6 +207,14 @@ bool GDBServer::Cmd$G(ClientSocket* client, std::string_view data)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Thread operations, ignored.
|
||||||
|
bool GDBServer::Cmd$H(ClientSocket* client, std::string_view data)
|
||||||
|
{
|
||||||
|
WARNING_LOG("Ignoring thread command '{}'", data);
|
||||||
|
client->SendReplyWithAck("OK");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/// Get memory.
|
/// Get memory.
|
||||||
bool GDBServer::Cmd$m(ClientSocket* client, std::string_view data)
|
bool GDBServer::Cmd$m(ClientSocket* client, std::string_view data)
|
||||||
{
|
{
|
||||||
@ -499,8 +511,7 @@ void GDBServer::ClientSocket::OnRead()
|
|||||||
}
|
}
|
||||||
else if (GDBServer::IsPacketComplete(current_packet))
|
else if (GDBServer::IsPacketComplete(current_packet))
|
||||||
{
|
{
|
||||||
// TODO: Make this not copy.
|
DEBUG_LOG("{} > {}", GetRemoteAddress().ToString(), current_packet);
|
||||||
DEV_LOG("{} > {}", GetRemoteAddress().ToString(), current_packet);
|
|
||||||
if (!ProcessPacket(this, current_packet))
|
if (!ProcessPacket(this, current_packet))
|
||||||
SendPacket("-");
|
SendPacket("-");
|
||||||
|
|
||||||
@ -530,7 +541,7 @@ void GDBServer::ClientSocket::SendPacket(std::string_view sv)
|
|||||||
if (sv.empty())
|
if (sv.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
WARNING_LOG("Write: {}", sv);
|
DEBUG_LOG("Send reply: {}", sv);
|
||||||
if (size_t written = Write(sv.data(), sv.length()); written != sv.length())
|
if (size_t written = Write(sv.data(), sv.length()); written != sv.length())
|
||||||
ERROR_LOG("Only wrote {} of {} bytes.", written, sv.length());
|
ERROR_LOG("Only wrote {} of {} bytes.", written, sv.length());
|
||||||
}
|
}
|
||||||
@ -543,7 +554,7 @@ void GDBServer::ClientSocket::OnSystemPaused()
|
|||||||
m_seen_resume = false;
|
m_seen_resume = false;
|
||||||
|
|
||||||
// Generate a stop reply packet, insert '?' command to generate it.
|
// Generate a stop reply packet, insert '?' command to generate it.
|
||||||
GDBServer::ProcessPacket(this, "$?#3f");
|
SendReplyWithAck("S00");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GDBServer::ClientSocket::OnSystemResumed()
|
void GDBServer::ClientSocket::OnSystemResumed()
|
||||||
|
@ -2140,6 +2140,7 @@ bool Host::CopyTextToClipboard(std::string_view text)
|
|||||||
|
|
||||||
void Host::ReportDebuggerMessage(std::string_view message)
|
void Host::ReportDebuggerMessage(std::string_view message)
|
||||||
{
|
{
|
||||||
|
INFO_LOG("Debugger message: {}", message);
|
||||||
emit g_emu_thread->debuggerMessageReported(QString::fromUtf8(message));
|
emit g_emu_thread->debuggerMessageReported(QString::fromUtf8(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user