Skip to contentSkip to conversation

"File has no CTF section."

DISCUSSION Florin Iucha 2 participants 6 messages Mar 25, 2008 – Apr 24, 2008 5 messages not in the archive

lore
Share & tools
lore
#0 lore raw

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

Signature · 2 lines
Bruce Schneier expects the Spanish Inquisition.
      http://geekz.co.uk/schneierfacts/fact/163

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Em Tue, Mar 25, 2008 at 10:24:03AM -0500, Florin Iucha escreveu:

Quoted 3 lines

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.

Quoted 8 lines

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
Quoted 13 lines

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)

Quoted 5 lines

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

Quoted 6 lines

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

Quoted 8 lines

Thanks,
florin

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

Signature · 2 lines
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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20080325164103.GC22421-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org

#4 lore raw

Arnaldo,

Thanks for the quick reply!

Quoted 9 lines · Arnaldo Carvalho de Melo
Quoted 8 lines

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.

Quoted 7 lines

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.

Quoted 9 lines
Quoted 6 lines

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

Signature · 2 lines
Bruce Schneier expects the Spanish Inquisition.
      http://geekz.co.uk/schneierfacts/fact/163

#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;
}

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

Em Tue, Mar 25, 2008 at 12:24:14PM -0500, Florin Iucha escreveu:

Quoted 31 lines

Arnaldo,

Thanks for the quick reply!

Quoted 9 lines · Arnaldo Carvalho de Melo
Quoted 8 lines

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.

Quoted 7 lines

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.

Quoted 7 lines
Quoted 6 lines

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?

Quoted 7 lines
Quoted 2 lines

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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20080325175749.GE22421-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org

#8 lore raw
Quoted 6 lines · Arnaldo Carvalho de Melo
Quoted 4 lines

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

Signature · 2 lines
Bruce Schneier expects the Spanish Inquisition.
      http://geekz.co.uk/schneierfacts/fact/163

A message that is not in the archive (sent off-list or not yet received): [email protected]

#10 lore raw

Em Thu, Apr 24, 2008 at 10:25:11AM -0500, Florin Iucha escreveu:

Quoted 9 lines · Arnaldo Carvalho de Melo
Quoted 6 lines
Quoted 4 lines

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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html