This patch adds support the command 'source info' as follows:
(lldb) help source info Display source line information (as specified) based on the current executable's debug info. Syntax: source info <cmd-options> Command Options Usage: source info [-c <count>] [-s <shlib-name>] [-f <filename>] [-l <linenum>] [-e <linenum>] source info [-c <count>] [-s <shlib-name>] [-n <symbol>] source info [-c <count>] [-a <address-expression>] -a <address-expression> ( --address <address-expression> ) Lookup the address and display the source information for the corresponding file and line. -c <count> ( --count <count> ) The number of line entries to display. -e <linenum> ( --end-line <linenum> ) The line number at which to stop displaying lines. -f <filename> ( --file <filename> ) The file from which to display source. -l <linenum> ( --line <linenum> ) The line number at which to start the displaying lines. -n <symbol> ( --name <symbol> ) The name of a function whose source to display. -s <shlib-name> ( --shlib <shlib-name> ) Look up the source in the given module or shared library (can be specified more than once).
(lldb) source info --file x.h Lines for file x.h in compilation unit x.cpp in `x [0x0000000100000d00-0x0000000100000d10): /Users/dawn/tmp/./x.h:10 [0x0000000100000d10-0x0000000100000d1b): /Users/dawn/tmp/./x.h:10
The new options are used to fix the MI command:
which didn't work for header files because it called:
target modules dump line-table <file>
which only dumps line tables for a compilation unit.
The patch also fixes a bug in the error reporting when no files were supplied to the command. Previously you'd get:
(lldb) target modules dump line-table error: Syntax: error: no source filenames matched any command arguments
Now you get:
error: file option must be specified.