Debugger fixups (#9226)

Fix logic error in callstacks handling code, always set first to false after first iteration.
 Add explicit check for zero return addresses. Current code validity checks may not check for it properly when it sits on interrupt handler entry point (which may contain valid code).
 Do not allow 0x3FFF0 to be a back chain address because it needs space for LR save area, only 0x3FFE0 and below satisfy this criteria.
This commit is contained in:
Eladash 2020-11-08 15:42:20 +02:00 committed by GitHub
parent 5265eb81e0
commit bacfa9be19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View file

@ -584,7 +584,7 @@ std::vector<std::pair<u32, u32>> ppu_thread::dump_callstack_list() const
for (
u64 sp = r1;
sp % 0x10 == 0u && sp >= stack_min && sp <= stack_max - ppu_stack_start_offset;
sp = *vm::get_super_ptr<u64>(static_cast<u32>(sp))
sp = *vm::get_super_ptr<u64>(static_cast<u32>(sp)), first = false
)
{
u64 addr = *vm::get_super_ptr<u64>(static_cast<u32>(sp + 16));
@ -602,7 +602,7 @@ std::vector<std::pair<u32, u32>> ppu_thread::dump_callstack_list() const
if (is_invalid(addr))
{
if (std::exchange(first, false))
if (first)
{
// Function hasn't saved LR, could be because it's a leaf function
// Use LR directly instead