backtrace() returns only one stack frame

reference:

How to use information to solve the problem backtrace crashes in Linux

linux printing stack method

https://devtalk.nvidia.com/default/topic/987279/jetson-tx1/backtrace-returns-only-one-stack-frame-on-jetson-tx1/

 

When using aarch64-linux-gnu-gcc compiler application learning backtrace, use the following command to compile, found that only prints a trace message:

aarch64-linux-gnu-gcc -rdynamic -O0 -g main.c -o main

 

 

Modify, add compiler options: -funwind-tables

aarch64-linux-gnu-gcc -funwind-tables -rdynamic -O0 -g main.c -o main

 

 About this description of the parameters, please refer to the GCC manual:

https://gcc.gnu.org/onlinedocs/gcc-9.1.0/gcc.pdf

 Finish.

 

Guess you like

Origin www.cnblogs.com/pengdonglin137/p/10974258.html