mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
change stack shown in ppc debugger to show LR as the last item, as well as make all values point to where the code path came from, instead of the raw stack (where it will return to)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4427 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -46,6 +46,9 @@ void AddAutoBreakpoints()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns callstack "formatted for debugging" - meaning that it
|
||||||
|
// includes LR as the last item, and all items are the last step,
|
||||||
|
// instead of "pointing ahead"
|
||||||
bool GetCallstack(std::vector<CallstackEntry> &output)
|
bool GetCallstack(std::vector<CallstackEntry> &output)
|
||||||
{
|
{
|
||||||
if (Core::GetState() == Core::CORE_UNINITIALIZED)
|
if (Core::GetState() == Core::CORE_UNINITIALIZED)
|
||||||
@ -55,22 +58,23 @@ bool GetCallstack(std::vector<CallstackEntry> &output)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
u32 addr = Memory::ReadUnchecked_U32(PowerPC::ppcState.gpr[1]); // SP
|
u32 addr = Memory::ReadUnchecked_U32(PowerPC::ppcState.gpr[1]); // SP
|
||||||
if (LR == 0) {
|
if (LR == 0)
|
||||||
|
{
|
||||||
CallstackEntry entry;
|
CallstackEntry entry;
|
||||||
entry.Name = "(error: LR=0)";
|
entry.Name = "(error: LR=0)";
|
||||||
entry.vAddress = 0x0;
|
entry.vAddress = 0x0;
|
||||||
output.push_back(entry);
|
output.push_back(entry);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int count = 1;
|
int count = 1;
|
||||||
if (g_symbolDB.GetDescription(PowerPC::ppcState.pc) != g_symbolDB.GetDescription(LR))
|
|
||||||
{
|
CallstackEntry entry;
|
||||||
CallstackEntry entry;
|
entry.Name = StringFromFormat(" * %s [ LR = %08x ]\n", g_symbolDB.GetDescription(LR), LR - 4);
|
||||||
entry.Name = StringFromFormat(" * %s [ LR = %08x ]\n", g_symbolDB.GetDescription(LR), LR);
|
entry.vAddress = LR - 4;
|
||||||
entry.vAddress = 0x0;
|
output.push_back(entry);
|
||||||
count++;
|
count++;
|
||||||
}
|
|
||||||
|
|
||||||
//walk the stack chain
|
//walk the stack chain
|
||||||
while ((addr != 0xFFFFFFFF) && (addr != 0) && (count++ < 20) && (PowerPC::ppcState.gpr[1] != 0))
|
while ((addr != 0xFFFFFFFF) && (addr != 0) && (count++ < 20) && (PowerPC::ppcState.gpr[1] != 0))
|
||||||
{
|
{
|
||||||
@ -83,13 +87,13 @@ bool GetCallstack(std::vector<CallstackEntry> &output)
|
|||||||
str = "(unknown)";
|
str = "(unknown)";
|
||||||
|
|
||||||
CallstackEntry entry;
|
CallstackEntry entry;
|
||||||
entry.Name = StringFromFormat(" * %s [ addr = %08x ]\n", str, func);
|
entry.Name = StringFromFormat(" * %s [ addr = %08x ]\n", str, func - 4);
|
||||||
entry.vAddress = func;
|
entry.vAddress = func - 4;
|
||||||
output.push_back(entry);
|
output.push_back(entry);
|
||||||
|
|
||||||
if (!Memory::IsRAMAddress(addr))
|
if (!Memory::IsRAMAddress(addr))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
addr = Memory::ReadUnchecked_U32(addr);
|
addr = Memory::ReadUnchecked_U32(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -393,18 +393,16 @@ void CCodeWindow::UpdateCallstack()
|
|||||||
|
|
||||||
std::vector<Dolphin_Debugger::CallstackEntry> stack;
|
std::vector<Dolphin_Debugger::CallstackEntry> stack;
|
||||||
|
|
||||||
if (Dolphin_Debugger::GetCallstack(stack))
|
bool ret = Dolphin_Debugger::GetCallstack(stack);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < stack.size(); i++)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < stack.size(); i++)
|
int idx = callstack->Append(wxString::FromAscii(stack[i].Name.c_str()));
|
||||||
{
|
callstack->SetClientData(idx, (void*)(u64)stack[i].vAddress);
|
||||||
int idx = callstack->Append(wxString::FromAscii(stack[i].Name.c_str()));
|
|
||||||
callstack->SetClientData(idx, (void*)(u64)stack[i].vAddress);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
if (!ret)
|
||||||
callstack->Append(wxString::FromAscii("invalid callstack"));
|
callstack->Append(wxString::FromAscii("invalid callstack"));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStartupParameter)
|
void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStartupParameter)
|
||||||
|
Reference in New Issue
Block a user