diff options
| author | 2018-01-19 18:01:41 -0500 | |
|---|---|---|
| committer | 2018-01-19 18:01:41 -0500 | |
| commit | dd62f125c359b37d71be6ccf873177c1a108d015 (patch) | |
| tree | 0d543402a25f4ba701dc547808b289daa0fc325b /src/core/gdbstub/gdbstub.cpp | |
| parent | Merge pull request #112 from Rozelette/master (diff) | |
| download | yuzu-dd62f125c359b37d71be6ccf873177c1a108d015.tar.gz yuzu-dd62f125c359b37d71be6ccf873177c1a108d015.tar.xz yuzu-dd62f125c359b37d71be6ccf873177c1a108d015.zip | |
Fixes some cast warnings, partial port of citra #3064 (#106)
* Fixes some cast warnings, partially fixes citra #3064
* Converted casts to uint32_t to u32
* Ran clang-format
Diffstat (limited to 'src/core/gdbstub/gdbstub.cpp')
| -rw-r--r-- | src/core/gdbstub/gdbstub.cpp | 27 |
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 | */ |
| 191 | static u32 HexToInt(const u8* src, size_t len) { | 191 | static 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) { | |||
| 299 | static void RemoveBreakpoint(BreakpointType type, PAddr addr) { | 299 | static 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 | ||
| 310 | BreakpointAddress GetNextBreakpointFromAddress(PAddr addr, BreakpointType type) { | 310 | BreakpointAddress 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() { | |||
| 1034 | void SetCpuStepFlag(bool is_step) { | 1035 | void SetCpuStepFlag(bool is_step) { |
| 1035 | step_loop = is_step; | 1036 | step_loop = is_step; |
| 1036 | } | 1037 | } |
| 1037 | }; | 1038 | }; // namespace GDBStub |