summaryrefslogtreecommitdiff
path: root/src/core/gdbstub
diff options
context:
space:
mode:
authorGravatar polaris-2015-10-04 11:22:31 -0400
committerGravatar polaris-2015-10-04 11:22:31 -0400
commit42928659e8d4ff4edffc36acabe3d9040dbc1326 (patch)
tree96434bbd4878b9a1a6944cc287463d641e56368e /src/core/gdbstub
parentToggle use_gdbstub in citra GLFW (diff)
downloadyuzu-42928659e8d4ff4edffc36acabe3d9040dbc1326.tar.gz
yuzu-42928659e8d4ff4edffc36acabe3d9040dbc1326.tar.xz
yuzu-42928659e8d4ff4edffc36acabe3d9040dbc1326.zip
Use BreakpointAddress struct instead of passing address directly
Diffstat (limited to 'src/core/gdbstub')
-rw-r--r--src/core/gdbstub/gdbstub.cpp13
-rw-r--r--src/core/gdbstub/gdbstub.h7
2 files changed, 15 insertions, 5 deletions
diff --git a/src/core/gdbstub/gdbstub.cpp b/src/core/gdbstub/gdbstub.cpp
index ced1c54f5..25ce63b29 100644
--- a/src/core/gdbstub/gdbstub.cpp
+++ b/src/core/gdbstub/gdbstub.cpp
@@ -231,13 +231,18 @@ static void RemoveBreakpoint(BreakpointType type, PAddr addr) {
231 } 231 }
232} 232}
233 233
234PAddr GetNextBreakpointFromAddress(PAddr addr, BreakpointType type) { 234BreakpointAddress GetNextBreakpointFromAddress(PAddr addr, BreakpointType type) {
235 std::map<u32, Breakpoint>& p = GetBreakpointList(type); 235 std::map<u32, Breakpoint>& p = GetBreakpointList(type);
236 auto next_breakpoint = p.lower_bound(addr); 236 auto next_breakpoint = p.lower_bound(addr);
237 u32 breakpoint = -1; 237 BreakpointAddress breakpoint;
238 238
239 if (next_breakpoint != p.end()) 239 if (next_breakpoint != p.end()) {
240 breakpoint = next_breakpoint->first; 240 breakpoint.address = next_breakpoint->first;
241 breakpoint.type = type;
242 } else {
243 breakpoint.address = 0;
244 breakpoint.type = BreakpointType::None;
245 }
241 246
242 return breakpoint; 247 return breakpoint;
243} 248}
diff --git a/src/core/gdbstub/gdbstub.h b/src/core/gdbstub/gdbstub.h
index 11ff823c3..da238f349 100644
--- a/src/core/gdbstub/gdbstub.h
+++ b/src/core/gdbstub/gdbstub.h
@@ -18,6 +18,11 @@ enum class BreakpointType {
18 Access ///< Access (R/W) Breakpoint 18 Access ///< Access (R/W) Breakpoint
19}; 19};
20 20
21struct BreakpointAddress {
22 PAddr address;
23 BreakpointType type;
24};
25
21/// If set to false, the server will never be started and no gdbstub-related functions will be executed. 26/// If set to false, the server will never be started and no gdbstub-related functions will be executed.
22extern std::atomic<bool> g_server_enabled; 27extern std::atomic<bool> g_server_enabled;
23 28
@@ -63,7 +68,7 @@ void HandlePacket();
63 * @param addr Address to search from. 68 * @param addr Address to search from.
64 * @param type Type of breakpoint. 69 * @param type Type of breakpoint.
65 */ 70 */
66PAddr GetNextBreakpointFromAddress(u32 addr, GDBStub::BreakpointType type); 71BreakpointAddress GetNextBreakpointFromAddress(u32 addr, GDBStub::BreakpointType type);
67 72
68/** 73/**
69 * Check if a breakpoint of the specified type exists at the given address. 74 * Check if a breakpoint of the specified type exists at the given address.