Differential D15593 Diff 44038 lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py
Changeset View
Changeset View
Standalone View
Standalone View
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | def test_lldbmi_symbol_list_lines_file(self): | ||||
# Test that -symbol-list-lines doesn't include lines from other sources | # Test that -symbol-list-lines doesn't include lines from other sources | ||||
# by checking the first and last line, and making sure the other lines | # by checking the first and last line, and making sure the other lines | ||||
# are between 30 and 39. | # are between 30 and 39. | ||||
sline = line_number('symbol_list_lines_inline_test2.cpp', '// FUNC_gfunc2') | sline = line_number('symbol_list_lines_inline_test2.cpp', '// FUNC_gfunc2') | ||||
eline = line_number('symbol_list_lines_inline_test2.cpp', '// END_gfunc2') | eline = line_number('symbol_list_lines_inline_test2.cpp', '// END_gfunc2') | ||||
self.runCmd("-symbol-list-lines symbol_list_lines_inline_test2.cpp") | 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)) | 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') | ##sline = line_number('symbol_list_lines_inline_test.cpp', '// FUNC_gfunc') | ||||
##eline = line_number('symbol_list_lines_inline_test.cpp', '// STRUCT_s') | ##eline = line_number('symbol_list_lines_inline_test.cpp', '// STRUCT_s') | ||||
##self.runCmd("-symbol-list-lines symbol_list_lines_inline_test.cpp") | ##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)) | ##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 | # Test that -symbol-list-lines fails when file doesn't exist | ||||
self.runCmd("-symbol-list-lines unknown_file") | 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 \"") | self.expect("\^error,message=\"warning: No source filenames matched 'unknown_file'\. error: no source filenames matched any command arguments \"") | ||||
# Test that -symbol-list-lines fails when file is specified using relative path | # Test that -symbol-list-lines fails when file is specified using relative path | ||||
self.runCmd("-symbol-list-lines ./main.cpp") | self.runCmd("-symbol-list-lines ./main.cpp") | ||||
self.expect("\^error,message=\"warning: No source filenames matched '\./main\.cpp'\. error: no source filenames matched any command arguments \"") | self.expect("\^error,message=\"warning: No source filenames matched '\./main\.cpp'\. error: no source filenames matched any command arguments \"") | ||||
Show All 9 Lines |