Supported on windows
Supported on linux
Supported on android
info sources command
Lists source files mentioned in loaded symbols.
Syntax
info sources
Examples
We will demonstrate the info sources command with a basic C++ program that includes the iostrean header with some inline code:
#include <iostream>
int main(int argc, char **argv)
{
std::cout << "Hello!" << std::endl;
return 0;
}
int main(int argc, char **argv)
{
std::cout << "Hello!" << std::endl;
return 0;
}
Note how starting the program results in loading symbols for various system libraries and adds more source files to the lits:
(gdb) info sources
Source files for which symbols have been read in:
Source files for which symbols will be read in on demand:
/usr/include/c++/4.8/iostream, /home/bazis/test.cpp
(gdb) start
Temporary breakpoint 1 at 0x80486b6: file test.cpp, line 5.
Starting program: /home/bazis/test
Temporary breakpoint 1, main (argc=1, argv=0xbffff064) at test.cpp:5
5 std::cout << "Hello!" << std::endl;
(gdb) info sources
Source files for which symbols have been read in:
/home/bazis/test.cpp, /home/bazis/<built-in>, /usr/include/wctype.h, /usr/include/i386-linux-gnu/c++/4.8/bits/atomic_word.h, ...
Source files for which symbols will be read in on demand:
/usr/include/c++/4.8/iostream, /build/buildd/eglibc-2.17/time/../sysdeps/unix/syscall-template.S,
/build/buildd/eglibc-2.17/string/../sysdeps/i386/i686/multiarch/../../rawmemchr.S, ...
Source files for which symbols have been read in:
Source files for which symbols will be read in on demand:
/usr/include/c++/4.8/iostream, /home/bazis/test.cpp
(gdb) start
Temporary breakpoint 1 at 0x80486b6: file test.cpp, line 5.
Starting program: /home/bazis/test
Temporary breakpoint 1, main (argc=1, argv=0xbffff064) at test.cpp:5
5 std::cout << "Hello!" << std::endl;
(gdb) info sources
Source files for which symbols have been read in:
/home/bazis/test.cpp, /home/bazis/<built-in>, /usr/include/wctype.h, /usr/include/i386-linux-gnu/c++/4.8/bits/atomic_word.h, ...
Source files for which symbols will be read in on demand:
/usr/include/c++/4.8/iostream, /build/buildd/eglibc-2.17/time/../sysdeps/unix/syscall-template.S,
/build/buildd/eglibc-2.17/string/../sysdeps/i386/i686/multiarch/../../rawmemchr.S, ...
Note how the libc symbols refer to the sources in the /build/buildd directory that was present on the machine where libc was built.
Compatibility with VisualGDB
You can execute the info sources command under VisualGDB using the GDB Session window in Visual Studio.