yuzu-emu
/
yuzu
Archived
1
0
Fork 0

gdbstub: Replace PAddr alias with VAddr

In all cases, a virtual address is being passed in, not a physical one.
This commit is contained in:
Lioncash 2018-08-05 15:55:57 -04:00
parent e06953626c
commit ca96f8db4e
2 changed files with 14 additions and 14 deletions

View File

@ -171,7 +171,7 @@ WSADATA InitData;
struct Breakpoint { struct Breakpoint {
bool active; bool active;
PAddr addr; VAddr addr;
u64 len; u64 len;
}; };
@ -181,13 +181,13 @@ static std::map<u64, Breakpoint> breakpoints_write;
struct Module { struct Module {
std::string name; std::string name;
PAddr beg; VAddr beg;
PAddr end; VAddr end;
}; };
static std::vector<Module> modules; static std::vector<Module> modules;
void RegisterModule(std::string name, PAddr beg, PAddr end, bool add_elf_ext) { void RegisterModule(std::string name, VAddr beg, VAddr end, bool add_elf_ext) {
Module module; Module module;
if (add_elf_ext) { if (add_elf_ext) {
Common::SplitPath(name, nullptr, &module.name, nullptr); Common::SplitPath(name, nullptr, &module.name, nullptr);
@ -441,7 +441,7 @@ static std::map<u64, Breakpoint>& GetBreakpointList(BreakpointType type) {
* @param type Type of breakpoint. * @param type Type of breakpoint.
* @param addr Address of breakpoint. * @param addr Address of breakpoint.
*/ */
static void RemoveBreakpoint(BreakpointType type, PAddr addr) { static void RemoveBreakpoint(BreakpointType type, VAddr addr) {
std::map<u64, Breakpoint>& p = GetBreakpointList(type); std::map<u64, Breakpoint>& p = GetBreakpointList(type);
auto bp = p.find(static_cast<u64>(addr)); auto bp = p.find(static_cast<u64>(addr));
@ -452,7 +452,7 @@ static void RemoveBreakpoint(BreakpointType type, PAddr addr) {
} }
} }
BreakpointAddress GetNextBreakpointFromAddress(PAddr addr, BreakpointType type) { BreakpointAddress GetNextBreakpointFromAddress(VAddr addr, BreakpointType type) {
std::map<u64, Breakpoint>& p = GetBreakpointList(type); std::map<u64, Breakpoint>& p = GetBreakpointList(type);
auto next_breakpoint = p.lower_bound(static_cast<u64>(addr)); auto next_breakpoint = p.lower_bound(static_cast<u64>(addr));
BreakpointAddress breakpoint; BreakpointAddress breakpoint;
@ -468,7 +468,7 @@ BreakpointAddress GetNextBreakpointFromAddress(PAddr addr, BreakpointType type)
return breakpoint; return breakpoint;
} }
bool CheckBreakpoint(PAddr addr, BreakpointType type) { bool CheckBreakpoint(VAddr addr, BreakpointType type) {
if (!IsConnected()) { if (!IsConnected()) {
return false; return false;
} }
@ -975,7 +975,7 @@ static void Continue() {
* @param addr Address of breakpoint. * @param addr Address of breakpoint.
* @param len Length of breakpoint. * @param len Length of breakpoint.
*/ */
static bool CommitBreakpoint(BreakpointType type, PAddr addr, u64 len) { static bool CommitBreakpoint(BreakpointType type, VAddr addr, u64 len) {
std::map<u64, Breakpoint>& p = GetBreakpointList(type); std::map<u64, Breakpoint>& p = GetBreakpointList(type);
Breakpoint breakpoint; Breakpoint breakpoint;
@ -1015,7 +1015,7 @@ static void AddBreakpoint() {
auto start_offset = command_buffer + 3; auto start_offset = command_buffer + 3;
auto addr_pos = std::find(start_offset, command_buffer + command_length, ','); auto addr_pos = std::find(start_offset, command_buffer + command_length, ',');
PAddr addr = HexToLong(start_offset, static_cast<u64>(addr_pos - start_offset)); VAddr addr = HexToLong(start_offset, static_cast<u64>(addr_pos - start_offset));
start_offset = addr_pos + 1; start_offset = addr_pos + 1;
u64 len = u64 len =
@ -1064,7 +1064,7 @@ static void RemoveBreakpoint() {
auto start_offset = command_buffer + 3; auto start_offset = command_buffer + 3;
auto addr_pos = std::find(start_offset, command_buffer + command_length, ','); auto addr_pos = std::find(start_offset, command_buffer + command_length, ',');
PAddr addr = HexToLong(start_offset, static_cast<u64>(addr_pos - start_offset)); VAddr addr = HexToLong(start_offset, static_cast<u64>(addr_pos - start_offset));
if (type == BreakpointType::Access) { if (type == BreakpointType::Access) {
// Access is made up of Read and Write types, so add both breakpoints // Access is made up of Read and Write types, so add both breakpoints

View File

@ -22,7 +22,7 @@ enum class BreakpointType {
}; };
struct BreakpointAddress { struct BreakpointAddress {
PAddr address; VAddr address;
BreakpointType type; BreakpointType type;
}; };
@ -53,7 +53,7 @@ bool IsServerEnabled();
bool IsConnected(); bool IsConnected();
/// Register module. /// Register module.
void RegisterModule(std::string name, PAddr beg, PAddr end, bool add_elf_ext = true); void RegisterModule(std::string name, VAddr beg, VAddr end, bool add_elf_ext = true);
/** /**
* Signal to the gdbstub server that it should halt CPU execution. * Signal to the gdbstub server that it should halt CPU execution.
@ -74,7 +74,7 @@ void HandlePacket();
* @param addr Address to search from. * @param addr Address to search from.
* @param type Type of breakpoint. * @param type Type of breakpoint.
*/ */
BreakpointAddress GetNextBreakpointFromAddress(PAddr addr, GDBStub::BreakpointType type); BreakpointAddress GetNextBreakpointFromAddress(VAddr addr, GDBStub::BreakpointType type);
/** /**
* Check if a breakpoint of the specified type exists at the given address. * Check if a breakpoint of the specified type exists at the given address.
@ -82,7 +82,7 @@ BreakpointAddress GetNextBreakpointFromAddress(PAddr addr, GDBStub::BreakpointTy
* @param addr Address of breakpoint. * @param addr Address of breakpoint.
* @param type Type of breakpoint. * @param type Type of breakpoint.
*/ */
bool CheckBreakpoint(PAddr addr, GDBStub::BreakpointType type); bool CheckBreakpoint(VAddr addr, GDBStub::BreakpointType type);
/// If set to true, the CPU will halt at the beginning of the next CPU loop. /// If set to true, the CPU will halt at the beginning of the next CPU loop.
bool GetCpuHaltFlag(); bool GetCpuHaltFlag();