summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/call-function
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2020-08-03 14:33:06 +0000
committerpatrick <patrick@openbsd.org>2020-08-03 14:33:06 +0000
commit061da546b983eb767bad15e67af1174fb0bcf31c (patch)
tree83c78b820819d70aa40c36d90447978b300078c5 /gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/call-function
parentImport LLVM 10.0.0 release including clang, lld and lldb. (diff)
downloadwireguard-openbsd-061da546b983eb767bad15e67af1174fb0bcf31c.tar.xz
wireguard-openbsd-061da546b983eb767bad15e67af1174fb0bcf31c.zip
Import LLVM 10.0.0 release including clang, lld and lldb.
ok hackroom tested by plenty
Diffstat (limited to 'gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/call-function')
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/call-function/Makefile3
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/call-function/TestCallCPPFunction.py35
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/call-function/main.cpp11
3 files changed, 49 insertions, 0 deletions
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/call-function/Makefile b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/call-function/Makefile
new file mode 100644
index 00000000000..99998b20bcb
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/call-function/Makefile
@@ -0,0 +1,3 @@
+CXX_SOURCES := main.cpp
+
+include Makefile.rules
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/call-function/TestCallCPPFunction.py b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/call-function/TestCallCPPFunction.py
new file mode 100644
index 00000000000..b6274b3d266
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/call-function/TestCallCPPFunction.py
@@ -0,0 +1,35 @@
+"""
+Tests calling a function by basename
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class CallCPPFunctionTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ TestBase.setUp(self)
+ self.line = line_number('main.cpp', '// breakpoint')
+
+ def test_with_run_command(self):
+ """Test calling a function by basename"""
+ self.build()
+ self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
+
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+
+ self.runCmd("process launch", RUN_SUCCEEDED)
+
+ # The stop reason of the thread should be breakpoint.
+ self.expect("thread list",
+ STOPPED_DUE_TO_BREAKPOINT,
+ substrs=['stopped', 'stop reason = breakpoint'])
+
+ self.expect("expression -- a_function_to_call()",
+ startstr="(int) $0 = 0")
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/call-function/main.cpp b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/call-function/main.cpp
new file mode 100644
index 00000000000..61a5e9d21ab
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/call-function/main.cpp
@@ -0,0 +1,11 @@
+#include <stdio.h>
+
+int a_function_to_call()
+{
+ return 0;
+}
+
+int main()
+{
+ printf("%d\n", a_function_to_call()); // breakpoint
+}