glibc-profile, core dump

james@cryptocard.com james@cryptocard.com
Tue Apr 20 19:05:00 GMT 1999


I have:

[james@teapot prof]$ rpm -qa | grep glibc
glibc-devel-2.0.7-29
glibc-profile-2.0.7-29
glibc-debug-2.0.7-29
glibc-2.0.7-29

[james@teapot prof]$ /opt/egcs/bin/gcc --version
egcs-2.91.66

(egcs-1.1.2 release)

[james@teapot build]$ sh guessconfig
i586-pc-linux-gnu

prog.c:

#include <stdio.h>
#include <stdlib.h>

void main() {
        printf("hello\n");
        libit();
        printf("bye\n");
}

it.c:

void libit()
{
        printf("what?");
}

building:

FOO=/opt/egcs/bin/egcs
$FOO -pg -profile -pg prog.c -o prog.o -c
$FOO -pg -profile -pg it.c -o it.o -c
$FOO -shared -pg -profile -pg it.o -o libit.so
$FOO prog.o -o prog -pg -profile -pg -L. -lit

This gives you libit.so and prog.

[james@teapot prof]$ ./prog
Segmentation fault (core dumped)

[james@teapot prof]$ gdb ./prog
GNU gdb 4.17
[...]
(gdb) run
Starting program: /home/james/prof/./prog

Program received signal SIGSEGV, Segmentation fault.
0x8050d93 in __getopt_clean_environment () at getopt_init.c:66
getopt_init.c:66: No such file or directory.
(gdb) bt
#0  0x8050d93 in __getopt_clean_environment () at getopt_init.c:66
#1  0x804bf98 in init (argc=1, argv=0xbffff82d, envp=0x0) at
../sysdeps/unix/sysv/linux/init-first.c:77
#2  0x804c001 in __libc_init_first (arg=0x1) at
../sysdeps/unix/sysv/linux/init-first.c:95

----
HOWEVER, if you change FOO=/usr/bin/gcc:

[james@teapot james]$ rpm -qf /usr/bin/gcc
gcc-2.7.2.3-11

The above example profiles fine.

This has caused me great headaches and essentially makes egcs unusable for
profiling.  If this is the regparm(3) bug, please tell me, otherwise I
don't believe there's a formal example of this being a bug except for this
one.

        JAmes
         




More information about the Gcc-bugs mailing list