On 6 November 2015 at 14:27, Cohen, Eugene <eug...@hp.com> wrote: > Vladimir, > > Since the UEFI images are PE-COFF but DS-5 builds ELF there is a conversion > process in the edk2 build. This can result in a couple of issues with debug > if not handled correctly: > > 1. The start of the image for debugger load purposes must be adjusted to > reflect the PE/TE header in the image. If this isn't done correctly the code > and data will be shifted and the debugger is useless. > > 2. The relative position of .text and .data must be consistent across ELF and > PE-COFF. If this isn't done correctly you may be able to get correlated > source code but all references to data (like dumping global variables) are > messed up. > > The way I go about debugging this is to dump the PE-COFF image (.efi) with > dumpbin (from Visual Studio) and dump the ELF image (.dll) with fromelf (from > RVCT) and compare the positions of the .text and .data sections. > > Based on Ard's response I think you are hitting issue #1. >
Indeed. I made some changes to the GCC linker scripts recently to ensure that the PE/COFF and ELF layouts are identical in memory. The primary reason for doing so was the recent introduction of a security feature in UEFI that requires the PE/COFF sections to be page aligned, making it more likely that you would hit #2 in Eugene's list above. -- Ard. > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of > Vladimir Olovyannikov > Sent: Thursday, November 05, 2015 3:52 PM > To: edk2-devel@lists.01.org > Subject: [edk2] Strange behavior of the DS-5 debugger on AARCH64 with > step-by-step debugging in uefi > > Hello All, > > I faced a very strange behavior of the DS-5 debugger when I debug AARCH64 > UEFI with the latest (well, the one which contains > DEFINE GCC_DLINK2_FLAGS_COMMON = > --script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds > ) > tools_def.template. > Whenever I step in the debugger it never matches the source where the > execution point currently is. > It is impossible to step-by-step debug with this... > If I switch to the older tools_def.template, I don't have those issues, and > can debug with no problem. > However, the ShellPkg cannot be built with older tools_def.template if I want > to have ShellPkg (New Shell) instead of ShellBinPkg. > > Please advise if I am doing anything wrong? > > This is how I debug if step-by-step debug is needed: > > I place a while(1) in a place of interest. Build UEFI, and then reboot the > board and run the uefi; then when it reaches the point of while1, I connect > DS-5 to the device and execute ArmPlatformPkg/Scripts/Ds5/cmd_load_symbols.py > -f (0x85000000,0x00280000) -m (0x80000000,0x40000000) -a > > And expect to be at the (while1 line). With the latest tools_def.tempalte the > source point is weird; with the previous ones - OK. > Any advice would be appreciated. > > Thank you, > Vladimir > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel