Supported on windows
Supported on linux
Supported on android
info line command
Translates line numbers to addresses and vice versa.
Syntax
info line [File]:[Line]
info line [Function]
info line [File]:[Function]
info line *[Address]
info line [Function]
info line [File]:[Function]
info line *[Address]
Parameters
- File/Line
- If this form is used, the info line command will display the starting and ending addresses of the given source line.
- Function
- If this parameter is used, the info line command will display the information about the first source line of a given function.
- Address
- If this parameter is used, the info line command will display the information about a source line that corresponds to the specified address.
Examples
We will demonstrate several uses of the info line command using a basic C++ program consisting of an empty main() function:
(gdb) start
Temporary breakpoint 1 at 0x80483f0: file test.cpp, line 5.
Starting program: /home/bazis/test
Temporary breakpoint 1, main (argc=1, argv=0xbffff064) at test.cpp:5
5 return 0;
(gdb) info line test.cpp:5
Line 5 of "test.cpp" starts at address 0x80483f0 <main(int, char**)+3> and ends at 0x80483f5 <main(int, char**)+8>.
(gdb) info line *0x80483f0
Line 5 of "test.cpp" starts at address 0x80483f0 <main(int, char**)+3> and ends at 0x80483f5 <main(int, char**)+8>.
(gdb) info line *0x80483f6
Line 6 of "test.cpp" starts at address 0x80483f5 <main(int, char**)+8> and ends at 0x80483f7.
(gdb) info line main
Line 4 of "test.cpp" starts at address 0x80483ed <main(int, char**)> and ends at 0x80483f0 <main(int, char**)+3>.
Temporary breakpoint 1 at 0x80483f0: file test.cpp, line 5.
Starting program: /home/bazis/test
Temporary breakpoint 1, main (argc=1, argv=0xbffff064) at test.cpp:5
5 return 0;
(gdb) info line test.cpp:5
Line 5 of "test.cpp" starts at address 0x80483f0 <main(int, char**)+3> and ends at 0x80483f5 <main(int, char**)+8>.
(gdb) info line *0x80483f0
Line 5 of "test.cpp" starts at address 0x80483f0 <main(int, char**)+3> and ends at 0x80483f5 <main(int, char**)+8>.
(gdb) info line *0x80483f6
Line 6 of "test.cpp" starts at address 0x80483f5 <main(int, char**)+8> and ends at 0x80483f7.
(gdb) info line main
Line 4 of "test.cpp" starts at address 0x80483ed <main(int, char**)> and ends at 0x80483f0 <main(int, char**)+3>.
Compatibility with VisualGDB
You can execute the info line command under VisualGDB using the GDB Session window in Visual Studio.