summaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/core/arm/dyncom/arm_dyncom_interpreter.cpp6
-rw-r--r--src/core/gdbstub/gdbstub.cpp13
-rw-r--r--src/core/gdbstub/gdbstub.h7
3 files changed, 18 insertions, 8 deletions
diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
index 8293f4c60..88be27ab2 100644
--- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
+++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
@@ -3583,7 +3583,7 @@ unsigned InterpreterMainLoop(ARMul_State* cpu) {
3583 Common::Profiling::ScopeTimer timer_execute(profile_execute); 3583 Common::Profiling::ScopeTimer timer_execute(profile_execute);
3584 MICROPROFILE_SCOPE(DynCom_Execute); 3584 MICROPROFILE_SCOPE(DynCom_Execute);
3585 3585
3586 int breakpoint_offset = -1; 3586 GDBStub::BreakpointAddress breakpoint_data;
3587 3587
3588 #undef RM 3588 #undef RM
3589 #undef RS 3589 #undef RS
@@ -3613,7 +3613,7 @@ unsigned InterpreterMainLoop(ARMul_State* cpu) {
3613 cpu->Cpsr &= ~(1 << 5); \ 3613 cpu->Cpsr &= ~(1 << 5); \
3614 cpu->Cpsr |= cpu->TFlag << 5; \ 3614 cpu->Cpsr |= cpu->TFlag << 5; \
3615 if (GDBStub::g_server_enabled) { \ 3615 if (GDBStub::g_server_enabled) { \
3616 if (GDBStub::IsMemoryBreak() || PC == breakpoint_offset) { \ 3616 if (GDBStub::IsMemoryBreak() || (breakpoint_data.type != GDBStub::BreakpointType::None && PC == breakpoint_data.address)) { \
3617 GDBStub::Break(); \ 3617 GDBStub::Break(); \
3618 goto END; \ 3618 goto END; \
3619 } \ 3619 } \
@@ -3923,7 +3923,7 @@ unsigned InterpreterMainLoop(ARMul_State* cpu) {
3923 3923
3924 // Find breakpoint if one exists within the block 3924 // Find breakpoint if one exists within the block
3925 if (GDBStub::g_server_enabled && GDBStub::IsConnected()) { 3925 if (GDBStub::g_server_enabled && GDBStub::IsConnected()) {
3926 breakpoint_offset = GDBStub::GetNextBreakpointFromAddress(cpu->Reg[15], GDBStub::BreakpointType::Execute); 3926 breakpoint_data = GDBStub::GetNextBreakpointFromAddress(cpu->Reg[15], GDBStub::BreakpointType::Execute);
3927 } 3927 }
3928 3928
3929 inst_base = (arm_inst *)&inst_buf[ptr]; 3929 inst_base = (arm_inst *)&inst_buf[ptr];
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.