public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: "wcohen at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: systemtap@sourceware.org
Subject: [Bug translator/29037] Systemtap unable to find struct bitfield members for gcc11 compiled code
Date: Fri, 24 Jun 2022 21:31:09 +0000	[thread overview]
Message-ID: <bug-29037-6586-m136MdkTzw@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-29037-6586@http.sourceware.org/bugzilla/>

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.

  parent reply	other threads:[~2022-06-24 21:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-07 14:10 [Bug translator/29037] New: " wcohen at redhat dot com
2022-04-07 14:30 ` [Bug translator/29037] " wcohen at redhat dot com
2022-04-21 22:03 ` wcohen at redhat dot com
2022-06-15 14:00 ` wcohen at redhat dot com
2022-06-24 21:31 ` wcohen at redhat dot com [this message]
2022-07-01 17:39 ` wcohen at redhat dot com
2022-07-08 17:36 ` wcohen at redhat dot com
2023-03-09 22:09 ` fche at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-29037-6586-m136MdkTzw@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=systemtap@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).