From: Arnaldo Carvalho de Melo <acme-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Jan Engelhardt <jengelh-nopoi9nDyk+ELgA04lAiVw@public.gmane.org>
Cc: dwarves-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: pahole displays type incorrectly
Date: Thu, 10 Sep 2009 17:35:17 -0300 [thread overview]
Message-ID: <20090910203517.GA2289@ghostprotocols.net> (raw)
In-Reply-To: <20090817154228.GI12303-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org>
Em Mon, Aug 17, 2009 at 12:42:28PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Mon, Aug 17, 2009 at 04:12:25PM +0200, Jan Engelhardt escreveu:
> > Hi,
> >
> >
> > given the following struct:
> >
> > struct x {
> > const char *const s;
> > };
> >
> > pahole will display it as:
> >
> > struct x {
> > const const char *s; /* .. */
> > };
> >
> > And that is not quite right. The sparse(1) tool would say "how much more
> > const do you want it to be?" :)
> > I used pahole.git commit f0435286c0b.
>
> pahole is not properly handling that case at the moment, the DWARF chain
> is:
>
> [acme@doppio pahole]$ readelf -wi object_samples/jengelh\@medozas.de/const_const
> <SNIP>
> <1><2d>: Abbrev Number: 2 (DW_TAG_structure_type)
> <2e> DW_AT_name : x
> <30> DW_AT_byte_size : 8
> <31> DW_AT_decl_file : 1
> <32> DW_AT_decl_line : 1
> <33> DW_AT_sibling : <0x44>
> <2><37>: Abbrev Number: 3 (DW_TAG_member)
> <38> DW_AT_name : s
> <3a> DW_AT_decl_file : 1
> <3b> DW_AT_decl_line : 2
> <3c> DW_AT_type : <0x44>
> <40> DW_AT_data_member_location: 2 byte block: 23 0
> (DW_OP_plus_uconst: 0)
> <1><44>: Abbrev Number: 4 (DW_TAG_const_type)
> <45> DW_AT_type : <0x49>
> <1><49>: Abbrev Number: 5 (DW_TAG_pointer_type)
> <4a> DW_AT_byte_size : 8
> <4b> DW_AT_type : <0x4f>
> <1><4f>: Abbrev Number: 4 (DW_TAG_const_type)
> <50> DW_AT_type : <0x54>
> <1><54>: Abbrev Number: 6 (DW_TAG_base_type)
> <55> DW_AT_byte_size : 1
> <56> DW_AT_encoding : 6 (signed char)
> <57> DW_AT_name : (indirect string, offset: 0x72): char
>
> <SNIP>
>
> So if we find a const at the start of the chain, we must render it
> first, then the type, but if we find it inside the chain, it has to be
> rendered at the end of the chain... I'm reworking the code that
> recursively traverses the chain to fix this, but I'm being sidetracked
> with some other work, stay tuned and I'll get this fixed today
>
> Thanks for the report!
Sorry for the delay, should be fixed by the latest commit, please give
it a try!
http://git.kernel.org/?p=linux/kernel/git/acme/pahole.git;a=commitdiff;h=846927a3f87f730e0ae201b5f0b3b46212a7bb8e
- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe dwarves" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next parent reply other threads:[~2009-09-10 20:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <alpine.LSU.2.00.0908171610490.31821@fbirervta.pbzchgretzou.qr>
[not found] ` <20090817154228.GI12303@ghostprotocols.net>
[not found] ` <20090817154228.GI12303-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org>
2009-09-10 20:35 ` Arnaldo Carvalho de Melo [this message]
[not found] ` <20090910222256.GB2289@ghostprotocols.net>
[not found] ` <20090910222256.GB2289-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org>
2009-09-11 4:54 ` pahole displays type incorrectly Arnaldo Carvalho de Melo
[not found] ` <20090910203517.GA2289-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org>
2009-09-12 1:41 ` Jan Engelhardt
[not found] ` <alpine.LSU.2.00.0909120340020.444-SHaQjdQMGhDmsUXKMKRlFA@public.gmane.org>
2009-09-12 13:24 ` Arnaldo Carvalho de Melo
[not found] ` <20090912132405.GB3545-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org>
2009-09-12 14:49 ` Arnaldo Carvalho de Melo
[not found] ` <20090912144939.GA14242-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org>
2009-09-12 22:47 ` 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=20090910203517.GA2289@ghostprotocols.net \
--to=acme-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
--cc=dwarves-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=jengelh-nopoi9nDyk+ELgA04lAiVw@public.gmane.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 NNTP newsgroup(s).