From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-x22b.google.com (mail-wm0-x22b.google.com [IPv6:2a00:1450:400c:c09::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 45F301A1E90 for ; Wed, 7 Sep 2016 01:22:09 -0700 (PDT) Received: by mail-wm0-x22b.google.com with SMTP id b187so102587229wme.1 for ; Wed, 07 Sep 2016 01:22:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hOS/ssqJFVtulD+qgrFkokSQDzGFmdTZld1yG+H9I0s=; b=BXZDtCFu0TgfCZMLJwk5307c11+z1vrlLyGsWNkI8C8jAKMXUmYXK1TtUKy9tuyFVS YoQnAnXFCaXAVJoyOg9XklZ2cU0HWNWfBPKOCzNUNi+f4etXvcHQI3lW2PZmQGEopqFx QWMN9daEDu+JFaI8CNR/ojl8IAuZZC7gCpgP8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hOS/ssqJFVtulD+qgrFkokSQDzGFmdTZld1yG+H9I0s=; b=KYWMJfTQHbdWyr6ODIDzuQcmnoShHJttsGxbOwuo+4HGIQ1ueRe30tdQuNzK1FbgSV pBhSfdBrBpITrtUINCJPJ/pK9yP71TOB90eg+4dv65YOa5Zh+T9u+sZ3xI8qVk6t1IJv K1G3dH4IH+5GQnVT+F5XSIUwwQIuYgQ4wjelyvep4dt9T/qNng/pQqghPM9roVfTm7l6 6vAFWv2wq8bhsGTNmhKXvLB2kIrlo6EO2GhBumFP8jOFW6lApulvuEn9Qgg4xdGcOxmc 4QMCn2erf7MHJT9JCmGC3Lg9C4VCl1bFkgOlUj8EdR/WPaDMAOIaDOKmUAKe42xWvfV9 ZcCA== X-Gm-Message-State: AE9vXwOeTMH1z8PCifh/UGnT/IS4J99hyUodHDsB34kjfJ2h8gy+2WyU1EV45Bs64s62d6zU X-Received: by 10.28.129.145 with SMTP id c139mr2666685wmd.102.1473236527664; Wed, 07 Sep 2016 01:22:07 -0700 (PDT) Received: from localhost.localdomain ([197.130.133.164]) by smtp.gmail.com with ESMTPSA id g62sm2924875wme.18.2016.09.07.01.22.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Sep 2016 01:22:06 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org Cc: Ard Biesheuvel Date: Wed, 7 Sep 2016 09:21:55 +0100 Message-Id: <1473236515-8318-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1473236515-8318-1-git-send-email-ard.biesheuvel@linaro.org> References: <1473236515-8318-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [PATCH 2/2] ArmPkg/DefaultExceptionHandlerLib AARCH64: add minimal backtrace to crash dump X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Sep 2016 08:22:09 -0000 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 --- Example output: Synchronous Exception at 0x00000000F5EA4C8C /home/ard/build/edk2/Build/ArmVExpress-FVP-AArch64/DEBUG_GCC5/AARCH64/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe/DEBUG/ArmVeNorFlashDxe.dll loaded at 0x00000000F5E90000 called from /home/ard/build/edk2/Build/ArmVExpress-FVP-AArch64/DEBUG_GCC5/AARCH64/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe/DEBUG/ArmVeNorFlashDxe.dll (0x00000000F5EA4AE8) loaded at 0x00000000F5E90000 called from /home/ard/build/edk2/Build/ArmVExpress-FVP-AArch64/DEBUG_GCC5/AARCH64/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe/DEBUG/ArmVeNorFlashDxe.dll (0x00000000F5EA1BFC) loaded at 0x00000000F5E90000 called from /home/ard/build/edk2/Build/ArmVExpress-FVP-AArch64/DEBUG_GCC5/AARCH64/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe/DEBUG/ArmVeNorFlashDxe.dll (0x00000000F5EA23F4) loaded at 0x00000000F5E90000 called from /work/jenkins/workspace/ap-uefi-bin/EDK2_ARCH/ARM/EDK2_BINARY/FatPkg/label/sas-sw/Build/Fat/RELEASE_GCC49/AARCH64/FatPkg/EnhancedFatDxe/Fat/DEBUG/Fat.dll (0x00000000FADC454C) loaded at 0x00000000FADC3000 called from /home/ard/build/edk2/Build/ArmVExpress-FVP-AArch64/DEBUG_GCC5/AARCH64/MdeModulePkg/Core/Dxe/DxeMain/DEBUG/DxeCore.dll (0x00000000FE47C868) loaded at 0x00000000FE471000 called from /home/ard/build/edk2/Build/ArmVExpress-FVP-AArch64/DEBUG_GCC5/AARCH64/IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe/DEBUG/BdsDxe.dll (0x00000000FAE2C50C) loaded at 0x00000000FAE01000 called from /home/ard/build/edk2/Build/ArmVExpress-FVP-AArch64/DEBUG_GCC5/AARCH64/IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe/DEBUG/BdsDxe.dll (0x00000000FAE2C674) loaded at 0x00000000FAE01000 called from /home/ard/build/edk2/Build/ArmVExpress-FVP-AArch64/DEBUG_GCC5/AARCH64/IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe/DEBUG/BdsDxe.dll (0x00000000FAE2C264) loaded at 0x00000000FAE01000 called from /home/ard/build/edk2/Build/ArmVExpress-FVP-AArch64/DEBUG_GCC5/AARCH64/IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe/DEBUG/BdsDxe.dll (0x00000000FAE36998) loaded at 0x00000000FAE01000 called from /home/ard/build/edk2/Build/ArmVExpress-FVP-AArch64/DEBUG_GCC5/AARCH64/IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe/DEBUG/BdsDxe.dll (0x00000000FAE03668) loaded at 0x00000000FAE01000 called from /home/ard/build/edk2/Build/ArmVExpress-FVP-AArch64/DEBUG_GCC5/AARCH64/MdeModulePkg/Core/Dxe/DxeMain/DEBUG/DxeCore.dll (0x00000000FE4733F0) loaded at 0x00000000FE471000 called from /home/ard/build/edk2/Build/ArmVExpress-FVP-AArch64/DEBUG_GCC5/AARCH64/MdeModulePkg/Core/Dxe/DxeMain/DEBUG/DxeCore.dll (0x00000000FE4724A0) loaded at 0x00000000FE471000 called from /home/ard/build/edk2/Build/ArmVExpress-FVP-AArch64/DEBUG_GCC5/AARCH64/MdeModulePkg/Core/Dxe/DxeMain/DEBUG/DxeCore.dll (0x00000000FE472024) loaded at 0x00000000FE471000 --- .../AArch64/DefaultExceptionHandler.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c b/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c index 31fc936b21ff..84b442f2b6f4 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 (); -- 2.7.4