[edk2-devel] [PATCH 3/3] ArmPkg: Use Image base address for RVCT symbols loading

Marvin Häuser mhaeuser at posteo.de
Sat Aug 21 19:55:50 UTC 2021


The initial import of the RVCT debug code used 0 for the address of
the first Image section [1]. This commit has been made in 2010, when
"--ro-base 0" was still passed as a build argument [2]. In 2015, this
was changed to mirror the PE/COFF memory layout the same way that ELF
does [3]. Update the corresponding debug code to no longer manually
account for the PE/COFF header offset.

[1] https://github.com/mhaeuser/edk2/commit/62e797a489341b13a095b3cd7c0f7bd9eac12efe
[2] https://github.com/mhaeuser/edk2/blob/62e797a489341b13a095b3cd7c0f7bd9eac12efe/BaseTools/Conf/tools_def.template#L2299-L2300
[3] https://github.com/tianocore/edk2/commit/b12ef6b964f8fc0532432ebffd67748648487133

Cc: Leif Lindholm <leif at nuviainc.com>
Cc: Ard Biesheuvel <ardb+tianocore at kernel.org>
Cc: Vitaly Cheptsov <vit9696 at protonmail.com>
Signed-off-by: Marvin Häuser <mhaeuser at posteo.de>
---
 ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c | 2 +-
 ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffExtraActionLib.c     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c b/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c
index 2ca42c19c03f..f65463be96b0 100644
--- a/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c
+++ b/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c
@@ -81,7 +81,7 @@ PeCoffLoaderRelocateImageExtraAction (
 #ifdef __CC_ARM

 #if (__ARMCC_VERSION < 500000)

     // Print out the command for the RVD debugger to load symbols for this image

-    DEBUG ((EFI_D_LOAD | EFI_D_INFO, "load /a /ni /np %a &0x%p\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders)));

+    DEBUG ((EFI_D_LOAD | EFI_D_INFO, "load /a /ni /np %a &0x%p\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)ImageContext->ImageAddress));

 #else

     // Print out the command for the DS-5 to load symbols for this image

     DEBUG ((EFI_D_LOAD | EFI_D_INFO, "add-symbol-file %a -o 0x%p\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)ImageContext->ImageAddress));

diff --git a/ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffExtraActionLib.c b/ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffExtraActionLib.c
index 0b78554f6347..0a5e8db294ea 100644
--- a/ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffExtraActionLib.c
+++ b/ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffExtraActionLib.c
@@ -114,7 +114,7 @@ PeCoffLoaderRelocateImageExtraAction (
   CHAR8 Buffer[256];

 

 #if (__ARMCC_VERSION < 500000)

-  AsciiSPrint (Buffer, sizeof(Buffer), "load /a /ni /np \"%a\" &0x%08x\n", ImageContext->PdbPointer, (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders));

+  AsciiSPrint (Buffer, sizeof(Buffer), "load /a /ni /np \"%a\" &0x%08x\n", ImageContext->PdbPointer, (UINTN)ImageContext->ImageAddress);

 #else

   AsciiSPrint (Buffer, sizeof(Buffer), "add-symbol-file %a -o 0x%08x\n", ImageContext->PdbPointer, (UINTN)ImageContext->ImageAddress);

 #endif

-- 
2.31.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#79674): https://edk2.groups.io/g/devel/message/79674
Mute This Topic: https://groups.io/mt/85048612/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list