From: Andrew Fish <afish@apple.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: edk2-devel@lists.01.org, leif.lindholm@linaro.org
Subject: Re: [PATCH 2/2] ArmPkg/DefaultExceptionHandlerLib AARCH64: add minimal backtrace to crash dump
Date: Fri, 09 Sep 2016 09:03:55 -0700 [thread overview]
Message-ID: <EE5FB45E-BF82-4782-B17A-2FB1FB3032EB@apple.com> (raw)
In-Reply-To: <1473236515-8318-2-git-send-email-ard.biesheuvel@linaro.org>
> On Sep 7, 2016, at 1:21 AM, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
>
> 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.
>
Ard,
In these kind of dumps I find it useful to also display the offset into the PE/COFF image.
ArmVeNorFlashDxe.dll (0x00000000F5EA4AE8) loaded at 0x00000000F5E90000 offset 0x00014AE9
The reason is it makes it easy to use the gdb list command to display the C source code.
gdb /home/ard/build/edk2/Build/ArmVExpress-FVP-AArch64/DEBUG_GCC5/AARCH64/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe/DEBUG/ArmVeNorFlashDxe.dll
(gdb) list * 0x14AE9
This assumes the .dll is the ELF linked near zero to accommodate the PE/COFF header, or PE/COFF. For TE you need to know the adjustment value from the TE header.
Seems like it would be possible to write a script to symbolicate the stack trace on the build machine.
It might be more useful to have the summary 1st (I have to admit I like things to line up in columns):
Synchronous Exception at 0x00000000F5EA4C8C
PC 0x00000000F5EA4C8C (0x00000000F5E90000+0x00014C8C) ArmVeNorFlashDxe.dll /home/ard/build/edk2/Build/ArmVExpress-FVP-AArch64/DEBUG_GCC5/AARCH64/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe/DEBUG
PC 0x00000000F5EA4AE8 (0x00000000F5E90000+0x00014AE9) ArmVeNorFlashDxe.dll /home/ard/build/edk2/Build/ArmVExpress-FVP-AArch64/DEBUG_GCC5/AARCH64/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe/DEBUG
PC 0x00000000F5EA1BFC (0x00000000F5E90000+0x00011BFC) ArmVeNorFlashDxe.dll /home/ard/build/edk2/Build/ArmVExpress-FVP-AArch64/DEBUG_GCC5/AARCH64/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe/DEBUG
In the example above I also made the the exception line the summary and showed that location like the rest of the frame. This seems to be the way debuggers like to do it so it seems to match with what a developer would expect.
Thanks,
Andrew Fish
PS. Just saw the remove the path commit. So maybe something like:
Synchronous Exception at 0x00000000F5EA4C8C
PC 0x00000000F5EA4C8C (0x00000000F5E90000+0x00014C8C) ArmVeNorFlashDxe.dll [1]
PC 0x00000000F5EA4AE8 (0x00000000F5E90000+0x00014AE9) ArmVeNorFlashDxe.dll [1]
PC 0x00000000F5EA1BFC (0x00000000F5E90000+0x00011BFC) ArmVeNorFlashDxe.dll [1]
PC 0x00000000FADC454C (0x00000000FADC3000+0x0000154C) Fat.dll [2]
[1] /home/ard/build/edk2/Build/ArmVExpress-FVP-AArch64/DEBUG_GCC5/AARCH64/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe/DEBUG
[2] /work/jenkins/workspace/ap-uefi-bin/EDK2_ARCH/ARM/EDK2_BINARY/FatPkg/label/sas-sw/Build/Fat/RELEASE_GCC49/AARCH64/FatPkg/EnhancedFatDxe/Fat/DEBUG/
I think your example points out why it is useful. Also the Shell or application running at he Shell could come from different locations, but still be on your system. Not to mention if you are debugging you might as well dump out all the information you have.
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>
> 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
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
next prev parent reply other threads:[~2016-09-09 16:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-07 8:21 [PATCH 1/2] BaseTools/tools_def AARCH64: enable frame pointers for DEBUG builds Ard Biesheuvel
2016-09-07 8:21 ` [PATCH 2/2] ArmPkg/DefaultExceptionHandlerLib AARCH64: add minimal backtrace to crash dump Ard Biesheuvel
2016-09-07 9:48 ` Michael Zimmermann
2016-09-07 11:03 ` Ard Biesheuvel
2016-09-07 11:25 ` Michael Zimmermann
2016-09-07 11:32 ` Ard Biesheuvel
2016-09-09 13:08 ` Ard Biesheuvel
2016-09-09 18:03 ` Michael Zimmermann
2016-09-09 16:03 ` Andrew Fish [this message]
2016-09-07 15:00 ` [PATCH 1/2] BaseTools/tools_def AARCH64: enable frame pointers for DEBUG builds Leif Lindholm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=EE5FB45E-BF82-4782-B17A-2FB1FB3032EB@apple.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox