Implement reading memory and registers with the debugger
This commit is contained in:
parent
c7ff2c784c
commit
0175ef0c80
1 changed files with 5 additions and 2 deletions
|
@ -203,15 +203,18 @@ bool GDBStub::parse_memory_request(const std::string &packet, size_t &addr,
|
||||||
std::string GDBStub::read_registers() {
|
std::string GDBStub::read_registers() {
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
for (int i = 0; i < 32; ++i) {
|
for (int i = 0; i < 32; ++i) {
|
||||||
out << std::string(8, '0'); // TODO: stub
|
out << std::hex << std::setfill('0') << std::setw(8) << vm.read_register(i);
|
||||||
}
|
}
|
||||||
return out.str();
|
return out.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GDBStub::read_memory(size_t addr, size_t length) {
|
std::string GDBStub::read_memory(size_t addr, size_t length) {
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
|
std::vector<uint8_t> mem = vm.read_memory(addr, length);
|
||||||
for (size_t i = 0; i < length; ++i) {
|
for (size_t i = 0; i < length; ++i) {
|
||||||
out << "00"; // TODO: stub
|
out << std::hex << std::setfill('0') << std::setw(2)
|
||||||
|
<< (unsigned int)mem[i];
|
||||||
|
out.flush();
|
||||||
}
|
}
|
||||||
return out.str();
|
return out.str();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue