We have this for call4 (and other DW_OP_calls)
printf ("DW_OP_call4: <%lx>", (long) byte_get (data, 4));
data += 4;
It should really print byte_get(data,4)+cu_offset.. as done for DW_FORM_ref4
uvalue = byte_get (data, 4);
data += 4;
printf (" <%lx>", uvalue + cu_offset);
Created attachment 322 [details]
Proposed patch to pass the cu_offset to decode_location_expression
Attached is a patch that should do this. What do you think ?
2004-12-23 Nick Clifton <firstname.lastname@example.org>
* readelf.c (debug_info): Add 'cu_offset' field.
(get+pointer_size_of_comp_unit): Rename to
'get_pointer_size_and_offset_of_comp_unit'. Add code to return
the offset of the comp_unit if requested.
(get_debug_info): Record comp_unit offsets as well.
(display_debug_lines): Call get_pointer_size_of_comp_unit.
(decode_location_expression): Add an extra parameter - the offset
of the current comp-unit. Use this when decoding the DW_OP_call2
and DW_OP_call4 operators.
(display_debug_loc): Call get_pointer_size_of_comp_unit, pass the
comp_unit offset on the decode_location_expression.
(read_and_display_attr_value): Pass the comp_unit offset on the
(display_debug_frames): Pass 0 as the comp_unit offset to
It looks OK to me. Should we also update DW_OP_call_ref to make it similar to
Yes - but that is not really the subject of this bug report though. Feel free
to submit a patch to do it - it should be relatively straightforward I think.