mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-25 20:00:44 +01:00
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)
37 lines
921 B
C++
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;
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|