3

I want to dump stacktrace of my program as the example demonstrated at backtrace[3], but I got result below, instead.

I am using linux 2.6, and arm-linux-gcc 4.3.2.

Running:
arm-linux-gcc prog.c -o prog -rdynamic

the result is:

backtrace() returned 1 addresses

/lib/ld-linux.so.3 [0x40025000]

Could you please help me to solve this problem?

Thanks


I don't have any problem with gcc, But I cant get traces with arm-linux-gcc.

Community
  • 1
  • 1
Ocean
  • 2,882
  • 1
  • 18
  • 21

1 Answers1

1

According to the GCC ARM Options documentation, you need to pass the -mapcs-frame option to GCC to generate stack frames on the ARM platform.

-mapcs-frame
Generate a stack frame that is compliant with the ARM Procedure Call Standard for all functions, even if this is not strictly necessary for correct execution of the code. Specifying -fomit-frame-pointer with this option causes the stack frames not to be generated for leaf functions. The default is -mno-apcs-frame.

This was pointed out to me in a comment to my Linux specific answer to How to generate a stacktrace when my gcc C++ app crashes, which you may also find useful.

Community
  • 1
  • 1
jschmier
  • 15,458
  • 6
  • 54
  • 72
  • Thanks for your comment but I didn't get expected result (there is no messages for backtrace_symbols), I am working on device is _mini 2440_ – Ocean Apr 06 '13 at 05:57
  • It is possible that your version of **glibc** or **uclibc** doesn't contain a working implementation of `backtrace()` for your architecture. In a project I worked on once, we had to roll our own `backtrace()` because the existing one wasn't fully implemented. If this is the case, [this answer](http://stackoverflow.com/a/2536136/203667) may be of some assistance. – jschmier Apr 08 '13 at 16:27
  • maybe! linux kernel will dump stack-trace when some problem is occurred, I check your recommendation. thanks for your comment @jschmier – Ocean Apr 09 '13 at 14:07