mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-21 12:44:50 +02:00
ArmPkg/DefaultExceptionHandlerLib: walk call stack unconditionally
Currently, we only attempt to walk the call stack and print a backtrace if the program counter refers to a location covered by a PE/COFF image. However, regardless of the value of PC, the frame pointer may still have a meaningful value, and so we can still produce the remainder of the backtrace. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
This commit is contained in:
parent
b8fc72bd7d
commit
173bf5c847
@ -181,37 +181,43 @@ DefaultExceptionHandler (
|
|||||||
DEBUG ((EFI_D_ERROR, "PC 0x%012lx (0x%012lx+0x%08x) [ 0] %a\n",
|
DEBUG ((EFI_D_ERROR, "PC 0x%012lx (0x%012lx+0x%08x) [ 0] %a\n",
|
||||||
SystemContext.SystemContextAArch64->ELR, ImageBase,
|
SystemContext.SystemContextAArch64->ELR, ImageBase,
|
||||||
SystemContext.SystemContextAArch64->ELR - ImageBase, BaseName (Pdb)));
|
SystemContext.SystemContextAArch64->ELR - ImageBase, BaseName (Pdb)));
|
||||||
|
} else {
|
||||||
|
DEBUG ((EFI_D_ERROR, "PC 0x%012lx\n", SystemContext.SystemContextAArch64->ELR));
|
||||||
|
}
|
||||||
|
|
||||||
if ((UINT64 *)SystemContext.SystemContextAArch64->FP != 0) {
|
if ((UINT64 *)SystemContext.SystemContextAArch64->FP != 0) {
|
||||||
Idx = 0;
|
Idx = 0;
|
||||||
|
|
||||||
RootFp[0] = ((UINT64 *)SystemContext.SystemContextAArch64->FP)[0];
|
RootFp[0] = ((UINT64 *)SystemContext.SystemContextAArch64->FP)[0];
|
||||||
RootFp[1] = ((UINT64 *)SystemContext.SystemContextAArch64->FP)[1];
|
RootFp[1] = ((UINT64 *)SystemContext.SystemContextAArch64->FP)[1];
|
||||||
if (RootFp[1] != SystemContext.SystemContextAArch64->LR) {
|
if (RootFp[1] != SystemContext.SystemContextAArch64->LR) {
|
||||||
RootFp[0] = SystemContext.SystemContextAArch64->FP;
|
RootFp[0] = SystemContext.SystemContextAArch64->FP;
|
||||||
RootFp[1] = SystemContext.SystemContextAArch64->LR;
|
RootFp[1] = SystemContext.SystemContextAArch64->LR;
|
||||||
}
|
}
|
||||||
for (Fp = RootFp; Fp[0] != 0; Fp = (UINT64 *)Fp[0]) {
|
for (Fp = RootFp; Fp[0] != 0; Fp = (UINT64 *)Fp[0]) {
|
||||||
Pdb = GetImageName (Fp[1], &ImageBase, &PeCoffSizeOfHeader);
|
Pdb = GetImageName (Fp[1], &ImageBase, &PeCoffSizeOfHeader);
|
||||||
if (Pdb != NULL) {
|
if (Pdb != NULL) {
|
||||||
if (Pdb != PrevPdb) {
|
if (Pdb != PrevPdb) {
|
||||||
Idx++;
|
Idx++;
|
||||||
PrevPdb = Pdb;
|
|
||||||
}
|
|
||||||
DEBUG ((EFI_D_ERROR, "PC 0x%012lx (0x%012lx+0x%08x) [% 2d] %a\n",
|
|
||||||
Fp[1], ImageBase, Fp[1] - ImageBase, Idx, BaseName (Pdb)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PrevPdb = Pdb = GetImageName (SystemContext.SystemContextAArch64->ELR, &ImageBase, &PeCoffSizeOfHeader);
|
|
||||||
DEBUG ((EFI_D_ERROR, "\n[ 0] %a\n", Pdb));
|
|
||||||
|
|
||||||
Idx = 0;
|
|
||||||
for (Fp = RootFp; Fp[0] != 0; Fp = (UINT64 *)Fp[0]) {
|
|
||||||
Pdb = GetImageName (Fp[1], &ImageBase, &PeCoffSizeOfHeader);
|
|
||||||
if (Pdb != NULL && Pdb != PrevPdb) {
|
|
||||||
DEBUG ((EFI_D_ERROR, "[% 2d] %a\n", ++Idx, Pdb));
|
|
||||||
PrevPdb = Pdb;
|
PrevPdb = Pdb;
|
||||||
}
|
}
|
||||||
|
DEBUG ((EFI_D_ERROR, "PC 0x%012lx (0x%012lx+0x%08x) [% 2d] %a\n",
|
||||||
|
Fp[1], ImageBase, Fp[1] - ImageBase, Idx, BaseName (Pdb)));
|
||||||
|
} else {
|
||||||
|
DEBUG ((EFI_D_ERROR, "PC 0x%012lx\n", Fp[1]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PrevPdb = Pdb = GetImageName (SystemContext.SystemContextAArch64->ELR, &ImageBase, &PeCoffSizeOfHeader);
|
||||||
|
if (Pdb != NULL) {
|
||||||
|
DEBUG ((EFI_D_ERROR, "\n[ 0] %a\n", Pdb));
|
||||||
|
}
|
||||||
|
|
||||||
|
Idx = 0;
|
||||||
|
for (Fp = RootFp; Fp[0] != 0; Fp = (UINT64 *)Fp[0]) {
|
||||||
|
Pdb = GetImageName (Fp[1], &ImageBase, &PeCoffSizeOfHeader);
|
||||||
|
if (Pdb != NULL && Pdb != PrevPdb) {
|
||||||
|
DEBUG ((EFI_D_ERROR, "[% 2d] %a\n", ++Idx, Pdb));
|
||||||
|
PrevPdb = Pdb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user