summaryrefslogtreecommitdiffstats
path: root/ArmPkg/Library/DefaultExceptionHandlerLib
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2016-09-07 09:12:29 +0100
committerArd Biesheuvel <ard.biesheuvel@linaro.org>2016-09-07 17:22:39 +0100
commit960d0de80b288c7cd9cbccfde7a12a48935055b4 (patch)
tree9e319ab954525417d6cb16f119ed14bf8381196a /ArmPkg/Library/DefaultExceptionHandlerLib
parent8f0b62a5dac0830698d6cf4b1c25ce2612f93dd8 (diff)
downloadedk2-960d0de80b288c7cd9cbccfde7a12a48935055b4.tar.gz
edk2-960d0de80b288c7cd9cbccfde7a12a48935055b4.tar.bz2
edk2-960d0de80b288c7cd9cbccfde7a12a48935055b4.zip
ArmPkg/DefaultExceptionHandlerLib AARCH64: add minimal backtrace to crash dump
When dumping the CPU state after an unhandled fault, walk the stack frames and decode the return addresses so we can show a minimal backtrace. Unfortunately, we do not have sufficient information to show the function names, but at least we can see the modules and the return addresses inside the modules. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org> Tested-by: Leif Lindholm <leif.lindholm@linaro.org>
Diffstat (limited to 'ArmPkg/Library/DefaultExceptionHandlerLib')
-rw-r--r--ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c b/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c
index 31fc936b21..84b442f2b6 100644
--- a/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c
+++ b/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c
@@ -152,9 +152,30 @@ DefaultExceptionHandler (
CHAR8 *Pdb;
UINTN ImageBase;
UINTN PeCoffSizeOfHeader;
+ UINT64 *Fp;
+
Pdb = GetImageName (SystemContext.SystemContextAArch64->ELR, &ImageBase, &PeCoffSizeOfHeader);
if (Pdb != NULL) {
DEBUG ((EFI_D_ERROR, "%a loaded at 0x%016lx \n", Pdb, ImageBase));
+
+ Pdb = GetImageName (SystemContext.SystemContextAArch64->LR, &ImageBase,
+ &PeCoffSizeOfHeader);
+ if (Pdb != NULL) {
+ DEBUG ((EFI_D_ERROR, "called from %a (0x%016lx) loaded at 0x%016lx \n",
+ Pdb, SystemContext.SystemContextAArch64->LR, ImageBase));
+ }
+ for (Fp = (UINT64 *)SystemContext.SystemContextAArch64->FP;
+ *Fp != 0;
+ Fp = (UINT64 *)Fp[0]) {
+ if (Fp[1] == SystemContext.SystemContextAArch64->LR) {
+ continue;
+ }
+ Pdb = GetImageName (Fp[1], &ImageBase, &PeCoffSizeOfHeader);
+ if (Pdb != NULL) {
+ DEBUG ((EFI_D_ERROR, "called from %a (0x%016lx) loaded at 0x%016lx \n",
+ Pdb, Fp[1], ImageBase));
+ }
+ }
}
DEBUG_CODE_END ();