Dwarves debugging tools
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: dwarves@vger.kernel.org
Subject: Re: pahole treats embedded structures a holes
Date: Fri, 29 May 2026 16:28:57 -0300	[thread overview]
Message-ID: <ahno-Wd92sAnRkK9@x1> (raw)
In-Reply-To: <20260529040210.GA13350@lst.de>

On Fri, May 29, 2026 at 06:02:10AM +0200, Christoph Hellwig wrote:
> On Thu, May 28, 2026 at 04:48:44PM -0300, Arnaldo Carvalho de Melo wrote:
> > acme@number:~$ readelf -wi git/build/allmodconfig/fs/xfs/xfs_buf.o  | grep -m1 DW_AT_producer
 
> hch@brick:~/work/xfs$ readelf -wi fs/xfs/xfs_buf.o  | grep -m1 DW_AT_producer
>     <d>   DW_AT_producer    : (indirect string, offset: 0x6012): GNU C11 15.2.0 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -mno-sse4a -m64 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -march=x86-64 -mtune=generic -mno-red-zone -mcmodel=kernel -mstack-protector-guard-reg=gs -mstack-protector-guard-symbol=__ref_stack_chk_guard -mindirect-branch=thunk-extern -mindirect-branch-register -mindirect-branch-cs-prefix -mfunction-return=thunk-extern -g -gdwarf-5 -O2 -std=gnu11 -fshort-wchar -funsigned-char -fno-common -fno-PIE -fno-strict-aliasing -fms-extensions -fcf-protection=branch -falign-jumps=1 -falign-loops=1 -fno-asynchronous-unwind-tables -fno-jump-tables -fpatchable-function-entry=16,16 -fno-delete-null-pointer-checks -fno-allow-store-data-races -fstack-protector-strong -fomit-frame-pointer -fzero-init-padding-bits=all -fno-stack-clash-protection -fmin-function-alignment=16 -fstrict-flex-arrays=3 -fno-strict-overflow -fstack-check=no -fconserve-stack -fno-builtin-wcslen -fno-var-tracking -femit-struct-debug-baseonly

> > then, please take a look at this sequence:

> > acme@number:~$ readelf -wi git/build/allmodconfig/fs/xfs/xfs_buf.o  | grep -w xfs_buf$ -B1 -A12
 
> hch@brick:~/work/xfs$ readelf -wi fs/xfs/xfs_buf.o  | grep -w xfs_buf$ -B1 -A12
>  <1><f1c>: Abbrev Number: 93 (DW_TAG_structure_type)
>     <f1d>   DW_AT_name        : (indirect string, offset: 0x3358): xfs_buf
>     <f21>   DW_AT_byte_size   : 344
>     <f23>   DW_AT_alignment   : 8
>     <f23>   DW_AT_decl_file   : 46
>     <f23>   DW_AT_decl_line   : 138
>     <f24>   DW_AT_decl_column : 8
>     <f24>   DW_AT_sibling     : <0x10a2>
>  <2><f28>: Abbrev Number: 39 (DW_TAG_member)
>     <f29>   DW_AT_name        : (indirect string, offset: 0x5e80): b_rhash_head
>     <f2d>   DW_AT_decl_file   : 46
>     <f2d>   DW_AT_decl_line   : 146
>     <f2e>   DW_AT_decl_column : 20
>     <f2f>   DW_AT_type        : <0x9c8>
 
> > acme@number:~$ readelf -wi git/build/allmodconfig/fs/xfs/xfs_buf.o  | grep '<5b22>' -A12
 
> hch@brick:~/work/xfs$ readelf -wi fs/xfs/xfs_buf.o  | grep '<0x9c8>' -A12

This part is the tricky one, see that the 0x isn't there inside the
<TYPE> in my grep, I guess whoever wrote readelf used this to get the
offset, not the many entries pointing to it :-)

You need to do this:

hch@brick:~/work/xfs$ readelf -wi fs/xfs/xfs_buf.o  | grep '<9c8>' -A12

Without the 0x, so that I can see what is the type for that member.

Or better, please send me your fs/xfs/xfs_buf.o, that will be easier,
I'll try it myself, and if I reproduce your results, I'll be able to fix
it and test on the same fs/xfs/xfs_buf.o file.

- Arnaldo

>     <9ce>   DW_AT_type        : <0x9c8>
>  <1><9d2>: Abbrev Number: 29 (DW_TAG_structure_type)
>     <9d3>   DW_AT_name        : (indirect string, offset: 0x303): rhlist_head
>     <9d7>   DW_AT_declaration : 1
>  <1><9d7>: Abbrev Number: 29 (DW_TAG_structure_type)
>     <9d8>   DW_AT_name        : (indirect string, offset: 0x27b4): rhashtable_compare_arg
>     <9dc>   DW_AT_declaration : 1
>  <1><9dc>: Abbrev Number: 17 (DW_TAG_pointer_type)
>     <9dd>   DW_AT_byte_size   : 8
>     <9dd>   DW_AT_type        : <0x9d7>
>  <1><9e1>: Abbrev Number: 29 (DW_TAG_structure_type)
>     <9e2>   DW_AT_name        : (indirect string, offset: 0x2ce3): rhashtable_params
>     <9e6>   DW_AT_declaration : 1
> --
>     <f2f>   DW_AT_type        : <0x9c8>
>     <f33>   DW_AT_data_member_location: 0
>  <2><f34>: Abbrev Number: 39 (DW_TAG_member)
>     <f35>   DW_AT_name        : (indirect string, offset: 0x25e): b_rhash_key
>     <f39>   DW_AT_decl_file   : 46
>     <f39>   DW_AT_decl_line   : 148
>     <f3a>   DW_AT_decl_column : 15
>     <f3b>   DW_AT_type        : <0xcb1>
>     <f3f>   DW_AT_data_member_location: 8
>  <2><f40>: Abbrev Number: 39 (DW_TAG_member)
>     <f41>   DW_AT_name        : (indirect string, offset: 0x3fbd): b_length
>     <f45>   DW_AT_decl_file   : 46
>     <f45>   DW_AT_decl_line   : 149
> --
>     <1fa9>   DW_AT_type        : <0x9c8>
>  <1><1fad>: Abbrev Number: 33 (DW_TAG_subprogram)
>     <1fae>   DW_AT_external    : 1
>     <1fae>   DW_AT_name        : (indirect string, offset: 0x5b66): __SCT__tp_func_xfs_buf_backing_vmalloc
>     <1fb2>   DW_AT_decl_file   : 3
>     <1fb3>   DW_AT_decl_line   : 793
>     <1fb5>   DW_AT_decl_column : 1
>     <1fb6>   DW_AT_prototyped  : 1
>     <1fb6>   DW_AT_type        : <0x6e>
>     <1fba>   DW_AT_declaration : 1
>     <1fba>   DW_AT_sibling     : <0x1fce>
>  <2><1fbe>: Abbrev Number: 6 (DW_TAG_formal_parameter)
>     <1fbf>   DW_AT_type        : <0x27f>
> 
> 
> > iacme@number:~$ readelf -wi git/build/allmodconfig/fs/xfs/xfs_buf.o  | grep '<5b42>' -A4
> >  <1><5b42>: Abbrev Number: 8 (DW_TAG_pointer_type)
> >     <5b43>   DW_AT_byte_size   : 8
> >     <5b43>   DW_AT_type        : <0x5b22>
> >  <1><5b47>: Abbrev Number: 30 (DW_TAG_structure_type)
> >     <5b48>   DW_AT_name        : (indirect string, offset: 0x14c84): rhlist_head
> 
> hch@brick:~/work/xfs$ readelf -wi fs/xfs/xfs_buf.o  | grep '<0x9c8>' -A4
>     <9ce>   DW_AT_type        : <0x9c8>
>  <1><9d2>: Abbrev Number: 29 (DW_TAG_structure_type)
>     <9d3>   DW_AT_name        : (indirect string, offset: 0x303): rhlist_head
>     <9d7>   DW_AT_declaration : 1
>  <1><9d7>: Abbrev Number: 29 (DW_TAG_structure_type)
> --
>     <f2f>   DW_AT_type        : <0x9c8>
>     <f33>   DW_AT_data_member_location: 0
>  <2><f34>: Abbrev Number: 39 (DW_TAG_member)
>     <f35>   DW_AT_name        : (indirect string, offset: 0x25e): b_rhash_key
>     <f39>   DW_AT_decl_file   : 46
> --
>     <1fa9>   DW_AT_type        : <0x9c8>
>  <1><1fad>: Abbrev Number: 33 (DW_TAG_subprogram)
>     <1fae>   DW_AT_external    : 1
>     <1fae>   DW_AT_name        : (indirect string, offset: 0x5b66): __SCT__tp_func_xfs_buf_backing_vmalloc
>     <1fb2>   DW_AT_decl_file   : 3

  reply	other threads:[~2026-05-29 19:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-28  5:11 pahole treats embedded structures a holes Christoph Hellwig
2026-05-28 13:39 ` Arnaldo Carvalho de Melo
2026-05-28 13:58   ` Christoph Hellwig
2026-05-28 19:48     ` Arnaldo Carvalho de Melo
2026-05-29  4:02       ` Christoph Hellwig
2026-05-29 19:28         ` Arnaldo Carvalho de Melo [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-06-05 19:28 Arnaldo Carvalho de Melo

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=ahno-Wd92sAnRkK9@x1 \
    --to=acme@kernel.org \
    --cc=dwarves@vger.kernel.org \
    --cc=hch@lst.de \
    /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