diff options
author | Dawn Perchik <dawn@burble.org> | 2016-01-05 19:51:51 +0000 |
---|---|---|
committer | Dawn Perchik <dawn@burble.org> | 2016-01-05 19:51:51 +0000 |
commit | 954b40bf630ed9a1d329438b8ab75bf9af0184b8 (patch) | |
tree | ba3b6fda629a0aea5ac424546f5d50cee725cb92 /lldb/packages/Python/lldbsuite | |
parent | 68b753a4fbda3e7185cf9eeb368607c620bfac57 (diff) | |
download | bcm5719-llvm-954b40bf630ed9a1d329438b8ab75bf9af0184b8.tar.gz bcm5719-llvm-954b40bf630ed9a1d329438b8ab75bf9af0184b8.zip |
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
Diffstat (limited to 'lldb/packages/Python/lldbsuite')
3 files changed, 11 insertions, 4 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/help/TestHelp.py b/lldb/packages/Python/lldbsuite/test/help/TestHelp.py index b145cf63f62..783cbff4c1c 100644 --- a/lldb/packages/Python/lldbsuite/test/help/TestHelp.py +++ b/lldb/packages/Python/lldbsuite/test/help/TestHelp.py @@ -137,7 +137,7 @@ class HelpCommandTestCase(TestBase): """Command 'help image du line' is not ambiguous and should work.""" # 'image' is an alias for 'target modules'. self.expect("help image du line", - substrs = ['Dump the line table for one or more compilation units']) + substrs = ['Dump the line table for one or more files']) @no_debug_info_test def test_help_target_variable_syntax(self): diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py index 93044ba5ee0..f05c6712f80 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py @@ -48,12 +48,19 @@ class MiSymbolTestCase(lldbmi_testcase.MiTestCaseBase): eline = line_number('symbol_list_lines_inline_test2.cpp', '// END_gfunc2') self.runCmd("-symbol-list-lines symbol_list_lines_inline_test2.cpp") self.expect("\^done,lines=\[\{pc=\"0x[0-9a-f]+\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"3\d\"\})*,\{pc=\"0x[0-9a-f]+\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"3\d\"\})*\]" % (sline, eline)) - ##FIXME: This doesn't work for symbol_list_lines_inline_test.cpp due to clang bug llvm.org/pr24716 + ##FIXME: This doesn't work for symbol_list_lines_inline_test.cpp due to clang bug llvm.org/pr24716 (fixed in newer versions of clang) ##sline = line_number('symbol_list_lines_inline_test.cpp', '// FUNC_gfunc') ##eline = line_number('symbol_list_lines_inline_test.cpp', '// STRUCT_s') ##self.runCmd("-symbol-list-lines symbol_list_lines_inline_test.cpp") ##self.expect("\^done,lines=\[\{pc=\"0x[0-9a-f]+\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"3\d\"\})*,\{pc=\"0x[0-9a-f]+\",line=\"%d\"\}\]" % (sline, eline)) + # Test that -symbol-list-lines works on header files by checking the first + # and last line, and making sure the other lines are under 29. + sline = line_number('symbol_list_lines_inline_test.h', '// FUNC_ifunc') + eline = line_number('symbol_list_lines_inline_test.h', '// FUNC_mfunc') + self.runCmd("-symbol-list-lines symbol_list_lines_inline_test.h") + self.expect("\^done,lines=\[\{pc=\"0x[0-9a-f]+\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"\d\"\})*(,\{pc=\"0x[0-9a-f]+\",line=\"1\d\"\})*,\{pc=\"0x[0-9a-f]+\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"2\d\"\})*\]" % (sline, eline)) + # Test that -symbol-list-lines fails when file doesn't exist self.runCmd("-symbol-list-lines unknown_file") self.expect("\^error,message=\"warning: No source filenames matched 'unknown_file'\. error: no source filenames matched any command arguments \"") diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.h b/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.h index 1608642b0b3..4b986dc6932 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.h +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.h @@ -2,7 +2,7 @@ namespace ns { inline int ifunc(int i) -{ +{ // FUNC_ifunc return i; } struct S @@ -16,7 +16,7 @@ struct S } int mfunc() - { + { // FUNC_mfunc return a + b; } }; |