This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

backtrace() on ix86?


Hi,

It seems, that the backtrace() function on ix86 always misses the
last function. A sample test case is included. bar() is never printed
on ix86:

/* gcc -g3 -O0 div_zero.c -o test -rdynamic */

#include <signal.h>
#include <execinfo.h>

#define SIZE 32

void signalhandler( int someint )
{
        size_t returned_size;
        int i;

        char** symbol_array;

        void* something[SIZE];

        printf( "Signal handler called and signal no is = %d\n", someint );

        returned_size = backtrace( something, SIZE );

        if ( returned_size )
                printf( "returned size=%d\n", returned_size );
        else
                exit(2);

        symbol_array = backtrace_symbols( something, returned_size );

        for ( i = 0; i < returned_size; ++i )
        {
                printf( "symbol: %s\n", symbol_array[i] );
        }
        exit( 1 );
};

void bar(int b)
{
        int x=0, z;

        z=b/x;
        printf("z is: %d\n", z);
}

void foo1(int a)
{
        bar( a );
}

void foo(int a)
{
	foo1( a );
}

int main(void)
{
        signal( SIGFPE, &signalhandler );
        foo( 1 );
        return 0;
}


-- 
Thorsten Kukuk       http://www.suse.de/~kukuk/        kukuk@suse.de
SuSE Linux AG        Maxfeldstr. 5                 D-90409 Nuernberg
--------------------------------------------------------------------    
Key fingerprint = A368 676B 5E1B 3E46 CFCE  2D97 F8FD 4E23 56C6 FB4B


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]