mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-03-13 19:19:03 +00: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:
parent
8e44891b3a
commit
a05fbd8525
@ -46,6 +46,9 @@ void AddAutoBreakpoints()
|
||||
#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)
|
||||
{
|
||||
if (Core::GetState() == Core::CORE_UNINITIALIZED)
|
||||
@ -55,22 +58,23 @@ bool GetCallstack(std::vector<CallstackEntry> &output)
|
||||
return false;
|
||||
|
||||
u32 addr = Memory::ReadUnchecked_U32(PowerPC::ppcState.gpr[1]); // SP
|
||||
if (LR == 0) {
|
||||
if (LR == 0)
|
||||
{
|
||||
CallstackEntry entry;
|
||||
entry.Name = "(error: LR=0)";
|
||||
entry.vAddress = 0x0;
|
||||
output.push_back(entry);
|
||||
return false;
|
||||
}
|
||||
|
||||
int count = 1;
|
||||
if (g_symbolDB.GetDescription(PowerPC::ppcState.pc) != g_symbolDB.GetDescription(LR))
|
||||
{
|
||||
CallstackEntry entry;
|
||||
entry.Name = StringFromFormat(" * %s [ LR = %08x ]\n", g_symbolDB.GetDescription(LR), LR);
|
||||
entry.vAddress = 0x0;
|
||||
count++;
|
||||
}
|
||||
|
||||
|
||||
CallstackEntry entry;
|
||||
entry.Name = StringFromFormat(" * %s [ LR = %08x ]\n", g_symbolDB.GetDescription(LR), LR - 4);
|
||||
entry.vAddress = LR - 4;
|
||||
output.push_back(entry);
|
||||
count++;
|
||||
|
||||
//walk the stack chain
|
||||
while ((addr != 0xFFFFFFFF) && (addr != 0) && (count++ < 20) && (PowerPC::ppcState.gpr[1] != 0))
|
||||
{
|
||||
@ -83,13 +87,13 @@ bool GetCallstack(std::vector<CallstackEntry> &output)
|
||||
str = "(unknown)";
|
||||
|
||||
CallstackEntry entry;
|
||||
entry.Name = StringFromFormat(" * %s [ addr = %08x ]\n", str, func);
|
||||
entry.vAddress = func;
|
||||
entry.Name = StringFromFormat(" * %s [ addr = %08x ]\n", str, func - 4);
|
||||
entry.vAddress = func - 4;
|
||||
output.push_back(entry);
|
||||
|
||||
if (!Memory::IsRAMAddress(addr))
|
||||
return false;
|
||||
|
||||
|
||||
addr = Memory::ReadUnchecked_U32(addr);
|
||||
}
|
||||
|
||||
|
@ -393,18 +393,16 @@ void CCodeWindow::UpdateCallstack()
|
||||
|
||||
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"));
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStartupParameter)
|
||||
|
Loading…
x
Reference in New Issue
Block a user