Andreas Huber | 3 Jul 2012 13:26
Favicon

ELDK 5.2 and backtrace on ARM Kirkwood not working

Hello,

we use glibc's backtrace function to gather some information when our 
software crashes.

(see http://www.kernel.org/doc/man-pages/online/pages/man3/backtrace.3.html)

The program at the bottom of the man page produces the expected result 
for ELDK 4.2. But for ELDK 5.2 it does not work any more:

ELDK 4.2:
$ gcc -rdynamic -o prog prog.c
$ ./prog 3
backtrace() returned 7 addresses
./prog(puts+0x100) [0x8544]
./prog(puts+0x1bc) [0x8600]
./prog(backtrace_symbols+0x248) [0x8644]
./prog(backtrace_symbols+0x240) [0x863c]
./prog(backtrace_symbols+0x240) [0x863c]
./prog(backtrace_symbols+0x2c0) [0x86bc]
/lib/libc.so.6(__libc_start_main+0x1ac) [0x400a2a5c]

ELDK 5.2:
$ gcc -rdynamic -o prog prog.c
$ ./prog 3
backtrace() returned 0 addresses

Trying different compiler flags did not help (-O0, 
-fno-omit-frame-pointer, -g, ...). Maybe I missed the important one for 
this problem.
(Continue reading)

Detlev Zundel | 3 Jul 2012 16:25
Picon
Picon
Picon
Favicon

Re: ELDK 5.2 and backtrace on ARM Kirkwood not working

Hi Andreas,

> we use glibc's backtrace function to gather some information when our
> software crashes.
>
> (see http://www.kernel.org/doc/man-pages/online/pages/man3/backtrace.3.html)
>
> The program at the bottom of the man page produces the expected result
> for ELDK 4.2. But for ELDK 5.2 it does not work any more:
>
> ELDK 4.2:
> $ gcc -rdynamic -o prog prog.c
> $ ./prog 3
> backtrace() returned 7 addresses
> ./prog(puts+0x100) [0x8544]
> ./prog(puts+0x1bc) [0x8600]
> ./prog(backtrace_symbols+0x248) [0x8644]
> ./prog(backtrace_symbols+0x240) [0x863c]
> ./prog(backtrace_symbols+0x240) [0x863c]
> ./prog(backtrace_symbols+0x2c0) [0x86bc]
> /lib/libc.so.6(__libc_start_main+0x1ac) [0x400a2a5c]
>
> ELDK 5.2:
> $ gcc -rdynamic -o prog prog.c
> $ ./prog 3
> backtrace() returned 0 addresses
>
>
> Trying different compiler flags did not help (-O0,
> -fno-omit-frame-pointer, -g, ...). Maybe I missed the important one
(Continue reading)

Andreas Huber | 5 Jul 2012 11:18
Favicon

Re: ELDK 5.2 and backtrace on ARM Kirkwood not working

Hi Detlev,

Thanks for the replay.

Indeed, the compiler flag -funwind-tables solved our backtrace issue.

Regards,
Andreas
Detlev Zundel | 9 Jul 2012 14:21
Picon
Picon
Picon
Favicon

Re: ELDK 5.2 and backtrace on ARM Kirkwood not working

Hi Andreas,

> Indeed, the compiler flag -funwind-tables solved our backtrace issue.

Ok, I added an FAQ entry to our Wiki[1].

Thanks
  Detlev

[1] http://www.denx.de/wiki/view/ELDK-5/FrequentlyAskedQuestionsAndAnswers#The_glibc_function_backtrace_3_o

--

-- 
It is as important to decide what a system is not as to decide what it is.
Do not serve all the world's needs;  rather, make the system extensible so
that additional needs can be met in an upwardly compatible fashion.
                            -- principles of X Window System
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu@...

Gmane