| 64 | } |
| 65 | |
| 66 | char* DebugInterface::stringFromPointer(u32 p) |
| 67 | { |
| 68 | const int BUFFER_LEN = 64; |
| 69 | static char buf[BUFFER_LEN] = {0}; |
| 70 | |
| 71 | if (!isValidAddress(p)) |
| 72 | return NULL; |
| 73 | |
| 74 | // This is going to blow up if it hits a TLB miss.. |
| 75 | // Hopefully the checks in isValidAddress() are sufficient. |
| 76 | for (u32 i = 0; i < BUFFER_LEN; i++) |
| 77 | { |
| 78 | char c = Read8(p + i); |
| 79 | buf[i] = c; |
| 80 | |
| 81 | if (c == 0) |
| 82 | { |
| 83 | return i > 0 ? buf : NULL; |
| 84 | } |
| 85 | else if (c < 0x20 || c >= 0x7f) |
| 86 | { |
| 87 | // non printable character |
| 88 | return NULL; |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | buf[BUFFER_LEN - 1] = 0; |
| 93 | buf[BUFFER_LEN - 2] = '~'; |
| 94 | return buf; |
| 95 | } |
| 96 | |
| 97 | std::optional<u32> DebugInterface::getCallerStackPointer(const ccc::Function& currentFunction) |
| 98 | { |
no outgoing calls
no test coverage detected