mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 00:45:24 +00:00
[NTOS:KDBG] Improve x64 stack trace printing
This commit is contained in:
parent
090ccb3d8e
commit
74014e74c0
1 changed files with 9 additions and 23 deletions
|
@ -1211,44 +1211,30 @@ KdbpCmdBackTrace(
|
||||||
PCHAR Argv[])
|
PCHAR Argv[])
|
||||||
{
|
{
|
||||||
CONTEXT Context = *KdbCurrentTrapFrame;
|
CONTEXT Context = *KdbCurrentTrapFrame;
|
||||||
ULONG64 CurrentRsp, CurrentRip;
|
|
||||||
|
|
||||||
KdbpPrint("Rip:\n");
|
|
||||||
if (!KdbSymPrintAddress((PVOID)KeGetContextPc(&Context), &Context))
|
|
||||||
KdbpPrint("<%p>\n", KeGetContextPc(&Context));
|
|
||||||
else
|
|
||||||
KdbpPrint("\n");
|
|
||||||
|
|
||||||
/* Walk through the frames */
|
/* Walk through the frames */
|
||||||
KdbpPrint("Frames:\n");
|
KdbpPrint("Frames:\n");
|
||||||
for (;;)
|
do
|
||||||
{
|
{
|
||||||
CurrentRip = Context.Rip;
|
BOOLEAN GotNextFrame;
|
||||||
CurrentRsp = Context.Rsp;
|
|
||||||
|
|
||||||
BOOLEAN GotNextFrame = GetNextFrame(&Context);
|
KdbpPrint("[%p] ", (PVOID)Context.Rsp);
|
||||||
|
|
||||||
KdbpPrint("[%p] ", (PVOID)CurrentRsp);
|
/* Print the location after the call instruction */
|
||||||
Context.Rsp = Context.Rsp;
|
if (!KdbSymPrintAddress((PVOID)Context.Rip, &Context))
|
||||||
|
|
||||||
/* Print the location afrer the call instruction */
|
|
||||||
if (!KdbSymPrintAddress((PVOID)CurrentRip, &Context))
|
|
||||||
KdbpPrint("<%p>", (PVOID)Context.Rip);
|
KdbpPrint("<%p>", (PVOID)Context.Rip);
|
||||||
|
KdbpPrint("\n");
|
||||||
KdbpPrint(" (stack: 0x%Ix)\n", Context.Rsp - CurrentRsp);
|
|
||||||
|
|
||||||
if (KdbOutputAborted)
|
if (KdbOutputAborted)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (Context.Rsp == 0)
|
GotNextFrame = GetNextFrame(&Context);
|
||||||
break;
|
|
||||||
|
|
||||||
if (!GotNextFrame)
|
if (!GotNextFrame)
|
||||||
{
|
{
|
||||||
KdbpPrint("Couldn't access memory at 0x%p!\n", (PVOID)Context.Rsp);
|
KdbpPrint("Couldn't get next frame\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
} while ((Context.Rip != 0) && (Context.Rsp != 0));
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue