[Lldb-commits] [PATCH] D85107: Add a test for 'b' (toggle breakpoint)
Luboš Luňák via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Aug 5 00:52:03 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGdb828aba55ac: [lldb][gui] add a test for 'b' (toggle breakpoint) (authored by llunak).
Herald added a project: LLDB.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D85107/new/
https://reviews.llvm.org/D85107
Files:
lldb/test/API/commands/gui/breakpoints/Makefile
lldb/test/API/commands/gui/breakpoints/TestGuiBreakpoints.py
lldb/test/API/commands/gui/breakpoints/main.c
Index: lldb/test/API/commands/gui/breakpoints/main.c
===================================================================
--- /dev/null
+++ lldb/test/API/commands/gui/breakpoints/main.c
@@ -0,0 +1,6 @@
+int main(int argc, char **argv) {
+ int var1 = 1; // First break here
+ int var2 = 2;
+ int var3 = 3;
+ return var1 + var2 + var3;
+}
Index: lldb/test/API/commands/gui/breakpoints/TestGuiBreakpoints.py
===================================================================
--- /dev/null
+++ lldb/test/API/commands/gui/breakpoints/TestGuiBreakpoints.py
@@ -0,0 +1,75 @@
+"""
+Test the 'gui' shortcut 'b' (toggle breakpoint).
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.lldbpexpect import PExpectTest
+
+class TestGuiBasicDebugCommandTest(PExpectTest):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ # PExpect uses many timeouts internally and doesn't play well
+ # under ASAN on a loaded machine..
+ @skipIfAsan
+ @skipIfCursesSupportMissing
+ @skipIfRemote # "run" command will not work correctly for remote debug
+ def test_gui(self):
+ self.build()
+
+ self.launch(executable=self.getBuildArtifact("a.out"), dimensions=(100,500))
+ self.expect('br set -o true -f main.c -p "// First break here"', substrs=["Breakpoint 1", "address ="])
+ self.expect("run", substrs=["stop reason ="])
+
+ self.child.sendline("breakpoint list")
+ self.child.expect_exact("No breakpoints currently set.")
+
+ escape_key = chr(27).encode()
+ down_key = chr(27)+'OB' # for vt100 terminal (lldbexpect sets TERM=vt100)
+
+ # Start the GUI and close the welcome window.
+ self.child.sendline("gui")
+ self.child.send(escape_key)
+ self.child.expect_exact("Sources") # wait for gui
+
+ # Go to next line, set a breakpoint.
+ self.child.send(down_key)
+ self.child.send('b')
+ self.child.send(escape_key)
+ self.expect_prompt()
+ self.child.sendline("breakpoint list")
+ self.child.expect("2: file = '[^']*main.c', line = 3,.*")
+ self.child.sendline("gui")
+ self.child.expect_exact("Sources")
+
+ # Go two lines down ("gui" resets position), set a breakpoint.
+ self.child.send(down_key)
+ self.child.send(down_key)
+ self.child.send('b')
+ self.child.send(escape_key)
+ self.expect_prompt()
+ self.child.sendline("breakpoint list")
+ self.child.expect("2: file = '[^']*main.c', line = 3,")
+ self.child.expect("3: file = '[^']*main.c', line = 4,")
+ self.child.sendline("gui")
+ self.child.expect_exact("Sources")
+
+ # Toggle both the breakpoints (remove them).
+ self.child.send(down_key)
+ self.child.send('b')
+ self.child.send(down_key)
+ self.child.send('b')
+ self.child.send(escape_key)
+ self.expect_prompt()
+ self.child.sendline("breakpoint list")
+ self.child.expect_exact("No breakpoints currently set.")
+ self.child.sendline("gui")
+ self.child.expect_exact("Sources")
+
+ # Press escape to quit the gui
+ self.child.send(escape_key)
+
+ self.expect_prompt()
+ self.quit()
Index: lldb/test/API/commands/gui/breakpoints/Makefile
===================================================================
--- /dev/null
+++ lldb/test/API/commands/gui/breakpoints/Makefile
@@ -0,0 +1,2 @@
+C_SOURCES := main.c
+include Makefile.rules
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85107.283152.patch
Type: text/x-patch
Size: 3549 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200805/c8d9befa/attachment.bin>
More information about the lldb-commits
mailing list