GDB won't load source file
Read carefully the documentation of GDB notably about source path. You want to use the dir
command
Also, switch to a newer gdb (perhaps by compiling gdb
from its source code). Current version is 7.7 (so 6.8 is really old)
gdb doesn't show the source file
I don't understand why instead of the source file name it shows
<command-line>.
As Jonathan Wakely correctly stated, this is because the input to gcc
came from pipe. Something like:
sed -e 's/foo/bar/' foo.c | gcc -g -o bar.o -xc -
is there a way to tell gdb where to find which function?
You already know which function this is: omx_isend
. Presumably you want to tell gdb that this function came from some file, e.g. foo.c
.
I don't believe there is a way to do that in GDB. Your best bet is to adjust your Makefile
. Instead of the sed
above, do this:
sed -e 's/foo/bar/' foo.c > foo-subst.c && gcc -g -o bar.o foo-subst.c
Then GDB will just work (TM).
GDB stepping into shared library shows no such file even though debug symbols are loaded
You need to also tell gdb where the source files are. Which means you also need the source files, not just the debugging symbols.
It's important that the sources you download are the actual ones used to compile the library, because debugging information only contains filename and line number. If you give gdb a file where the line numbers don't correspond (a different version, for example), the source lines printed by gdb will be very confusing. It has no way to know they are wrong. You should be able to use the src deb with the same version number as the library debs.
Once you have the source files, tell gdb where to look for them with
directory /path/to/source/files
You can specify several paths. Read help directory
inside gdb.
Since you'll need to do this often, put that line into a gdbinit file. You'll probably want to use .gdbinit
in your current directory, but .gdbinit
in your home directory might also be a possibility. Gdb uses both.
If you're working with a library whose source is spread over a subdirectory tree, you might find it useful to set a substitution path:
set substitute-path /your/file/path /original/file/path
Again, more help is available with help set substitute-path
.
Related Topics
Find String Inside a Gzipped File in a Folder
How to Change the Mime Type of a File from the Terminal
What's the Practical Limit on the Size of Single Packet Transmitted Over Domain Socket
What Makes a Kernel/Os Real-Time
How to Setup and Clone a Remote Git Repo on Windows
How to Make Binary Distribution of Qt Application for Linux
How to Display Only Files from Aws S3 Ls Command
Pytorch Says That Cuda Is Not Available
Getting Current Path in Variable and Using It
How to Toggle Cr/Lf in Gnu Screen
Behavior of Cd/Bash on Symbolic Links
Syntax With Pound and Percent Sign After Shell Parameter Name
Segmentation Fault on Printf - Nasm 64Bit Linux
Chmod 777 to a Folder and All Contents