From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 46D1B38582B4; Wed, 15 Jun 2022 14:00:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 46D1B38582B4 From: "wcohen at redhat dot com" 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 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: systemtap X-Bugzilla-Component: translator X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: wcohen at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: systemtap at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: systemtap@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Systemtap mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Jun 2022 14:00:59 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D29037 --- Comment #3 from William Cohen --- 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 b= eing 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=20=20=20=20=20=20 ("/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=20=20=20=20=20=20 ("/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=20=20=20=20=20=20 ("/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 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 Date: Wed Sep 23 09:39:24 2020 -0600 Handle bit offset and bit size in base types --=20 You are receiving this mail because: You are the assignee for the bug.=