Location lists again
Michal Ludvig
mludvig@suse.cz
Fri Feb 14 13:30:00 GMT 2003
Daniel Berlin wrote:
>
> On Thursday, February 13, 2003, at 11:28 AM, Michal Ludvig wrote:
>>
>> .section .debug_loc,"",@progbits
>> .LLST0:
>> .quad .LVL0 # Location list begin address (*.LLST0)
>> .quad .LVL1 # Location list end address (*.LLST0)
>> .value 0x1 # Location expression size
>> .byte 0x55 # DW_OP_reg5
>> [...]
>>
>> This way the addresses would be correctly updated on linking.
>
> They are correct, though readelf -w will only show the offsets, because
> it doesn't know what CU they go with (IE debug_loc parsing is completely
> removed from debug_info parsing).
>
> When a debugger actually loads them, it is supposed to add the base
> address of the CU to each one.
I've been looking to gcc/dwarf2out.c (on rtlopt-branch) and in
output_loc_list() there is a code that could output addresses instead of
deltas:
[...]
if (separate_line_info_table_in_use == 0)
{
dw2_asm_output_delta (DWARF2_ADDR_SIZE, curr->begin,
curr->section,
"Location list begin address (%s)",
list_head->ll_symbol);
dw2_asm_output_delta (DWARF2_ADDR_SIZE, curr->end, curr->section,
"Location list end address (%s)",
list_head->ll_symbol);
}
else
{
dw2_asm_output_addr (DWARF2_ADDR_SIZE, curr->begin,
"Location list begin address (%s)",
list_head->ll_symbol);
dw2_asm_output_addr (DWARF2_ADDR_SIZE, curr->end,
"Location list end address (%s)",
list_head->ll_symbol);
}
[...]
Under what circumstances can this happen? How do I convince GCC to go
through the second branch? I just want to handle both cases in GDB...
And how about this piece:
[...]
/* ??? This shouldn't be needed now that we've forced the
compilation unit base address to zero when there is code
in more than one section. */
if (strcmp (curr->section, ".text") != 0)
{
/* dw2_asm_output_data will mask off any extra bits in the ~0. */
dw2_asm_output_data (DWARF2_ADDR_SIZE, ~(unsigned HOST_WIDE_INT) 0,
"Location list base address specifier fake entry");
dw2_asm_output_offset (DWARF2_ADDR_SIZE, curr->section,
"Location list base address specifier base");
}
[...]
Imagine there is a non-null base address in Compilation unit DIE, and
the appropriate location lists have headers in the form
.quad 0xffffff...
.quad .text[.label] # loclist base address
Are both base addresses the same? Well, as far as I could see they are,
but is it ensured? Or does one of them have a higher "preference" in the
case they differ?
Thanks
Michal Ludvig
--
* SuSE CR, s.r.o * mludvig@suse.cz
* (+420) 296.545.373 * http://www.suse.cz
More information about the Gcc
mailing list