summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/lldb/packages/Python/lldbsuite/test/functionalities/rerun
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/functionalities/rerun
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/functionalities/rerun')
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/functionalities/rerun/Makefile3
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/functionalities/rerun/TestRerun.py60
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/functionalities/rerun/main.cpp5
3 files changed, 68 insertions, 0 deletions
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/functionalities/rerun/Makefile b/gnu/llvm/lldb/packages/Python/lldbsuite/test/functionalities/rerun/Makefile
new file mode 100644
index 00000000000..99998b20bcb
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/functionalities/rerun/Makefile
@@ -0,0 +1,3 @@
+CXX_SOURCES := main.cpp
+
+include Makefile.rules
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/functionalities/rerun/TestRerun.py b/gnu/llvm/lldb/packages/Python/lldbsuite/test/functionalities/rerun/TestRerun.py
new file mode 100644
index 00000000000..d2e5701f28e
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/functionalities/rerun/TestRerun.py
@@ -0,0 +1,60 @@
+"""
+Test that argdumper is a viable launching strategy.
+"""
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestRerun(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def test(self):
+ self.build()
+ exe = self.getBuildArtifact("a.out")
+
+ self.runCmd("target create %s" % exe)
+
+ # Create the target
+ target = self.dbg.CreateTarget(exe)
+
+ # Create any breakpoints we need
+ breakpoint = target.BreakpointCreateBySourceRegex(
+ 'break here', lldb.SBFileSpec("main.cpp", False))
+ self.assertTrue(breakpoint, VALID_BREAKPOINT)
+
+ self.runCmd("process launch 1 2 3")
+
+ process = self.process()
+ thread = lldbutil.get_one_thread_stopped_at_breakpoint(
+ process, breakpoint)
+ self.assertIsNotNone(
+ thread, "Process should be stopped at a breakpoint in main")
+ self.assertTrue(thread.IsValid(), "Stopped thread is not valid")
+
+ self.expect("frame variable argv[1]", substrs=['1'])
+ self.expect("frame variable argv[2]", substrs=['2'])
+ self.expect("frame variable argv[3]", substrs=['3'])
+
+ # Let program exit
+ self.runCmd("continue")
+
+ # Re-run with no args and make sure we still run with 1 2 3 as arguments as
+ # they should have been stored in "target.run-args"
+ self.runCmd("process launch")
+
+ process = self.process()
+ thread = lldbutil.get_one_thread_stopped_at_breakpoint(
+ process, breakpoint)
+
+ self.assertIsNotNone(
+ thread, "Process should be stopped at a breakpoint in main")
+ self.assertTrue(thread.IsValid(), "Stopped thread is not valid")
+
+ self.expect("frame variable argv[1]", substrs=['1'])
+ self.expect("frame variable argv[2]", substrs=['2'])
+ self.expect("frame variable argv[3]", substrs=['3'])
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/functionalities/rerun/main.cpp b/gnu/llvm/lldb/packages/Python/lldbsuite/test/functionalities/rerun/main.cpp
new file mode 100644
index 00000000000..cbef8d1e6da
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/functionalities/rerun/main.cpp
@@ -0,0 +1,5 @@
+int
+main (int argc, char const **argv)
+{
+ return 0; // break here
+}