summaryrefslogtreecommitdiffstats
path: root/lldb/test/tools/lldb-mi/symbol
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/test/tools/lldb-mi/symbol')
-rw-r--r--lldb/test/tools/lldb-mi/symbol/Makefile2
-rw-r--r--lldb/test/tools/lldb-mi/symbol/TestMiSymbol.py13
-rw-r--r--lldb/test/tools/lldb-mi/symbol/main.cpp8
-rw-r--r--lldb/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.cpp39
-rw-r--r--lldb/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.h24
-rw-r--r--lldb/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test2.cpp38
6 files changed, 121 insertions, 3 deletions
diff --git a/lldb/test/tools/lldb-mi/symbol/Makefile b/lldb/test/tools/lldb-mi/symbol/Makefile
index 314f1cb2f07..dde38f4e486 100644
--- a/lldb/test/tools/lldb-mi/symbol/Makefile
+++ b/lldb/test/tools/lldb-mi/symbol/Makefile
@@ -1,5 +1,5 @@
LEVEL = ../../../make
-CXX_SOURCES := main.cpp
+CXX_SOURCES := main.cpp symbol_list_lines_inline_test.cpp symbol_list_lines_inline_test2.cpp
include $(LEVEL)/Makefile.rules
diff --git a/lldb/test/tools/lldb-mi/symbol/TestMiSymbol.py b/lldb/test/tools/lldb-mi/symbol/TestMiSymbol.py
index cb8a3558bb2..227b836f841 100644
--- a/lldb/test/tools/lldb-mi/symbol/TestMiSymbol.py
+++ b/lldb/test/tools/lldb-mi/symbol/TestMiSymbol.py
@@ -39,6 +39,19 @@ class MiSymbolTestCase(lldbmi_testcase.MiTestCaseBase):
self.runCmd("-symbol-list-lines main.cpp")
self.expect("\^done,lines=\[\{pc=\"0x0*%x\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"\d+\"\})+\]" % (addr, line))
+ # 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
+ # are between 30 and 39.
+ sline = line_number('symbol_list_lines_inline_test2.cpp', '// FUNC_gfunc2')
+ 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\"\}\]" % (sline, eline))
+ ##FIXME: This doesn't work for symbol_list_lines_inline_test.cpp due to clang bug llvm.org/pr24716
+ ##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 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/test/tools/lldb-mi/symbol/main.cpp b/lldb/test/tools/lldb-mi/symbol/main.cpp
index 8abfd25467b..6d725a5759b 100644
--- a/lldb/test/tools/lldb-mi/symbol/main.cpp
+++ b/lldb/test/tools/lldb-mi/symbol/main.cpp
@@ -7,8 +7,12 @@
//
//===----------------------------------------------------------------------===//
+extern int j;
+extern int gfunc(int i);
+extern int gfunc2(int i);
int
-main(int argc, char const *argv[])
+main()
{ // FUNC_main
- return 0;
+ int i = gfunc(j) + gfunc2(j);
+ return i == 0;
}
diff --git a/lldb/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.cpp b/lldb/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.cpp
new file mode 100644
index 00000000000..c432ba8c477
--- /dev/null
+++ b/lldb/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.cpp
@@ -0,0 +1,39 @@
+// Skip lines so we can make sure we're not seeing any lines from
+// symbol_list_lines_inline_test.h included in -symbol-list-lines
+// symbol_list_lines_inline_test.cpp, by checking that all the lines
+// are between 30 and 39.
+// line 5
+// line 6
+// line 7
+// line 8
+// line 9
+// line 10
+// line 11
+// line 12
+// line 13
+// line 14
+// line 15
+// line 16
+// line 17
+// line 18
+// line 19
+// line 20
+// line 21
+// line 22
+// line 23
+// line 24
+// line 25
+// line 26
+// line 27
+// line 28
+// line 29
+#include "symbol_list_lines_inline_test.h"
+int
+gfunc(int i)
+{ // FUNC_gfunc
+ return ns::ifunc(i);
+}
+namespace ns
+{
+S s; // STRUCT_s
+}
diff --git a/lldb/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.h b/lldb/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.h
new file mode 100644
index 00000000000..1608642b0b3
--- /dev/null
+++ b/lldb/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.h
@@ -0,0 +1,24 @@
+namespace ns
+{
+inline int
+ifunc(int i)
+{
+ return i;
+}
+struct S
+{
+ int a;
+ int b;
+ S()
+ : a(3)
+ , b(4)
+ {
+ }
+ int
+ mfunc()
+ {
+ return a + b;
+ }
+};
+extern S s;
+}
diff --git a/lldb/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test2.cpp b/lldb/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test2.cpp
new file mode 100644
index 00000000000..cfedf47ad6b
--- /dev/null
+++ b/lldb/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test2.cpp
@@ -0,0 +1,38 @@
+// Skip lines so we can make sure we're not seeing any lines from
+// symbol_list_lines_inline_test.h included in -symbol-list-lines
+// symbol_list_lines_inline_test2.cpp, by checking that all the lines
+// are between 30 and 39.
+// line 5
+// line 6
+// line 7
+// line 8
+// line 9
+// line 10
+// line 11
+// line 12
+// line 13
+// line 14
+// line 15
+// line 16
+// line 17
+// line 18
+// line 19
+// line 20
+// line 21
+// line 22
+// line 23
+// line 24
+// line 25
+// line 26
+// line 27
+// line 28
+// line 29
+#include "symbol_list_lines_inline_test.h"
+int j = 2;
+int
+gfunc2(int i)
+{ // FUNC_gfunc2
+ i += ns::s.mfunc();
+ i += ns::ifunc(i);
+ return i == 0; // END_gfunc2
+}
OpenPOWER on IntegriCloud