Files
FEX-Emu--FEX/Source/Interface/Core/GdbServer.h
T
Scott Mansell e44b3ca495 Gdbserver: Implement enough to reach gdb prompt
Memory is implemented, but without any checking or
invalidation.
Registers just hardcode a RIP for my test elf.

But GDB can read the elf over tcp, initilize and allow you to create breakpoints, which get
writen back before continue (which is not hooked up)
2020-03-06 07:56:01 +02:00

37 lines
921 B
C++

#include <thread>
#include "Interface/Context/Context.h"
#include "Common/NetStream.h"
namespace FEXCore {
class GdbServer {
public:
GdbServer(FEXCore::Context::Context *ctx, FEXCore::CodeLoader *Loader);
void StartAndBlock() { StartThread(OpenSocket()); }
private:
std::unique_ptr<std::iostream> OpenSocket();
void StartThread(std::unique_ptr<std::iostream> stream);
void GdbServerLoop(std::unique_ptr<std::iostream> stream);
std::string ReadPacket(std::iostream &stream);
void SendPacket(std::ostream &stream, std::string packet);
std::string ProcessPacket(std::string &packet);
std::string handleQuery(std::string &packet);
std::string handleXfer(std::string &packet);
std::string handleMemory(std::string &packet);
std::string handleV(std::string& packet);
FEXCore::Context::Context *CTX;
std::thread gdbServerThread;
uint64_t data_offset;
};
}