-----Original Message-----
From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org] 
Sent: Sunday, November 08, 2015 10:52 PM
To: Vladimir Olovyannikov
Cc: Cohen, Eugene; 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 21:32, Vladimir Olovyannikov
<volov...@broadcom.com>> wrote:
>> 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?
>>

>No, not a clue. But could you please share the diff between the
>version of the script that works for you and the version that doesn't?
>I don't think the patch I sent could trigger the error you are seeing,
>so it must be something else that changed.
Here is the diff.

--- firmware_volume_old.py      2015-06-24 15:15:37.000000000 -0700
+++ firmware_volume_new.py      2015-11-06 11:49:24.321730539 -0800
@@ -91,12 +91,7 @@
         return filename[0:string.find(filename,'\0')]
 
     def get_debug_elfbase(self):
-        stripped_size = struct.unpack("<H", 
self.ec.getMemoryService().read(self.base_te + 0x6, 2, 32))[0]
-        stripped_size -= EfiSectionTE.SIZEOF_EFI_TE_IMAGE_HEADER
-
-        base_of_code = self.ec.getMemoryService().readMemory32(self.base_te + 
0xC)
-
-        return self.base_te + base_of_code - stripped_size
+        return self.base_pe32
 
 class EfiSectionPE32:
     def __init__(self, ec, base_pe32):
@@ -131,17 +126,7 @@
         return filename[0:string.find(filename,'\0')]
 
     def get_debug_elfbase(self):
-        # Offset from dos hdr to PE file hdr
-        pe_file_header = self.base_pe32 + 
self.ec.getMemoryService().readMemory32(self.base_pe32 + 0x3C)
-
-        base_of_code = self.base_pe32 + 
self.ec.getMemoryService().readMemory32(pe_file_header + 0x28)
-        base_of_data = self.base_pe32 + 
self.ec.getMemoryService().readMemory32(pe_file_header + 0x2C)
-
-        if (base_of_code < base_of_data) and (base_of_code != 0):
-            return base_of_code
-        else:
-            return base_of_data
-
+        return self.base_pe32
 class EfiSectionPE64:
     def __init__(self, ec, base_pe64):
         self.ec = ec
@@ -176,16 +161,7 @@
         return filename[0:string.find(filename,'\0')]
 
     def get_debug_elfbase(self):
-        # Offset from dos hdr to PE file hdr
-        pe_file_header = self.base_pe64 + 
self.ec.getMemoryService().readMemory32(self.base_pe64 + 0x3C)
-
-        base_of_code = self.base_pe64 + 
self.ec.getMemoryService().readMemory32(pe_file_header + 0x28)
-        base_of_data = self.base_pe64 + 
self.ec.getMemoryService().readMemory32(pe_file_header + 0x2C)
-
-        if (base_of_code < base_of_data) and (base_of_code != 0):
-            return base_of_code
-        else:
-            return base_of_data
+        return self.base_pe64
 
 class FirmwareFile:
     EFI_FV_FILETYPE_RAW                   = 0x01

>> 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.
>>

>Indeed, this is expected. The PE/COFF and ELF versions of the binary
>should look entirely the same, it's only the DS-5 scripts that needs
>to have the hack removed to deal with the difference.
OK, I see.

Thank you,

Vladimir
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to