| 112 | } |
| 113 | |
| 114 | std::optional<u32> DebugInterface::getStackFrameSize(const ccc::Function& function) |
| 115 | { |
| 116 | s32 stack_frame_size = function.stack_frame_size; |
| 117 | |
| 118 | if (stack_frame_size < 0) |
| 119 | { |
| 120 | // The stack frame size isn't stored in the symbol table, so we try |
| 121 | // to extract it from the code by checking for an instruction at the |
| 122 | // start of the current function that is in the form of |
| 123 | // "addiu $sp, $sp, frame_size" instead. |
| 124 | |
| 125 | u32 instruction = Read32(function.address().value); |
| 126 | |
| 127 | if ((instruction & 0xffff0000) == 0x27bd0000) |
| 128 | stack_frame_size = -static_cast<s16>(instruction & 0xffff); |
| 129 | |
| 130 | if (stack_frame_size < 0) |
| 131 | return std::nullopt; |
| 132 | } |
| 133 | |
| 134 | return static_cast<u32>(stack_frame_size); |
| 135 | } |
| 136 | |
| 137 | bool DebugInterface::evaluateExpression(const char* expression, u64& dest, std::string& error) |
| 138 | { |