[Bug translator/29037] Systemtap unable to find struct bitfield members for gcc11 compiled code
wcohen at redhat dot com
sourceware-bugzilla@sourceware.org
Fri Jun 24 21:31:09 GMT 2022
https://sourceware.org/bugzilla/show_bug.cgi?id=29037
William Cohen <wcohen at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
--- Comment #4 from William Cohen <wcohen at redhat dot com> ---
Thinking through plan for DW_AT_data_bit_offset handling
One of the restrictions is that dwarf_getlocation_addr expects a
DW_AT_data_member_location doesn't understand DW_AT_data_bit_offset
attribute. The dwarf_getlocation_addr returns a DWARF_E_NO_LOC_VALUE
if there is no DW_AT_data_member_location.
Maybe synthesize a DW_AT_data_member_location from
DW_AT_data_bit_offset and the data type size in dwflpp.cxx
dwflpp::find_struct_member. It is a bit more complicated than
DW_AT_data_bit_offset/8 as that might not be start of the data type
holding the bit field.
There are a number of places where DW_AT_bit_offset is checked in
dwflpp.cxx. Those places will need to be expanded to handle
DW_AT_data_bit_offset. Need to handle the differences between
DW_AT_data_bit_offset and DW_AT_bit_offset:
-DW_AT_data_bit_offset little-endian, but DW_AT_bit_offset is big-endian
-DW_AT_data_bit_offset is from start of struct, DW_AT_bit_offset is from
start of DW_AT_data_member_location
Places where DW_AT_bit_offset used in dwflpp.cxx functions:
get_bitfield and dwflpp::translate_final_fetch_or_store. Also have
DW_AT_bit_offset in tapsets.cxx
dwarf_pretty_print::recurse_struct_members.
Generating an equivalent to DW_AT_data_member_location:
member_location = (data_bit_offset / byte_size) * byte_size;
Generating bit offset from DW_AT_data_member_location
bit_offset = data_bit_offset - member_location;
At this point have a partial patch on wcohen/pr29037 to address
pr29037 on
https://sourceware.org/git/?p=systemtap.git;a=shortlog;h=refs/heads/wcohen/pr29037
. One sticking point point is creating a new
DW_AT_data_member_location attribute. Copying the
DW_AT_data_bit_offset attribute and overwriting the
DW_AT_data_bit_offset with DW_AT_data_member_location is easy.
However, modifying the valp field with the correct value for
formudata() to read is not so obvious.
Another issue that looks like that is going to come up is PR28334 if
the structure is small enough to be passed in a registers. Systemtap
doesn't handle extracting a item from a register unless it is in the
lsb bits of the register.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the Systemtap
mailing list