gdb debugging------------------------------------------------ ----------------------------------------
CMakeFile.txt加入set(CMAKE_BUILD_TYPE Debug)
gdb ./rknn_MNIST
Break point b 110/main (line number/function name)
Single step debugging s (step)
Step over n (next)
continue c(continue)
print variable print
info b breakpoint information
info locals prints local variables
segmentation fault(core dump)--------------------------------------------------------------------
In Linux systems, the "main memory" is often called the core, and the core image is the memory content when the "process" is executed.
When a process encounters an error or receives a "signal" and terminates execution, the system writes the core image to a file for debugging purposes. This is the so-called core dump. The system will generate a core file in the specified directory. We can use the core file to locate and debug errors.
1: Enable core file generation function
decrease -c
ulimit -c unlimited does not limit the size, but is only valid in the current terminal
To always be effective, you can add it in /etc/profile
ulimit -c unlimited
2: Find the generated core dump file
cat /proc/sys/kernel/core_pattern
find . -name "core.*" is usually core. namexxxxxxxxxxxxxxxxxxxxx
3:gdb ./test core.xxxxxxxxxxxxxx
--->sudo gdb ./rknn_MNIST /var/lib/apport/coredump/core._data_rknn_MNISTLinux_rknn_MNIST.0.67cdb2f8-23da-40be-b047-c777cb75c00d.8065.200974