dwarves.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* "File has no CTF section."
@ 2008-03-25 15:24 Florin Iucha
       [not found] ` <20080325152403.GK3247-8+3tsXFunua1C7ntjtBYng@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Florin Iucha @ 2008-03-25 15:24 UTC (permalink / raw)
  To: dwarves-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 2211 bytes --]

I have manually built the pahole&co on Ubuntu 8.04 beta, and I'm
trying to use it on a few source files that I have, and I keep getting
the "File has no CTF section." error message.

I have three object files: one is 'dwarves.o' from the pahole
distribution, compiled with 'gcc -g'.  Another is 'foobar.o' from my
own embedded application, compiled with the same compiler, on the same
box [1].  The third object file is 'foobar.o' compiled with some
version of compiler (Metrowerks?) for the embedded platform that we use.

If I use 'objdump -W' on all three files, I get heaps of information,
including the structure definitions and other stuff.  Good.

If I use 'pahole' on all three files, I get the structure information
for the first one, but 'File has no CTF section.' for the other two,
even though the first and second object files are built with the same
compiler!  And even though both 'foobar.o' file contain heaps of
debugging information (objdump -W yields 14K lines for the gcc-4.2
build and 43K lines for the native embedded build).

I grepped for 'File has no CTF section.' in the dwarves sources and it
only occurs in the 'ctf_loader.c' file - it seems that the code is
looking for a section named ".SUNW_ctf" (in function parse_elf which
is only called from ctf__load which is only called from cus__loadfl,
if the dwarf__load returns some empty list)

It seems that either 'dwfl_getdwarf/dwarf_nextcu' fails to find the
data.  At any rate, the error message (about the missing CTF section)
is quite misleading.  I'm not sure where the bug is (although my
limited exploring seems to point to the 'elfutils' package.  Ubuntu
distributes version 0.131, which seems to be the latest published version.

The most puzzling thing is that two object files, compiled with the
same compiler on the same machine have different enough DWARF data
that one works with pahole and one doesn't.

What can I do to follow through with this?  Contact the elfutils
maintainers?

Thanks,
florin

1: The compiler version is 'gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu6)'

-- 
Bruce Schneier expects the Spanish Inquisition.
      http://geekz.co.uk/schneierfacts/fact/163

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: "File has no CTF section."
       [not found] ` <20080325152403.GK3247-8+3tsXFunua1C7ntjtBYng@public.gmane.org>
@ 2008-03-25 16:41   ` Arnaldo Carvalho de Melo
       [not found]     ` <20080325164103.GC22421-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2008-03-25 16:41 UTC (permalink / raw)
  To: Florin Iucha; +Cc: dwarves-u79uwXL29TY76Z2rM5mHXA

Em Tue, Mar 25, 2008 at 10:24:03AM -0500, Florin Iucha escreveu:
> I have manually built the pahole&co on Ubuntu 8.04 beta, and I'm
> trying to use it on a few source files that I have, and I keep getting
> the "File has no CTF section." error message.

Argh, I have to fix that, this just means that the file doesn't have
DWARF info _nor_ CTF info.
 
> I have three object files: one is 'dwarves.o' from the pahole
> distribution, compiled with 'gcc -g'.  Another is 'foobar.o' from my
> own embedded application, compiled with the same compiler, on the same
> box [1].  The third object file is 'foobar.o' compiled with some
> version of compiler (Metrowerks?) for the embedded platform that we use.
> 
> If I use 'objdump -W' on all three files, I get heaps of information,
> including the structure definitions and other stuff.  Good.

can you try with:

# binutils
readelf -w i build/pahole

# elfutils
eu-readelf -w i build/pahole
 
> If I use 'pahole' on all three files, I get the structure information
> for the first one, but 'File has no CTF section.' for the other two,
> even though the first and second object files are built with the same
> compiler!  And even though both 'foobar.o' file contain heaps of
> debugging information (objdump -W yields 14K lines for the gcc-4.2
> build and 43K lines for the native embedded build).
> 
> I grepped for 'File has no CTF section.' in the dwarves sources and it
> only occurs in the 'ctf_loader.c' file - it seems that the code is
> looking for a section named ".SUNW_ctf" (in function parse_elf which
> is only called from ctf__load which is only called from cus__loadfl,
> if the dwarf__load returns some empty list)
> 
> It seems that either 'dwfl_getdwarf/dwarf_nextcu' fails to find the
> data.  At any rate, the error message (about the missing CTF section)
> is quite misleading.  I'm not sure where the bug is (although my
> limited exploring seems to point to the 'elfutils' package.  Ubuntu
> distributes version 0.131, which seems to be the latest published version.

indeed, misleading it is, fixing now... done
 
> The most puzzling thing is that two object files, compiled with the
> same compiler on the same machine have different enough DWARF data
> that one works with pahole and one doesn't.
> 
> What can I do to follow through with this?  Contact the elfutils
> maintainers?

Possibly, but can you make these two object files available somewhere?
I'd like to take a look...
 
> Thanks,
> florin
> 
> 1: The compiler version is 'gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu6)'
> 
> -- 
> Bruce Schneier expects the Spanish Inquisition.
>       http://geekz.co.uk/schneierfacts/fact/163


--
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: "File has no CTF section."
       [not found]     ` <20080325164103.GC22421-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org>
@ 2008-03-25 17:24       ` Florin Iucha
       [not found]         ` <20080325172413.GN3247-8+3tsXFunua1C7ntjtBYng@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Florin Iucha @ 2008-03-25 17:24 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: dwarves-u79uwXL29TY76Z2rM5mHXA


[-- Attachment #1.1: Type: text/plain, Size: 1594 bytes --]

Arnaldo,

Thanks for the quick reply!

On Tue, Mar 25, 2008 at 01:41:03PM -0300, Arnaldo Carvalho de Melo wrote:
> > I have three object files: one is 'dwarves.o' from the pahole
> > distribution, compiled with 'gcc -g'.  Another is 'foobar.o' from my
> > own embedded application, compiled with the same compiler, on the same
> > box [1].  The third object file is 'foobar.o' compiled with some
> > version of compiler (Metrowerks?) for the embedded platform that we use.
> > 
> > If I use 'objdump -W' on all three files, I get heaps of information,
> > including the structure definitions and other stuff.  Good.
> 
> can you try with:
> 
> # binutils
> readelf -w i build/pahole
> 
> # elfutils
> eu-readelf -w i build/pahole

Yup.  I get the same (or very similar) information.

> > The most puzzling thing is that two object files, compiled with the
> > same compiler on the same machine have different enough DWARF data
> > that one works with pahole and one doesn't.
> > 
> > What can I do to follow through with this?  Contact the elfutils
> > maintainers?
> 
> Possibly, but can you make these two object files available somewhere?
> I'd like to take a look...

See the attached file.  If you just compile it with 'gcc -g -c hello.c',
pahole works fine on the resulting object file.  If at line 17 you change
'#if 0' to '#if 1', pahole will complain about the lack of CTF (sorry,
I didn't have time to pull your updates).

Cheers,
florin

-- 
Bruce Schneier expects the Spanish Inquisition.
      http://geekz.co.uk/schneierfacts/fact/163

[-- Attachment #1.2: hello.c --]
[-- Type: text/plain, Size: 315 bytes --]

#include <stdio.h>

struct foo
{
   int i;
   char c;
   float f;
};

struct bar
{
   struct foo f;
   char c;
   int i;
};

#if 0
#pragma BSS(".do_not_init")
struct foo f;
#pragma BSS(DEFAULT_SECTION_BSS)
#endif

int main(void)
{
   struct bar b;

   printf("Hello, struct bar(%u)!\n", sizeof(b));

   return 0;
}

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: "File has no CTF section."
       [not found]         ` <20080325172413.GN3247-8+3tsXFunua1C7ntjtBYng@public.gmane.org>
@ 2008-03-25 17:57           ` Arnaldo Carvalho de Melo
       [not found]             ` <20080325175749.GE22421-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2008-03-25 17:57 UTC (permalink / raw)
  To: Florin Iucha; +Cc: dwarves-u79uwXL29TY76Z2rM5mHXA

Em Tue, Mar 25, 2008 at 12:24:14PM -0500, Florin Iucha escreveu:
> Arnaldo,
> 
> Thanks for the quick reply!
> 
> On Tue, Mar 25, 2008 at 01:41:03PM -0300, Arnaldo Carvalho de Melo wrote:
> > > I have three object files: one is 'dwarves.o' from the pahole
> > > distribution, compiled with 'gcc -g'.  Another is 'foobar.o' from my
> > > own embedded application, compiled with the same compiler, on the same
> > > box [1].  The third object file is 'foobar.o' compiled with some
> > > version of compiler (Metrowerks?) for the embedded platform that we use.
> > > 
> > > If I use 'objdump -W' on all three files, I get heaps of information,
> > > including the structure definitions and other stuff.  Good.
> > 
> > can you try with:
> > 
> > # binutils
> > readelf -w i build/pahole
> > 
> > # elfutils
> > eu-readelf -w i build/pahole
> 
> Yup.  I get the same (or very similar) information.
> 
> > > The most puzzling thing is that two object files, compiled with the
> > > same compiler on the same machine have different enough DWARF data
> > > that one works with pahole and one doesn't.
> > > 
> > > What can I do to follow through with this?  Contact the elfutils
> > > maintainers?
> > 
> > Possibly, but can you make these two object files available somewhere?
> > I'd like to take a look...
> 
> See the attached file.  If you just compile it with 'gcc -g -c hello.c',
> pahole works fine on the resulting object file.  If at line 17 you change
> '#if 0' to '#if 1', pahole will complain about the lack of CTF (sorry,
> I didn't have time to pull your updates).

ACK, reproduced here, will investigate, strange indeed.

- 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: "File has no CTF section."
       [not found]             ` <20080325175749.GE22421-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org>
@ 2008-04-24 15:25               ` Florin Iucha
       [not found]                 ` <20080424152511.GB19740-8+3tsXFunua1C7ntjtBYng@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Florin Iucha @ 2008-04-24 15:25 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: dwarves-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 546 bytes --]

On Tue, Mar 25, 2008 at 02:57:49PM -0300, Arnaldo Carvalho de Melo wrote:
> > See the attached file.  If you just compile it with 'gcc -g -c hello.c',
> > pahole works fine on the resulting object file.  If at line 17 you change
> > '#if 0' to '#if 1', pahole will complain about the lack of CTF (sorry,
> > I didn't have time to pull your updates).
> 
> ACK, reproduced here, will investigate, strange indeed.

Pinnnggg!

florin

-- 
Bruce Schneier expects the Spanish Inquisition.
      http://geekz.co.uk/schneierfacts/fact/163

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: "File has no CTF section."
       [not found]                 ` <20080424152511.GB19740-8+3tsXFunua1C7ntjtBYng@public.gmane.org>
@ 2008-04-24 15:56                   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2008-04-24 15:56 UTC (permalink / raw)
  To: Florin Iucha; +Cc: Carvalho de Melo, dwarves-u79uwXL29TY76Z2rM5mHXA

Em Thu, Apr 24, 2008 at 10:25:11AM -0500, Florin Iucha escreveu:
> On Tue, Mar 25, 2008 at 02:57:49PM -0300, Arnaldo Carvalho de Melo wrote:
> > > See the attached file.  If you just compile it with 'gcc -g -c hello.c',
> > > pahole works fine on the resulting object file.  If at line 17 you change
> > > '#if 0' to '#if 1', pahole will complain about the lack of CTF (sorry,
> > > I didn't have time to pull your updates).
> > 
> > ACK, reproduced here, will investigate, strange indeed.
> 
> Pinnnggg!

Poooong, sorry for the delay, will try again to fix this today.

- 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-04-24 15:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-25 15:24 "File has no CTF section." Florin Iucha
     [not found] ` <20080325152403.GK3247-8+3tsXFunua1C7ntjtBYng@public.gmane.org>
2008-03-25 16:41   ` Arnaldo Carvalho de Melo
     [not found]     ` <20080325164103.GC22421-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org>
2008-03-25 17:24       ` Florin Iucha
     [not found]         ` <20080325172413.GN3247-8+3tsXFunua1C7ntjtBYng@public.gmane.org>
2008-03-25 17:57           ` Arnaldo Carvalho de Melo
     [not found]             ` <20080325175749.GE22421-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org>
2008-04-24 15:25               ` Florin Iucha
     [not found]                 ` <20080424152511.GB19740-8+3tsXFunua1C7ntjtBYng@public.gmane.org>
2008-04-24 15:56                   ` Arnaldo Carvalho de Melo

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).