Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tcf-dev] TCF agent problem with DWARF containing .debug_loc section

Hi Andreas,

 

Yes, this does look bad.

I have changed the code to use Addr1 – Addr0 instead of second mapping.

 

Thanks,

Eugene

 

From: tcf-dev-bounces@xxxxxxxxxxx [mailto:tcf-dev-bounces@xxxxxxxxxxx] On Behalf Of Ragnerstam, Andreas
Sent: Wednesday, October 19, 2016 7:32 AM
To: tcf-dev@xxxxxxxxxxx
Subject: [tcf-dev] TCF agent problem with DWARF containing .debug_loc section

 

Hi,

I am working with TCF as a developer of Wind River Simics and have found an issue with the DWARF service in the TCF agent with an ELF file that contains a .debug_loc section.

 

In dwarfexpr.c:76 in dwarf_get_expression_list there is an issue when converting the end address (Addr1) to a run-time address:

 

    if (!errno) RT_Addr1 = elf_map_to_run_time_address(Value->mContext, Unit->mFile, S1, Base + Addr1);

 

The end address (Addr1) for the location in debug_loc is an exclusive address, containing the first address past the end of the address range, and that address is being translated to a run-time address using elf_map_to_run_time_address (in tcf_elf.c). For the case when the region in the ELF-file has its last byte at Base + Addr1 – 1 the translation will fail as elf_run_time_address_in_region() will fail (check is “addr >= p->address + p->mem_size”). This mapping (if necessary) should be done for the last address included in the address range, not the first address outside of the range.

Something like:

 

    if (!errno) RT_Addr1 = elf_map_to_run_time_address(Value->mContext, Unit->mFile, S1, Base + Addr1 - 1) + 1;

 

An alternative might be to determine Info->code_size from Addr1 – Addr0 instead of converting the upper address.

 

I ran into this issue with a ppc64 binary compiled with gcc4.1.0.

 

Regards,

Andreas Ragnerstam

 

----------------------------------------------------------------------
Intel Sweden AB
Registered Office: Isafjordsgatan 30B, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.


Back to the top