logo       

Segmentation fault with gprof: msg#00013

Subject: Segmentation fault with gprof
Hi,


I tried to use gprof on a ARM linux platform.
I get a segmentation fault as soon as I run the application compiled with
the -pg option.

The application is a simple "hello word" printf (see below)

Does anyone has encoutered this issue ?

Thanks you.

#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>

void print_string(char * string)
{
        printf("%s",string);
}

int main(int argc, char *argv[])
{
int i;
char hello_string[30];

        for(i=0;i<20;i++)
        {
                sprintf(hello_string,"Hello world! %d\n",i);
                print_string(hello_string);
        }

        return EXIT_SUCCESS;
}

Compiled with gcc 3.3.2 on ARM platform with -O0 -g -pg options

192:/home/testgprof/testgprof# gdb testgprof

GNU gdb 5.3-debian
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "arm-linux"...
(gdb) run
Starting program: /home/testgprof/testgprof/testgprof
ptrace: bogus breakpoint trap
ptrace: bogus breakpoint trap
ptrace: bogus breakpoint trap
ptrace: bogus breakpoint trap
ptrace: bogus breakpoint trap
ptrace: bogus breakpoint trap
Hello world! 0
pc : [<400ef554>]    lr : [<00010000>]    Not tainted
sp : bffffd40  ip : bffffd68  fp : bffffd64
r10: 4013f68c  r9 : 00008608  r8 : 00000001
r7 : 00000000  r6 : 000085f0  r5 : 4013d20c  r4 : 00010e22
r3 : 000c0000  r2 : 00000314  r1 : 00010d42  r0 : 00010960
Flags: nzCv  IRQs on  FIQs on  Mode USER_32  Segment user
Control: 317F  Table: 0275C000  DAC: 00000015

Program received signal SIGSEGV, Segmentation fault.
0x400ef554 in _mcleanup () from /lib/libc.so.6
(gdb) bt
#0  0x400ef554 in _mcleanup () from /lib/libc.so.6
#1  0x00010000 in ?? ()
#2  0x40141db0 in timezone () from /lib/libc.so.6(gdb) q
A debugging session is active.
Do you still want to close the debugger?(y or n) y
192:/home/testgprof/testgprof#



-------------------------------------------------------------------
Subscription options: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
FAQ/Etiquette:       http://www.arm.linux.org.uk/armlinux/mailinglists.php



<Prev in Thread] Current Thread [Next in Thread>