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: Wed, 15 Jun 2022 14:00:59 +0000 [thread overview]
Message-ID: <bug-29037-6586-efXkDiG3rn@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-29037-6586@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=29037
--- Comment #3 from William Cohen <wcohen at redhat dot com> ---
Did some comparisons of rr recorded runs of process the rhel8 and f35 binary
with systemtap that a patch that recoginizes the DW_AT_data_bit_offset.
dwarf_getlocation_address() function doesn't handle DW_AT_data_bit_offset being
passed in as a Dwarf_Attribute and that later triggers the message seen in
comment#2.
Took a look at the dwarf generated for a couple different data structures to
see what is generated by the compiler for structures with bit fields. The bit
fields don't have DW_AT_data_member_location regardless of where they are in
the data structure. Thus something like following the later bit fields have
DW_AT_data_bit_offset from the beginning of the struct:
typedef unsigned char __u8;
struct fields {
int junk;
__u8 icsk_ca_setsockopt:1,
icsk_ca_dst_locked:1;
};
0x0000007c: DW_TAG_typedef
DW_AT_name ("__u8")
DW_AT_decl_file
("/home/wcohen/research/profiling/systemtap_write/gcc11_bitfield/loctest2.c")
DW_AT_decl_line (4)
DW_AT_decl_column (0x17)
DW_AT_type (0x00000046 "unsigned char")
0x00000088: DW_TAG_structure_type
DW_AT_name ("fields")
DW_AT_byte_size (0x08)
DW_AT_decl_file
("/home/wcohen/research/profiling/systemtap_write/gcc11_bitfield/loctest2.c")
DW_AT_decl_line (6)
DW_AT_decl_column (0x08)
DW_AT_sibling (0x000000bb)
0x00000095: DW_TAG_member
DW_AT_name ("junk")
DW_AT_decl_file
("/home/wcohen/research/profiling/systemtap_write/gcc11_bitfield/loctest2.c")
DW_AT_decl_line (7)
DW_AT_decl_column (0x0a)
DW_AT_type (0x00000031 "int")
DW_AT_data_member_location (0x00)
0x000000a2: DW_TAG_member
DW_AT_name ("icsk_ca_setsockopt")
DW_AT_decl_file
("/home/wcohen/research/profiling/systemtap_write/gcc11_bitfield/loctest2.c")
DW_AT_decl_line (8)
DW_AT_decl_column (0x0a)
DW_AT_type (0x0000007c "__u8")
DW_AT_bit_size (1)
DW_AT_data_bit_offset (0x20)
0x000000ae: DW_TAG_member
DW_AT_name ("icsk_ca_dst_locked")
DW_AT_decl_file
("/home/wcohen/research/profiling/systemtap_write/gcc11_bitfield/loctest2.c")
DW_AT_decl_line (9)
DW_AT_decl_column (0x03)
DW_AT_type (0x0000007c "__u8")
DW_AT_bit_size (1)
DW_AT_data_bit_offset (0x21)
gdb appears to handle bitfields properly with the existing elfutils. There
looks to be patches in gdb to address handling the DW_AT_data_bit_offset:
commit 6ad036d703099508c388038b57c77a8f7aaffb1d
Author: Tom Tromey <tromey@adacore.com>
Date: Fri Aug 20 10:05:10 2021 -0600
Fix handling of DW_AT_data_bit_offset
A newer version of GCC will now emit member locations using just
DW_AT_data_bit_offset, like:
commit 20a5fcbd5b28cca88511ac5a9ad5e54251e8fa6d
Author: Tom Tromey <tom@tromey.com>
Date: Wed Sep 23 09:39:24 2020 -0600
Handle bit offset and bit size in base types
--
You are receiving this mail because:
You are the assignee for the bug.
next prev parent reply other threads:[~2022-06-15 14:00 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 [this message]
2022-06-24 21:31 ` wcohen at redhat dot com
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-efXkDiG3rn@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).