Hello Ard, Eugene,
Thank you for explanation.

Ard, I tried the patch, but it cannot be applied to the latest (pulled a minute 
ago, git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18732 
6f19259b-4bc3-4df7-8a09-765794883524)
tree: all 3 hunks failed. Which commit should I be based on to apply the patch?

Anyway I found the lines manually and changed them. However, when I try to 

source /uefi/ArmPlatformPkg/Scripts/Ds5/cmd_load_symbols.py -f 
(0x85000000,0x00280000) -m (0x80000000,0x40000000) -a
I am getting

ERROR(?): ValueError: need more than 1 value to unpack
  File " /uefi/ArmPlatformPkg/Scripts/Ds5/cmd_load_symbols.py", line 94, in 
<module>
    armplatform_debugger.load_all_symbols()
ERROR(CMD656): 
# in /uefi/BroadcomPlatformPkg/NS2Pkg/Scripts/armpkg_syms.ds:2 while executing: 
source /uefi/ArmPlatformPkg/Scripts/Ds5/cmd_load_symbols.py -f 
(0x85000000,0x00280000) -m (0x80000000,0x40000000) -a
! The script /uefi/ArmPlatformPkg/Scripts/Ds5/cmd_load_symbols.py failed to 
complete due to an error during execution of the script

Replacing the script with the older version makes it work as before, but again 
the debugger is useless.

Any idea what is wrong?

Eugene, so you do not use the so convenient cmd_load_symbols.py script to load 
all symbols? 
I dumped efi and dll as you suggested. The .text and .data sections in PE-COFF 
and ELF match 1:1 for me. Still the debugger is useless as it points to 
non-relevant code.

Please help me to get back on track with debugger...

Thank you,
Vladimir

-----Original Message-----
From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org] 
Sent: Friday, November 06, 2015 5:36 AM
To: Cohen, Eugene
Cc: Vladimir Olovyannikov; edk2-devel@lists.01.org
Subject: Re: [edk2] Strange behavior of the DS-5 debugger on AARCH64 with 
step-by-step debugging in uefi

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

Reply via email to