Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stacktrace arm-linux-gcc

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.

like image 513
Ocean Avatar asked Dec 04 '25 15:12

Ocean


1 Answers

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.

like image 97
jschmier Avatar answered Dec 06 '25 16:12

jschmier