hanchenye-llvm-project/lldb/source
Dawn Perchik 954b40bf63 Add support for "source info" and use it to fix MI's -symbol-list-lines.
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).
For example:
    (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:
    -symbol-list-lines <file>
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.

Reviewed by: clayborg, jingham, ki.stfu
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D15593

llvm-svn: 256863
2016-01-05 19:51:51 +00:00
..
API Add logging to SBProcess::GetRestartedFromEvent 2016-01-05 17:55:35 +00:00
Breakpoint Make the Language print the description of the Exception Breakpoint resolver. Also 2015-12-18 02:14:04 +00:00
Commands Add support for "source info" and use it to fix MI's -symbol-list-lines. 2016-01-05 19:51:51 +00:00
Core No need for a custom function here; just use what C provides 2015-12-22 00:47:36 +00:00
DataFormatters Fix a bug where language categories would hold on to their caches even after changes 2015-12-15 02:20:48 +00:00
Expression Read macro info from .debug_macro section and use it for expression evaluation. 2015-12-16 00:22:08 +00:00
Host [Editline] Redesign automatic indentation fix command for robustness 2015-12-14 21:43:59 +00:00
Initialization Plug-in PlatformNetBSD initializer and terminator 2015-12-05 21:46:37 +00:00
Interpreter remove defunct scripts/build-swig-wrapper-classes.sh; switch autoconf build to prepare_bindings.py. 2015-11-18 19:34:03 +00:00
Plugins Fix for undefined behavior while updating PC value on arm-linux 2016-01-05 16:56:13 +00:00
Symbol Update LLDB to account for Clang r256463 2015-12-27 07:16:55 +00:00
Target Fix a typo in Process.cpp 2016-01-05 17:55:32 +00:00
Utility Read macro info from .debug_macro section and use it for expression evaluation. 2015-12-16 00:22:08 +00:00
CMakeLists.txt Add initial CMake glue for the NetBSD platform 2015-10-24 00:27:04 +00:00
Makefile [Makefiles] Align library names with CMake build 2015-07-14 20:25:19 +00:00
lldb.cpp Add more NetBSD platform glue for lldb 2015-11-07 15:31:54 +00:00