summaryrefslogtreecommitdiff
path: root/src/core/gdbstub/gdbstub.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/gdbstub/gdbstub.cpp')
-rw-r--r--src/core/gdbstub/gdbstub.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/core/gdbstub/gdbstub.cpp b/src/core/gdbstub/gdbstub.cpp
index 05c872d89..2f3ccb689 100644
--- a/src/core/gdbstub/gdbstub.cpp
+++ b/src/core/gdbstub/gdbstub.cpp
@@ -183,11 +183,11 @@ static u8 NibbleToHex(u8 n) {
183} 183}
184 184
185/** 185/**
186* Converts input hex string characters into an array of equivalent of u8 bytes. 186 * Converts input hex string characters into an array of equivalent of u8 bytes.
187* 187 *
188* @param src Pointer to array of output hex string characters. 188 * @param src Pointer to array of output hex string characters.
189* @param len Length of src array. 189 * @param len Length of src array.
190*/ 190 */
191static u32 HexToInt(const u8* src, size_t len) { 191static u32 HexToInt(const u8* src, size_t len) {
192 u32 output = 0; 192 u32 output = 0;
193 while (len-- > 0) { 193 while (len-- > 0) {
@@ -299,17 +299,17 @@ static std::map<u32, Breakpoint>& GetBreakpointList(BreakpointType type) {
299static void RemoveBreakpoint(BreakpointType type, PAddr addr) { 299static void RemoveBreakpoint(BreakpointType type, PAddr addr) {
300 std::map<u32, Breakpoint>& p = GetBreakpointList(type); 300 std::map<u32, Breakpoint>& p = GetBreakpointList(type);
301 301
302 auto bp = p.find(addr); 302 auto bp = p.find(static_cast<u32>(addr));
303 if (bp != p.end()) { 303 if (bp != p.end()) {
304 LOG_DEBUG(Debug_GDBStub, "gdb: removed a breakpoint: %08x bytes at %08x of type %d\n", 304 LOG_DEBUG(Debug_GDBStub, "gdb: removed a breakpoint: %08x bytes at %08x of type %d\n",
305 bp->second.len, bp->second.addr, type); 305 bp->second.len, bp->second.addr, type);
306 p.erase(addr); 306 p.erase(static_cast<u32>(addr));
307 } 307 }
308} 308}
309 309
310BreakpointAddress GetNextBreakpointFromAddress(PAddr addr, BreakpointType type) { 310BreakpointAddress GetNextBreakpointFromAddress(PAddr addr, BreakpointType type) {
311 std::map<u32, Breakpoint>& p = GetBreakpointList(type); 311 std::map<u32, Breakpoint>& p = GetBreakpointList(type);
312 auto next_breakpoint = p.lower_bound(addr); 312 auto next_breakpoint = p.lower_bound(static_cast<u32>(addr));
313 BreakpointAddress breakpoint; 313 BreakpointAddress breakpoint;
314 314
315 if (next_breakpoint != p.end()) { 315 if (next_breakpoint != p.end()) {
@@ -330,7 +330,7 @@ bool CheckBreakpoint(PAddr addr, BreakpointType type) {
330 330
331 std::map<u32, Breakpoint>& p = GetBreakpointList(type); 331 std::map<u32, Breakpoint>& p = GetBreakpointList(type);
332 332
333 auto bp = p.find(addr); 333 auto bp = p.find(static_cast<u32>(addr));
334 if (bp != p.end()) { 334 if (bp != p.end()) {
335 u32 len = bp->second.len; 335 u32 len = bp->second.len;
336 336
@@ -452,7 +452,8 @@ static void SendSignal(u32 signal) {
452 452
453 std::string buffer = 453 std::string buffer =
454 Common::StringFromFormat("T%02x%02x:%08x;%02x:%08x;", latest_signal, 15, 454 Common::StringFromFormat("T%02x%02x:%08x;%02x:%08x;", latest_signal, 15,
455 htonl(Core::CPU().GetPC()), 13, htonl(Core::CPU().GetReg(13))); 455 htonl(static_cast<u_long>(Core::CPU().GetPC())), 13,
456 htonl(static_cast<u_long>(Core::CPU().GetReg(13))));
456 LOG_DEBUG(Debug_GDBStub, "Response: %s", buffer.c_str()); 457 LOG_DEBUG(Debug_GDBStub, "Response: %s", buffer.c_str());
457 SendReply(buffer.c_str()); 458 SendReply(buffer.c_str());
458} 459}
@@ -539,7 +540,7 @@ static void ReadRegister() {
539 } 540 }
540 541
541 if (id <= R15_REGISTER) { 542 if (id <= R15_REGISTER) {
542 IntToGdbHex(reply, Core::CPU().GetReg(id)); 543 IntToGdbHex(reply, static_cast<u32>(Core::CPU().GetReg(static_cast<u64>(id))));
543 } else if (id == CPSR_REGISTER) { 544 } else if (id == CPSR_REGISTER) {
544 IntToGdbHex(reply, Core::CPU().GetCPSR()); 545 IntToGdbHex(reply, Core::CPU().GetCPSR());
545 } else if (id > CPSR_REGISTER && id < FPSCR_REGISTER) { 546 } else if (id > CPSR_REGISTER && id < FPSCR_REGISTER) {
@@ -563,7 +564,7 @@ static void ReadRegisters() {
563 u8* bufptr = buffer; 564 u8* bufptr = buffer;
564 565
565 for (int reg = 0; reg <= R15_REGISTER; reg++) { 566 for (int reg = 0; reg <= R15_REGISTER; reg++) {
566 IntToGdbHex(bufptr + reg * CHAR_BIT, Core::CPU().GetReg(reg)); 567 IntToGdbHex(bufptr + reg * CHAR_BIT, static_cast<u32>(Core::CPU().GetReg(reg)));
567 } 568 }
568 569
569 bufptr += (16 * CHAR_BIT); 570 bufptr += (16 * CHAR_BIT);
@@ -1034,4 +1035,4 @@ bool GetCpuStepFlag() {
1034void SetCpuStepFlag(bool is_step) { 1035void SetCpuStepFlag(bool is_step) {
1035 step_loop = is_step; 1036 step_loop = is_step;
1036} 1037}
1037}; 1038}; // namespace GDBStub