GDB does not show function names

I am debugging an embedded device using gdbserver:

./gdbserver HOST:5000 /home/test_app 

On my pc, I run gdb as follows:

 arm-none-linux-gnueabi-gdb test_app 

Once the application is running, I get a Segfault that I want to debug, but it's impossible to know which line produced it:

 Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 715] 0x31303030 in ?? () (gdb) bt #0 0x31303030 in ?? () #1 0x0000dff8 in ?? () #2 0x0000dff8 in ?? () Backtrace stopped: previous frame identical to this frame (corrupt stack?) 

(I have to say that I am completely new to GDB)

+8
c ++ segmentation-fault gdb
source share
2 answers

Well, this usually happens if there are no debugging symbols ... just to make sure that the following commands are executed

 file <your_executable> 

You will get information about your binary format, arch, etc. The last piece of information describes whether the binary is deleted or not. For debugging in GDB, the binary must not be deleted.

 nm --debug-sym <your_executable> | grep debug 

If you have valid fingerprints as shown below, it means that debugging characters are present.

 00000000 N .debug_abbrev 00000000 N .debug_aranges 00000000 N .debug_frame 00000000 N .debug_info 00000000 N .debug_line 00000000 N .debug_loc 00000000 N .debug_pubnames 00000000 N .debug_str 

Next, when you call GDB, you should have the following line

 Reading symbols from <your_executable>...done. 

At this point, you should be able to list the sources using the list command.

Make sure that both gdb and gdbserver have the same version.

 arm-none-linux-gnueabi-gdb --version ./gdbserver --version 

If all of the above is true and you still don't get backtracking, something bad happens to your stack. Try running some static analysis, valgrind on your code / newly added code.

+10
source share

You need to create an application with debugging symbols enabled. The switch for gcc is -g

+5
source share

All Articles