A quick update on the issue (I am using the latest master branch tree).

Eugene is right in that excluding ImageContext->SizeOfHeaders gives
correct address, and using
"add-symbol-file...." I can do source level debugging in the DS-5
debugger.
So it was sufficient to change
ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c
(around line 94)
DEBUG ((EFI_D_LOAD | EFI_D_INFO, "add-symbol-file %a 0x%p\n",
        DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof
(Temp)),
        (UINTN)(ImageContext->ImageAddress +
ImageContext->SizeOfHeaders)));
to
DEBUG ((EFI_D_LOAD | EFI_D_INFO, "add-symbol-file %a 0x%p\n",
        DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof
(Temp)),
         (UINTN)(ImageContext->ImageAddress)));

as well as around line 131 (which is optional) ("remove-symbol-file").
It is probably a dirty hack but works fine for me.
However ArmPlatformPkg/Scripts/Ds5/cmd_load_symbols.py script is useless
because it does not load the symbols properly.
Anyway at least I have an ability to do source level debug now using
"add-symbol-file" lines.

Thank you,
Vladimir
> -----Original Message-----
> From: Vladimir Olovyannikov [mailto:vladimir.olovyanni...@broadcom.com]
> Sent: Friday, March 25, 2016 7:17 PM
> To: 'Cohen, Eugene'; 'Ard Biesheuvel'
> Cc: 'edk2-devel@lists.01.org'
> Subject: RE: [edk2] Error while loading a symbol file (No Debug
Directory)
>
> > > This is very odd. The commit in question introduces two new
> > > implementations of CpuExceptionHandlerLib, but does not yet use them
> > > anywhere. The next patch updates CpuDxe to start using the default
> > > (non-copying) one. What are your resolutions for
> CpuExceptionHandlerLib
> > in
> > > your .DSC, and do any of them refer to the libraries added in this
patch?
> >
> > Agreed - from a CpuDxe point of view the change should be transparent
-
> > it's the same exception handling implemented in a library.  It should
have
> > the same alignment characteristics as before.  If there was a bug that
> > existing in debug scripts for scanning modules or PE-coff extra
actions - I
> > would not expect this patch to worsen (or improve) the situation.
> I totally agree with you. However, I re-verified one more time, and this
is the
> patch
> after which no source level debugging is available for me.
> >
> > > > If I do "add-symbol-file.." in the DS-5 Debug console as the
exception
> > > > handler reports, I have an ability to debug (so the address is
shifted
> > > > +0x10000 comparing to the proper address) Do you know if  anybody
> else
> > > > had this issue on an armv8 64 bit platform after this patch was
> > > > applied?
> > > > Please advise what I could be missing...
> > > >
> > >
> > > Hmm, that looks like a separate issue. Due to the padding required
for
> > > runtime drivers, which have a 64k section alignment, the start of
the file
> > and
> > > the start of the text section are 64k apart, so that output is not
> > unexpected.
> > > In GDB, add-symbol-file takes the start of the .text section, not
the start
> of
> > > the image.
> >
> > Are you saying this also started happening with the commit in question
or is
> > that something independent?
> Eugene, I think there is actually one issue.
> It looks like "No debug directory" message was from day 1 (last year,
> sometime Jul) for me,
> but it did not affect debugging in any way, so I simply ignored it.
> With this commit the source level debugging (we use DS-5) is unavailable
for
> me, even though debugger says
> that symbols were loaded successfully. For the driver of interest (say
> RuntimeClock...) I manually shift  -0x10000, and
> then the source-level debugging is available again.
>
>  As Ard says if the debugger needs the start of
> > .text then this address may not be correct since the output is
generated as
> > follows:
> >
> >     DEBUG ((EFI_D_LOAD | EFI_D_INFO, "add-symbol-file %a 0x%p\n",
> > DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof
> (Temp)),
> > (UINTN)(ImageContext->ImageAddress + ImageContext-
> >SizeOfHeaders)));
> >
> > With our debugger (TRACE32) we only emit ImageAddress and don't add
> > SizeOfHeaders:
> >
> >    DEBUG((EFI_D_ERROR, "data.load.elf %a a:0x%08x /NOCODE
> /NOCLEAR\n",
> > ImageContext->PdbPointer, ImageAddress));
> >
> > The adding of SizeOfHeaders used to be required when the PE-COFF
> > conversion would shift the .text section to make room for the PE-COFF
> > header but recent changes made the ELF and PE-COFF layout align so
that
> > this offset was no longer necessary.
> >
> > Eugene
>
> Ard, Eugene,
> Here is the section from the dsc.
> I am building a DEBUG version,
> ARM_BDS is not used,
> SECURE BOOT is disabled.
>
> If you spot anything suspicious or need additional info please let me
know.
>
> ------ Starts here
> [LibraryClasses.common]
> !if $(TARGET) == RELEASE
>   DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
>
> UncachedMemoryAllocationLib|ArmPkg/Library/UncachedMemoryAllocatio
> nLib/UncachedMemoryAllocationLib.inf
> !else
>
> DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.
> inf
>
> UncachedMemoryAllocationLib|ArmPkg/Library/UncachedMemoryAllocatio
> nLib/UncachedMemoryAllocationLib.inf
> #
> UncachedMemoryAllocationLib|ArmPkg/Library/DebugUncachedMemoryAll
> ocationLib/DebugUncachedMemoryAllocationLib.inf
> !endif
>
> DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/Bas
> eDebugPrintErrorLevelLib.inf
>
>   BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
>
> SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchroniz
> ationLib.inf
>
> PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanc
> eLibNull.inf
>   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
>
> PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/Base
> PeCoffGetEntryPointLib.inf
>   PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
>   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
>
> UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDeco
> mpressLib.inf
>   CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
>
>   UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
>   HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
>
> UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib
> /UefiRuntimeServicesTableLib.inf
>   DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
>
> UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBo
> otServicesTableLib.inf
>
> DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTabl
> eLib.inf
>
> UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntry
> Point.inf
>
> UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiA
> pplicationEntryPoint.inf
>   HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
>
>
UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiService
> sLib.inf
>
>   UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
>
>   #
>   # Assume everything is fixed at build
>   #
>   PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
>
>   # 1/123 faster than Stm or Vstm version
>   #BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
>
> BaseMemoryLib|ArmPkg/Library/BaseMemoryLibStm/BaseMemoryLibStm.i
> nf
>
>   # Networking Requirements
>   NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
>   DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
>   UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
>   IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
>
>   # ARM Architectural Libraries
>
> CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCach
> eMaintenanceLib.inf
>
> DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/D
> efaultExceptionHandlerLib.inf
>
> CpuExceptionHandlerLib|ArmPkg/Library/ArmExceptionLib/ArmExceptionLib
> .inf
>
> ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler
> Lib.inf
>   DmaLib|ArmPkg/Library/ArmDmaLib/ArmDmaLib.inf
>   ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf
>   ArmGicArchLib|ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf
>
> ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPla
> tformStackLib.inf
>   ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
>
> ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounter
> Lib/ArmGenericTimerPhyCounterLib.inf
>
>   PlatformPeiLib|ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf
>
>   # ARM SP804 Dual Timer Driver
>   TimerLib|ArmPlatformPkg/Library/SP804TimerLib/SP804TimerLib.inf
>
>   # EBL Related Libraries
>   EblCmdLib|ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.inf
>   EfiFileLib|EmbeddedPkg/Library/EfiFileLib/EfiFileLib.inf
>
> EblAddExternalCommandLib|EmbeddedPkg/Library/EblAddExternalComman
> dLib/EblAddExternalCommandLib.inf
>   EblNetworkLib|EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.inf
>
>   #
>   # Uncomment (and comment out the next line) For RealView Debugger.
> The Standard IO window
>   # in the debugger will show load and unload commands for symbols. You
> can cut and paste this
>   # into the command window to load symbols. We should be able to use a
> script to do this, but
>   # the version of RVD I have does not support scripts accessing system
> memory.
>   #
>
> #PeCoffExtraActionLib|ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoff
> ExtraActionLib.inf
>
> PeCoffExtraActionLib|ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPe
> CoffExtraActionLib.inf
>
> #PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/Base
> PeCoffExtraActionLibNull.inf
>
>
> DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLi
> bNull.inf
>
> DebugAgentTimerLib|EmbeddedPkg/Library/DebugAgentTimerLibNull/Debu
> gAgentTimerLibNull.inf
>
>   SemihostLib|ArmPkg/Library/SemihostLib/SemihostLib.inf
>
>   # BDS Libraries
>   BdsLib|ArmPkg/Library/BdsLib/BdsLib.inf
>
>   AcpiLib|EmbeddedPkg/Library/AcpiLib/AcpiLib.inf
>   FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf
>
>   # RunAxf support via Dynamic Shell Command protocol
>   # It uses the Shell libraries.
>
> ArmShellCmdRunAxfLib|ArmPlatformPkg/Library/ArmShellCmdRunAxf/Arm
> ShellCmdRunAxf.inf
>   ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
>   FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
>   SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
>
>   #
>   # Secure Boot dependencies
>   #
> !if $(SECURE_BOOT_ENABLE) == TRUE
>   IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
>   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
>
> TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTp
> mMeasurementLib.inf
>
AuthVariableLib|SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
>   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
>
>   # re-use the UserPhysicalPresent() dummy implementation from the ovmf
> tree
>
> PlatformSecureLib|OvmfPkg/Library/PlatformSecureLib/PlatformSecureLib.i
> nf
> !else
>
> TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/Tp
> mMeasurementLibNull.inf
>
> AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableL
> ibNull.inf
> !endif
>   VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
>
> !if $(USE_ARM_BDS) == FALSE
>
> CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.i
> nf
>
> GenericBdsLib|IntelFrameworkModulePkg/Library/GenericBdsLib/GenericB
> dsLib.inf
>
> PlatformBdsLib|ArmPlatformPkg/Library/PlatformIntelBdsLib/PlatformIntelB
> dsLib.inf
>
> CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/Custo
> mizedDisplayLib.inf
> !endif
>
> ---Ends here
>
> Thank you,
> Vladimir
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to