LEVEL = ../../make
-C_SOURCES := main.c a.c b.c loop.c locals.c
+CXX_SOURCES := main.cpp
include $(LEVEL)/Makefile.rules
+++ /dev/null
-"""
-Test that the lldb-mi driver understands an MI breakpoint command.
-"""
-
-import lldbmi_testcase
-from lldbtest import *
-import unittest2
-
-class MiBreakpointTestCase(lldbmi_testcase.MiTestCaseBase):
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_pendbreakonsym(self):
- """Test that 'lldb-mi --interpreter' works for pending symbol breakpoints."""
-
- self.spawnLldbMi(args = None)
-
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- self.runCmd("-break-insert -f b_MyFunction")
- self.expect("\^done,bkpt={number=\"1\"")
-
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"exited-normally\"")
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_pendbreakonsrc(self):
- """Test that 'lldb-mi --interpreter' works for pending source breakpoints."""
-
- self.spawnLldbMi(args = None)
-
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Find the line number to break inside main() and set
- # pending BP
- line = line_number('main.c', '//BP_source')
- self.runCmd("-break-insert -f main.c:%d" % line)
- self.expect("\^done,bkpt={number=\"1\"")
-
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"exited-normally\"")
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_breakpoints(self):
- """Test that 'lldb-mi --interpreter' works for breakpoints."""
-
- self.spawnLldbMi(args = None)
-
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
-
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Break on symbol
- self.runCmd("-break-insert b_MyFunction")
- self.expect("\^done,bkpt={number=\"2\"")
-
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Break on source
- line = line_number('main.c', '//BP_source')
- self.runCmd("-break-insert main.c:%d" % line)
- self.expect("\^done,bkpt={number=\"3\"")
-
- # Check with full path. TODO, figure out why this commands fails
- # if -f is not given
- line = line_number('main.c', '// BP_doloop')
- full_path = os.path.join(os.getcwd(), "main.c")
- self.runCmd("-break-insert -f %s:%d" % (full_path, line))
- self.expect("\^done,bkpt={number=\"4\"")
-
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Run to exit
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"exited-normally\"")
-
-if __name__ == '__main__':
- unittest2.main()
"""
-Test that the lldb-mi driver works properly with "-gdb-exit".
+Test that the lldb-mi driver exits properly.
"""
import lldbmi_testcase
class MiExitTestCase(lldbmi_testcase.MiTestCaseBase):
+ mydir = TestBase.compute_mydir(__file__)
+
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_gdbexit(self):
- """Test that '-gdb-exit' terminates debug session and exits."""
+ def test_lldbmi_gdb_exit(self):
+ """Test that '-gdb-exit' terminates local debug session and exits."""
self.spawnLldbMi(args = None)
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_quit(self):
"""Test that 'quit' exits immediately."""
"""
-Test various ways the lldb-mi driver can launch a program.
+Test lldb-mi -file-xxx commands.
"""
import lldbmi_testcase
from lldbtest import *
import unittest2
-class MiLaunchTestCase(lldbmi_testcase.MiTestCaseBase):
+class MiFileTestCase(lldbmi_testcase.MiTestCaseBase):
+
+ mydir = TestBase.compute_mydir(__file__)
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_exe(self):
+ def test_lldbmi_file_exec_and_symbols_file(self):
"""Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols exe."""
self.spawnLldbMi(args = None)
- # Use no path
+ # Test that -file-exec-and-symbols works for filename
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
+ # Run
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"exited-normally\"")
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_abspathexe(self):
+ def test_lldbmi_file_exec_and_symbols_absolute_path(self):
"""Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols fullpath/exe."""
self.spawnLldbMi(args = None)
- # Use full path
+ # Test that -file-exec-and-symbols works for absolute path
import os
- exe = os.path.join(os.getcwd(), self.myexe)
- self.runCmd("-file-exec-and-symbols %s" % exe)
+ path = os.path.join(os.getcwd(), self.myexe)
+ self.runCmd("-file-exec-and-symbols \"%s\"" % path)
self.expect("\^done")
+ # Run
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"exited-normally\"")
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_relpathexe(self):
+ def test_lldbmi_file_exec_and_symbols_relative_path(self):
"""Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols relpath/exe."""
self.spawnLldbMi(args = None)
- # Use relative path
- exe = "../../" + self.mydir + "/" + self.myexe
- self.runCmd("-file-exec-and-symbols %s" % exe)
+ # Test that -file-exec-and-symbols works for relative path
+ path = "./%s" % self.myexe
+ self.runCmd("-file-exec-and-symbols %s" % path)
self.expect("\^done")
+ # Run
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"exited-normally\"")
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_badpathexe(self):
+ def test_lldbmi_file_exec_and_symbols_unknown_path(self):
"""Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols badpath/exe."""
self.spawnLldbMi(args = None)
- # Use non-existant path
- exe = "badpath/" + self.myexe
- self.runCmd("-file-exec-and-symbols %s" % exe)
+ # Test that -file-exec-and-symbols fails on unknown path
+ path = "unknown_dir/%s" % self.myexe
+ self.runCmd("-file-exec-and-symbols %s" % path)
self.expect("\^error")
if __name__ == '__main__':
"""
-Test that the lldb-mi driver works with -interpreter-exec command
+Test lldb-mi -interpreter-exec command.
"""
import lldbmi_testcase
class MiInterpreterExecTestCase(lldbmi_testcase.MiTestCaseBase):
+ mydir = TestBase.compute_mydir(__file__)
+
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@unittest2.skip("lldb-mi handles double quotes in passed app path incorrectly")
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_breakpoint_set(self):
"""Test that 'lldb-mi --interpreter' can set breakpoint by 'breakpoint set' command."""
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_settings_set_target_run_args_before(self):
"""Test that 'lldb-mi --interpreter' can set target arguments by 'setting set target.run-args' command before than target was created."""
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
- # Run to BP_argctest
- line = line_number('main.c', '//BP_argctest')
- self.runCmd("-break-insert --file main.c:%d" % line)
- self.expect("\^done")
+ # Run
self.runCmd("-exec-run")
self.expect("\^running")
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_settings_set_target_run_args_after(self):
"""Test that 'lldb-mi --interpreter' can set target arguments by 'setting set target.run-args' command after than target was created."""
self.runCmd("-interpreter-exec console \"setting set target.run-args arg1\"")
self.expect("\^done")
- # Run to BP_argctest
- line = line_number('main.c', '//BP_argctest')
- self.runCmd("-break-insert --file main.c:%d" % line)
- self.expect("\^done")
+ # Run
self.runCmd("-exec-run")
self.expect("\^running")
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_process_launch(self):
"""Test that 'lldb-mi --interpreter' can launch process by "process launch" command."""
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_thread_step_in(self):
"""Test that 'lldb-mi --interpreter' can step in by "thread step-in" command."""
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_thread_step_over(self):
"""Test that 'lldb-mi --interpreter' can step over by "thread step-over" command."""
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_thread_continue(self):
"""Test that 'lldb-mi --interpreter' can continue execution by "thread continue" command."""
+++ /dev/null
-"""
-Test that the lldb-mi driver can interrupt and resume a looping app.
-"""
-
-import lldbmi_testcase
-from lldbtest import *
-import unittest2
-
-class MiInterruptTestCase(lldbmi_testcase.MiTestCaseBase):
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
- def test_lldbmi_interrupt(self):
- """Test that 'lldb-mi --interpreter' interrupt and resume a looping app."""
-
- self.spawnLldbMi(args = None)
-
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Set doloop=1 and run (to loop forever)
- self.runCmd("-data-evaluate-expression \"doloop=1\"")
- self.expect("value=\"1\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
-
- # Issue interrupt, set BP in loop (marked BP_loop), and resume
- self.runCmd("-exec-interrupt")
- self.expect("\*stopped,reason=\"signal-received\"")
- line = line_number('loop.c', '//BP_loop')
- self.runCmd("-break-insert loop.c:%d" % line)
- self.expect("\^done,bkpt={number=\"2\"")
- #self.runCmd("-exec-resume") #FIXME: command not recognized
- self.runCmd("-exec-continue")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # We should have hit BP
- # Set loop=-1 so we'll exit the loop
- self.runCmd("-data-evaluate-expression \"loop=-1\"")
- self.expect("value=\"-1\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"exited-normally\"")
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @unittest2.skip("lldb-mi how to send cntl-C to app?")
- @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
- def test_lldbmi_cntlC(self):
- """Test that 'lldb-mi --interpreter' cntl-C interrupts app."""
-
- self.spawnLldbMi(args = None)
-
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Set doloop=1 and run (to loop forever)
- self.runCmd("-var-create var2 --thread 1 --frame 0 * \"doloop=1\"")
- self.expect("value=\"1\",type=\"int\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
-
- # Issue interrupt, set a bp, and resume
- #FIXME: how to runCmd cntl-C?
- self.runCmd("-exec-interrupt") # or cntl-c
- self.expect("\*stopped,reason=\"signal-received\"")
- self.runCmd("-break-insert loop.c:11")
- self.expect("\^done,bkpt={number=\"2\"")
- self.runCmd("-exec-continue")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # We should be sitting at loop.c:12
- # Set loop=-1 so we'll exit the loop
- self.runCmd("-data-evaluate-expression \"loop=-1\"")
- self.expect("value=\"-1\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"exited-normally\"")
-
-if __name__ == '__main__':
- unittest2.main()
--- /dev/null
+"""
+Test that the lldb-mi driver prints prompt properly.
+"""
+
+import lldbmi_testcase
+from lldbtest import *
+import unittest2
+
+class MiPromptTestCase(lldbmi_testcase.MiTestCaseBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ @lldbmi_test
+ @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ def test_lldbmi_prompt(self):
+ """Test that 'lldb-mi --interpreter' echos '(gdb)' after commands and events."""
+
+ self.spawnLldbMi(args = None)
+
+ # Test that lldb-mi is ready after startup
+ self.expect(self.child_prompt, exactly = True)
+
+ # Test that lldb-mi is ready after unknown command
+ self.runCmd("-unknown-command")
+ self.expect("\^error,msg=\"Driver\. Received command '-unknown-command'\. It was not handled\. Command 'unknown-command' not in Command Factory\"")
+ self.expect(self.child_prompt, exactly = True)
+
+ # Test that lldb-mi is ready after -file-exec-and-symbols
+ self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+ self.expect("\^done")
+ self.expect(self.child_prompt, exactly = True)
+
+ # Test that lldb-mi is ready after -break-insert
+ self.runCmd("-break-insert -f main")
+ self.expect("\^done,bkpt={number=\"1\"")
+ self.expect(self.child_prompt, exactly = True)
+
+ # Test that lldb-mi is ready after -exec-run
+ self.runCmd("-exec-run")
+ self.expect("\*running")
+ self.expect(self.child_prompt, exactly = True)
+
+ # Test that lldb-mi is ready after BP hit
+ self.expect("\*stopped,reason=\"breakpoint-hit\"")
+ self.expect(self.child_prompt, exactly = True)
+
+ # Test that lldb-mi is ready after -exec-continue
+ self.runCmd("-exec-continue")
+ self.expect("\^running")
+ self.expect(self.child_prompt, exactly = True)
+
+ # Test that lldb-mi is ready after program exited
+ self.expect("\*stopped,reason=\"exited-normally\"")
+ self.expect(self.child_prompt, exactly = True)
+
+if __name__ == '__main__':
+ unittest2.main()
class MiSyntaxTestCase(lldbmi_testcase.MiTestCaseBase):
+ mydir = TestBase.compute_mydir(__file__)
+
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_tokens(self):
- """Test that 'lldb-mi --interpreter' echos command tokens."""
+ """Test that 'lldb-mi --interpreter' prints command tokens."""
self.spawnLldbMi(args = None)
self.expect("000\^done")
# Run to main
- self.runCmd("100000001-break-insert -f b_MyFunction")
+ self.runCmd("100000001-break-insert -f main")
self.expect("100000001\^done,bkpt={number=\"1\"")
self.runCmd("2-exec-run")
self.expect("2\^running")
self.expect("\^done")
# Check that it was loaded correctly
- self.runCmd("-break-insert -f a_MyFunction")
+ self.runCmd("-break-insert -f main")
self.expect("\^done,bkpt={number=\"1\"")
self.runCmd("-exec-run")
self.expect("\^running")
+++ /dev/null
-#include <stdio.h>
-
-int
-a_MyFunction ()
-{
- printf ("a is about to return 10.\n"); //BP_a_MyFunction
- return 10;
-}
+++ /dev/null
-#include <stdio.h>
-
-extern int a_MyFunction();
-int
-b_MyFunction ()
-{
- (void)a_MyFunction(); //BP_b_MyFunction
- printf ("b is about to return 20.\n");
- return 20;
-}
--- /dev/null
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
--- /dev/null
+"""
+Test lldb-mi -break-xxx commands.
+"""
+
+import lldbmi_testcase
+from lldbtest import *
+import unittest2
+
+class MiBreakTestCase(lldbmi_testcase.MiTestCaseBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ @lldbmi_test
+ @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ def test_lldbmi_break_insert_function_pending(self):
+ """Test that 'lldb-mi --interpreter' works for pending function breakpoints."""
+
+ self.spawnLldbMi(args = None)
+
+ self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+ self.expect("\^done")
+
+ self.runCmd("-break-insert -f g_MyFunction")
+ self.expect("\^done,bkpt={number=\"1\"")
+
+ self.runCmd("-exec-run")
+ self.expect("\^running")
+ self.expect("\*stopped,reason=\"breakpoint-hit\"")
+
+ @lldbmi_test
+ @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ def test_lldbmi_break_insert_function(self):
+ """Test that 'lldb-mi --interpreter' works for function breakpoints."""
+
+ self.spawnLldbMi(args = None)
+
+ self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+ self.expect("\^done")
+
+ self.runCmd("-break-insert -f main")
+ self.expect("\^done,bkpt={number=\"1\"")
+
+ self.runCmd("-exec-run")
+ self.expect("\^running")
+ self.expect("\*stopped,reason=\"breakpoint-hit\"")
+
+ self.runCmd("-break-insert g_MyFunction")
+ self.expect("\^done,bkpt={number=\"2\"")
+
+ self.runCmd("-exec-continue")
+ self.expect("\^running")
+ self.expect("\*stopped,reason=\"breakpoint-hit\"")
+
+ @lldbmi_test
+ @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ def test_lldbmi_break_insert_file_line_pending(self):
+ """Test that 'lldb-mi --interpreter' works for pending file:line breakpoints."""
+
+ self.spawnLldbMi(args = None)
+
+ self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+ self.expect("\^done")
+
+ # Find the line number to break inside main() and set
+ # pending BP
+ line = line_number('main.cpp', '// BP_return')
+ self.runCmd("-break-insert -f main.cpp:%d" % line)
+ self.expect("\^done,bkpt={number=\"1\"")
+
+ self.runCmd("-exec-run")
+ self.expect("\^running")
+ self.expect("\*stopped,reason=\"breakpoint-hit\"")
+
+ @lldbmi_test
+ @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ def test_lldbmi_break_insert_file_line(self):
+ """Test that 'lldb-mi --interpreter' works for file:line breakpoints."""
+
+ self.spawnLldbMi(args = None)
+
+ self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+ self.expect("\^done")
+
+ self.runCmd("-break-insert -f main")
+ self.expect("\^done,bkpt={number=\"1\"")
+
+ self.runCmd("-exec-run")
+ self.expect("\^running")
+ self.expect("\*stopped,reason=\"breakpoint-hit\"")
+
+ line = line_number('main.cpp', '// BP_return')
+ self.runCmd("-break-insert main.cpp:%d" % line)
+ self.expect("\^done,bkpt={number=\"2\"")
+
+ self.runCmd("-exec-continue")
+ self.expect("\^running")
+ self.expect("\*stopped,reason=\"breakpoint-hit\"")
+
+ @lldbmi_test
+ @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @unittest2.expectedFailure("-break-insert doesn't work for absolute path")
+ def test_lldbmi_break_insert_file_line_absolute_path(self):
+ """Test that 'lldb-mi --interpreter' works for file:line breakpoints."""
+
+ self.spawnLldbMi(args = None)
+
+ self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+ self.expect("\^done")
+
+ self.runCmd("-break-insert -f main")
+ self.expect("\^done,bkpt={number=\"1\"")
+
+ self.runCmd("-exec-run")
+ self.expect("\^running")
+ self.expect("\*stopped,reason=\"breakpoint-hit\"")
+
+ import os
+ path = os.path.join(os.getcwd(), "main.cpp")
+ line = line_number('main.cpp', '// BP_return')
+ self.runCmd("-break-insert %s:%d" % (path, line))
+ self.expect("\^done,bkpt={number=\"2\"")
+
+ self.runCmd("-exec-continue")
+ self.expect("\^running")
+ self.expect("\*stopped,reason=\"breakpoint-hit\"")
+
+if __name__ == '__main__':
+ unittest2.main()
--- /dev/null
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+void
+g_MyFunction(void)
+{
+}
+
+int
+main(int argc, char const *argv[])
+{
+ g_MyFunction();
+ return 0; // BP_return
+}
--- /dev/null
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
"""
-Test that the lldb-mi driver works with -exec-xxx commands
+Test lldb-mi -exec-xxx commands.
"""
import lldbmi_testcase
class MiExecTestCase(lldbmi_testcase.MiTestCaseBase):
+ mydir = TestBase.compute_mydir(__file__)
+
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@unittest2.skip("-exec-abort isn't implemented")
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_exec_arguments_set(self):
"""Test that 'lldb-mi --interpreter' can pass args using -exec-arguments."""
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_exec_arguments_reset(self):
"""Test that 'lldb-mi --interpreter' can reset previously set args using -exec-arguments."""
self.expect("\^done")
# Set arguments
- self.runCmd("-exec-arguments foo bar baz")
+ self.runCmd("-exec-arguments arg1")
self.expect("\^done")
self.runCmd("-exec-arguments")
self.expect("\^done")
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_exec_next(self):
"""Test that 'lldb-mi --interpreter' works for stepping."""
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- # Warning: the following is sensative to the lines in the source.
+ # Warning: the following is sensative to the lines in the source
# Test -exec-next
self.runCmd("-exec-next --thread 1 --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"26\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"29\"")
# Test that --thread is optional
self.runCmd("-exec-next --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"27\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"30\"")
# Test that --frame is optional
self.runCmd("-exec-next --thread 1")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"29\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"31\"")
# Test that both --thread and --frame are optional
- self.runCmd("-exec-next --thread 1")
+ self.runCmd("-exec-next")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"31\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"32\"")
# Test that an invalid --thread is handled
self.runCmd("-exec-next --thread 0")
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_exec_next_instruction(self):
"""Test that 'lldb-mi --interpreter' works for instruction stepping."""
# Test -exec-next-instruction
self.runCmd("-exec-next-instruction --thread 1 --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"24\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"28\"")
# Test that --thread is optional
self.runCmd("-exec-next-instruction --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"24\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"28\"")
# Test that --frame is optional
self.runCmd("-exec-next-instruction --thread 1")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"24\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"29\"")
# Test that both --thread and --frame are optional
- self.runCmd("-exec-next-instruction --thread 1")
+ self.runCmd("-exec-next-instruction")
self.expect("\^running")
- # Depending on compiler, it can stop at different line.
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"2[4-6]\"")
+ # Depending on compiler, it can stop at different line
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"29\"")
# Test that an invalid --thread is handled
self.runCmd("-exec-next-instruction --thread 0")
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_exec_step(self):
"""Test that 'lldb-mi --interpreter' works for stepping into."""
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
- # Run to printf call
- line = line_number('main.c', '//BP_printf_call')
- self.runCmd("-break-insert -f main.c:%d" % line)
+ # Run to main
+ self.runCmd("-break-insert -f main")
self.expect("\^done,bkpt={number=\"1\"")
self.runCmd("-exec-run")
self.expect("\^running")
#FIXME: is this supposed to step into printf?
self.runCmd("-exec-step --thread 1 --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"26\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"29\"")
- # Test that -exec-step steps into a_MyFunction and back out
+ # Test that -exec-step steps into g_MyFunction and back out
# (and that --thread is optional)
self.runCmd("-exec-step --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"a_MyFunction\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"g_MyFunction\(\)\"")
#FIXME: is this supposed to step into printf?
self.runCmd("-exec-step --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"a_MyFunction\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"g_MyFunction\(\)\"")
# Use -exec-finish here to make sure that control reaches the caller.
- # -exec-step can keep us in the a_MyFunction for gcc
+ # -exec-step can keep us in the g_MyFunction for gcc
self.runCmd("-exec-finish --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"26\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"30\"")
+
+ # Test that -exec-step steps into s_MyFunction
self.runCmd("-exec-step --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"27\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"s_MyFunction\(\)\"")
- # Test that -exec-step steps into b_MyFunction
+ # Test that -exec-step steps into g_MyFunction
# (and that --frame is optional)
self.runCmd("-exec-step --thread 1")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"b_MyFunction\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"g_MyFunction\(\)\"")
- # Test that -exec-step steps into a_MyFunction from inside
- # b_MyFunction (and that both --thread and --frame are optional)
+ # Test that -exec-step steps into g_MyFunction from inside
+ # s_MyFunction (and that both --thread and --frame are optional)
self.runCmd("-exec-step")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"a_MyFunction\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"g_MyFunction\(\)\"")
# Test that an invalid --thread is handled
self.runCmd("-exec-step --thread 0")
# Warning: the following is sensative to the lines in the
# source and optimizations
- # Run to a_MyFunction call
- line = line_number('main.c', '//BP_a_MyFunction_call')
- self.runCmd("-break-insert -f main.c:%d" % line)
+ # Run to main
+ self.runCmd("-break-insert -f main")
self.expect("\^done,bkpt={number=\"1\"")
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
+ # Test that -exec-next steps over printf
+ self.runCmd("-exec-next --thread 1 --frame 0")
+ self.expect("\^running")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"29\"")
+
# Test that -exec-step-instruction steps over non branching
# instruction
self.runCmd("-exec-step-instruction --thread 1 --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"2[4-6]\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"2[8-9]\"")
- # Test that -exec-step-instruction steps over non branching
+ # Test that -exec-step-instruction steps into g_MyFunction
# instruction (and that --thread is optional)
self.runCmd("-exec-step-instruction --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"2[4-6]\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"g_MyFunction\(\)\"")
- # Test that -exec-step-instruction steps into a_MyFunction
+ # Test that -exec-step-instruction steps over non branching
# (and that --frame is optional)
self.runCmd("-exec-step-instruction --thread 1")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"a_MyFunction\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"g_MyFunction\(\)\"")
- # Test that -exec-step-instruction steps into a_MyFunction
+ # Test that -exec-step-instruction steps into g_MyFunction
# (and that both --thread and --frame are optional)
- self.runCmd("-exec-step-instruction --thread 1")
+ self.runCmd("-exec-step-instruction")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"a_MyFunction\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"g_MyFunction\(\)\"")
# Test that an invalid --thread is handled
self.runCmd("-exec-step-instruction --thread 0")
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_exec_finish(self):
"""Test that 'lldb-mi --interpreter' works for -exec-finish."""
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
- # Set argument 'l'
- self.runCmd("-exec-arguments l")
- self.expect("\^done")
-
- # Set BP at a_MyFunction_call and run to BP
- self.runCmd("-break-insert -f a_MyFunction")
+ # Set BP at g_MyFunction and run to BP
+ self.runCmd("-break-insert -f g_MyFunction")
self.expect("\^done,bkpt={number=\"1\"")
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- # Test that -exec-finish returns from a_MyFunction
+ # Test that -exec-finish returns from g_MyFunction
self.runCmd("-exec-finish --thread 1 --frame 0")
self.expect("\^running")
self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"main\"")
- # Run to BP inside b_MyFunction call
- line = line_number('b.c', '//BP_b_MyFunction')
- self.runCmd("-break-insert -f b.c:%d" % line)
+ # Run to BP inside s_MyFunction call
+ self.runCmd("-break-insert s_MyFunction")
self.expect("\^done,bkpt={number=\"2\"")
self.runCmd("-exec-continue")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- # Test that -exec-finish hits BP at a_MyFunction call inside
- # b_MyFunction (and that --thread is optional)
+ # Test that -exec-finish hits BP at g_MyFunction call inside
+ # s_MyFunction (and that --thread is optional)
self.runCmd("-exec-finish --frame 0")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- # Test that -exec-finish returns from a_MyFunction call inside
- # b_MyFunction (and that --frame is optional)
+ # Test that -exec-finish returns from g_MyFunction call inside
+ # s_MyFunction (and that --frame is optional)
self.runCmd("-exec-finish --thread 1")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"b_MyFunction\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"s_MyFunction\(\)\"")
- # Test that -exec-finish returns from b_MyFunction
+ # Test that -exec-finish returns from s_MyFunction
# (and that both --thread and --frame are optional)
self.runCmd("-exec-finish")
self.expect("\^running")
# Set BP at printf and run to BP
# FIXME: BP at printf not resolved and never hit!
- self.runCmd("-interpreter-exec command \"b printf\"") #FIXME: self.runCmd("-break-insert -f printf")
- self.expect("\^done") #FIXME: self.expect("\^done,bkpt={number=\"3\"")
+ self.runCmd("-interpreter-exec command \"breakpoint set --name printf\"") #FIXME: self.runCmd("-break-insert -f printf")
+ self.expect("\^done") #FIXME: self.expect("\^done,bkpt={number=\"3\"")
self.runCmd("-exec-continue")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
--- /dev/null
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <cstdio>
+
+void
+g_MyFunction(void)
+{
+ printf("g_MyFunction");
+}
+
+static void
+s_MyFunction(void)
+{
+ g_MyFunction();
+ printf("s_MyFunction");
+}
+
+int
+main(int argc, char const *argv[])
+{
+ printf("start");
+ g_MyFunction();
+ s_MyFunction();
+ printf("exit");
+ return 0;
+}
--- /dev/null
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
"""
-Test that the lldb-mi driver works with -data-xxx commands
+Test lldb-mi -data-xxx commands.
"""
import lldbmi_testcase
class MiDataTestCase(lldbmi_testcase.MiTestCaseBase):
+ mydir = TestBase.compute_mydir(__file__)
+
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_data_disassemble(self):
"""Test that 'lldb-mi --interpreter' works for -data-disassemble."""
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
+ @unittest2.skip("-data-evaluate-expression doesn't work") #FIXME: the global case worked before refactoring
def test_lldbmi_data_read_memory_bytes(self):
"""Test that 'lldb-mi --interpreter' works for -data-read-memory-bytes."""
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- # Get address of s_RawData
- self.runCmd("-data-evaluate-expression &s_RawData")
- self.expect("\^done,value=\"0x[0-9a-f]+\"",timeout=1)
+ # Get address of char[] (global)
+ self.runCmd("-data-evaluate-expression &g_CharArray")
+ self.expect("\^done,value=\"0x[0-9a-f]+\"")
+ addr = int(self.child.after.split("\"")[1], 16)
+ size = 5
+
+ # Test that -data-read-memory-bytes works for char[] type (global)
+ self.runCmd("-data-read-memory-bytes %#x %d" % (addr, size))
+ self.expect("\^done,memory=\[{begin=\"0x0*%x\",offset=\"0x0+\",end=\"0x0*%x\",contents=\"1112131400\"}\]" % (addr, addr + size))
+
+ # Get address of static char[]
+ self.runCmd("-data-evaluate-expression &s_CharArray")
+ self.expect("\^done,value=\"0x[0-9a-f]+\"")
addr = int(self.child.after.split("\"")[1], 16)
size = 5
- # Test -data-read-memory-bytes: try to read data of s_RawData
+ # Test that -data-read-memory-bytes works for static char[] type
self.runCmd("-data-read-memory-bytes %#x %d" % (addr, size))
- self.expect("\^done,memory=\[{begin=\"0x0*%x\",offset=\"0x0+\",end=\"0x0*%x\",contents=\"1234567800\"}\]" % (addr, addr + size))
+ self.expect("\^done,memory=\[{begin=\"0x0*%x\",offset=\"0x0+\",end=\"0x0*%x\",contents=\"1112131400\"}\]" % (addr, addr + size))
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_data_list_register_names(self):
"""Test that 'lldb-mi --interpreter' works for -data-list-register-names."""
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_data_list_register_values(self):
"""Test that 'lldb-mi --interpreter' works for -data-list-register-values."""
--- /dev/null
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+const char g_CharArray[] = "\x10\x11\x12\x13";
+static const char s_CharArray[] = "\x20\x21\x22\x23";
+
+int
+main(int argc, char const *argv[])
+{
+ return 0;
+}
class MiTestCaseBase(Base):
- mydir = Base.compute_mydir(__file__)
+ mydir = Base.compute_mydir(__file__) #TODO remove me
myexe = "a.out"
mylog = "child.log"
+++ /dev/null
-struct inner
-{
- int var_d;
-};
-
-struct my_type
-{
- int var_a;
- char var_b;
- struct inner inner_;
-};
-
-int local_struct_test(void)
-{
- struct my_type var_c;
- var_c.var_a = 10;
- var_c.var_b = 'a';
- var_c.inner_.var_d = 30;
- return 0; // BP_LOCAL_STRUCT
-}
-
-int local_array_test(void)
-{
- int array[3];
- array[0] = 100;
- array[1] = 200;
- array[2] = 300;
- return 0; // BP_LOCAL_ARRAY
-}
-
-int local_pointer_test(void)
-{
- const char* test_str = "Rakaposhi";
- int var_e = 24;
- int *ptr = &var_e;
- return 0; // BP_LOCAL_PTR
-}
-
-int local_test()
-{
- local_struct_test();
- local_array_test();
- local_pointer_test();
- return 0;
-}
\ No newline at end of file
+++ /dev/null
-#include <unistd.h>
-int
-infloop ()
-{
- int loop = 1;
- while (loop > 0) {
- if (loop > 10) {
- sleep(1);
- loop = 1;
- }
- loop++; //BP_loop
- }
- return loop;
-}
+++ /dev/null
-//===-- main.c --------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include <stdio.h>
-extern int a_MyFunction();
-extern int b_MyFunction();
-extern int infloop();
-extern int local_test();
-int doloop, dosegfault;
-int g_MyVar = 3;
-static int s_MyVar = 4;
-//FIXME -data-evaluate-expression/print can't evaluate value of type "static char[]"
-const char s_RawData[] = "\x12\x34\x56\x78"; //FIXME static const char s_RawData[] = "\x12\x34\x56\x78";
-
-int main (int argc, char const *argv[])
-{ //FUNC_main
- int a, b;
- printf("argc=%d\n", argc); //BP_printf_call
- //BP_argctest
- a = a_MyFunction(); //BP_a_MyFunction_call
- b = b_MyFunction(); //BP_b_MyFunction_call
- //BP_localstest -- it must be at line #24 (or fix it in main*.micmds)
- if (doloop) // BP_doloop
- infloop();
- if (dosegfault)
- *(volatile int *)NULL = 1;
- if (argc > 1 && *argv[1] == 'l') {
- a++;
- printf("a=%d, argv[1]=%s\n", a, argv[1]); //BP_argtest
- }
- s_MyVar = a + b;
- local_test();
- return a + b - s_MyVar; //BP_source
-}
--- /dev/null
+//===-- main.c --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <cstdio>
+
+int
+main(int argc, char const *argv[])
+{
+ printf("argc=%d\n", argc);
+ return 0;
+}
--- /dev/null
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
"""
-Test that the lldb-mi driver nofities user properly.
+Test that the lldb-mi handles signals properly.
"""
import lldbmi_testcase
from lldbtest import *
import unittest2
-class MiNotificationTestCase(lldbmi_testcase.MiTestCaseBase):
+class MiSignalTestCase(lldbmi_testcase.MiTestCaseBase):
+
+ mydir = TestBase.compute_mydir(__file__)
@lldbmi_test
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_prompt(self):
- """Test that 'lldb-mi --interpreter' echos '(gdb)' after commands and events."""
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_lldbmi_stopped_when_interrupt(self):
+ """Test that 'lldb-mi --interpreter' interrupt and resume a looping app."""
self.spawnLldbMi(args = None)
- # Test that lldb-mi is ready after startup
- self.expect(self.child_prompt, exactly = True)
-
- # Test that lldb-mi is ready after unknown command
- self.runCmd("-unknown-command")
- self.expect("\^error,msg=\"Driver\. Received command '-unknown-command'\. It was not handled\. Command 'unknown-command' not in Command Factory\"")
- self.expect(self.child_prompt, exactly = True)
-
- # Test that lldb-mi is ready after -file-exec-and-symbols
+ # Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
- self.expect(self.child_prompt, exactly = True)
- # Test that lldb-mi is ready after -break-insert
- self.runCmd("-break-insert -f b_MyFunction")
+ # Run to main
+ self.runCmd("-break-insert -f main")
self.expect("\^done,bkpt={number=\"1\"")
- self.expect(self.child_prompt, exactly = True)
-
- # Test that lldb-mi is ready after -exec-run
self.runCmd("-exec-run")
- self.expect("\*running")
- self.expect(self.child_prompt, exactly = True)
-
- # Test that lldb-mi is ready after BP hit
+ self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- self.expect(self.child_prompt, exactly = True)
- # Test that lldb-mi is ready after -exec-continue
+ # Set doloop=1 and run (to loop forever)
+ self.runCmd("-data-evaluate-expression \"do_loop=1\"")
+ self.expect("\^done,value=\"1\"")
+ self.runCmd("-exec-continue")
+ self.expect("\^running")
+
+ # Test that -exec-interrupt can interrupt an execution
+ self.runCmd("-exec-interrupt")
+ self.expect("\*stopped,reason=\"signal-received\"")
+
+ # Continue (to loop forever)
self.runCmd("-exec-continue")
self.expect("\^running")
- self.expect(self.child_prompt, exactly = True)
- # Test that lldb-mi is ready after program exited
- self.expect("\*stopped,reason=\"exited-normally\"")
- self.expect(self.child_prompt, exactly = True)
+ # Test that Ctrl+C can interrupt an execution
+ self.child.sendintr() #FIXME: here uses self.child directly
+ self.expect("\*stopped,reason=\"signal-received\"")
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Fails on FreeBSD apparently due to thread race conditions
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_stopped_when_stopatentry_local(self):
"""Test that 'lldb-mi --interpreter' notifies after it was stopped on entry (local)."""
# Prepare debugserver
import os, sys
- lldb_gdbserver_folder = os.path.abspath(os.path.join(os.path.dirname(os.getcwd()), "lldb-gdbserver"))
+ lldb_gdbserver_folder = os.path.abspath(os.path.join(os.getcwd(), "../../lldb-gdbserver"))
sys.path.append(lldb_gdbserver_folder)
import lldbgdbserverutils
debugserver_exe = lldbgdbserverutils.get_debugserver_exe()
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_stopped_when_segfault_local(self):
"""Test that 'lldb-mi --interpreter' notifies after it was stopped when segfault occurred (local)."""
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- # Set dosegfault=1 and run (to cause a segfault error)
- self.runCmd("-data-evaluate-expression \"dosegfault=1\"")
+ # Set do_segfault=1 and run (to cause a segfault error)
+ self.runCmd("-data-evaluate-expression \"do_segfault=1\"")
self.expect("\^done,value=\"1\"")
self.runCmd("-exec-continue")
self.expect("\^running")
# Prepare debugserver
import os, sys
- lldb_gdbserver_folder = os.path.abspath(os.path.join(os.path.dirname(os.getcwd()), "lldb-gdbserver"))
+ lldb_gdbserver_folder = os.path.abspath(os.path.join(os.getcwd(), "../../lldb-gdbserver"))
sys.path.append(lldb_gdbserver_folder)
import lldbgdbserverutils
debugserver_exe = lldbgdbserverutils.get_debugserver_exe()
self.expect("\^done") #FIXME: self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- # Set dosegfault=1 and run (to cause a segfault error)
- self.runCmd("-data-evaluate-expression \"dosegfault=1\"")
+ # Set do_segfault=1 and run (to cause a segfault error)
+ self.runCmd("-data-evaluate-expression \"do_segfault=1\"")
self.expect("\^done,value=\"1\"")
self.runCmd("-exec-continue")
self.expect("\^running")
--- /dev/null
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <cstddef>
+#include <unistd.h>
+
+int do_loop;
+int do_segfault;
+
+int
+main(int argc, char const *argv[])
+{
+ if (do_loop)
+ {
+ do
+ sleep(1);
+ while (do_loop); // BP_loop_condition
+ }
+
+ if (do_segfault)
+ {
+ int *null_ptr = NULL;
+ return *null_ptr;
+ }
+
+ return 0;
+}
--- /dev/null
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
"""
-Test that the lldb-mi driver works with -stack-xxx commands
+Test lldb-mi -stack-xxx commands.
"""
import lldbmi_testcase
class MiStackTestCase(lldbmi_testcase.MiTestCaseBase):
+ mydir = TestBase.compute_mydir(__file__)
+
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_stack_list_arguments(self):
"""Test that 'lldb-mi --interpreter' can shows arguments."""
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_stack_list_locals(self):
"""Test that 'lldb-mi --interpreter' can shows local variables."""
self.expect("\^done")
# Run to main
- line = line_number('main.c', '//BP_localstest')
- self.runCmd("-break-insert --file main.c:%d" % line)
+ self.runCmd("-break-insert -f main")
self.expect("\^done,bkpt={number=\"1\"")
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
+ # Test int local variables:
+ # Run to BP_local_int_test
+ line = line_number('main.cpp', '// BP_local_int_test')
+ self.runCmd("-break-insert --file main.cpp:%d" % line)
+ self.expect("\^done,bkpt={number=\"2\"")
+ self.runCmd("-exec-continue")
+ self.expect("\^running")
+ self.expect("\*stopped,reason=\"breakpoint-hit\"")
+
# Test -stack-list-locals: use 0 or --no-values
self.runCmd("-stack-list-locals 0")
self.expect("\^done,locals=\[name=\"a\",name=\"b\"\]")
self.runCmd("-stack-list-locals --simple-values")
self.expect("\^done,locals=\[{name=\"a\",value=\"10\"},{name=\"b\",value=\"20\"}\]")
- # Test struct local variable
- line = line_number('locals.c', '// BP_LOCAL_STRUCT')
- self.runCmd("-break-insert --file locals.c:%d" % line)
- self.expect("\^done,bkpt={number=\"2\"")
-
+ # Test struct local variable:
+ # Run to BP_local_struct_test
+ line = line_number('main.cpp', '// BP_local_struct_test')
+ self.runCmd("-break-insert --file main.cpp:%d" % line)
+ self.expect("\^done,bkpt={number=\"3\"")
self.runCmd("-exec-continue")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
self.runCmd("-stack-list-locals --simple-values")
self.expect("\^done,locals=\[name=\"var_c\"\]")
- # Test array local variable
- line = line_number('locals.c', '// BP_LOCAL_ARRAY')
- self.runCmd("-break-insert --file locals.c:%d" % line)
- self.expect("\^done,bkpt={number=\"3\"")
-
+ # Test array local variable:
+ # Run to BP_local_array_test
+ line = line_number('main.cpp', '// BP_local_array_test')
+ self.runCmd("-break-insert --file main.cpp:%d" % line)
+ self.expect("\^done,bkpt={number=\"4\"")
self.runCmd("-exec-continue")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
self.runCmd("-stack-list-locals --simple-values")
self.expect("\^done,locals=\[name=\"array\"\]")
- # Test pointers as local variable
- line = line_number('locals.c', '// BP_LOCAL_PTR')
- self.runCmd("-break-insert --file locals.c:%d" % line)
- self.expect("\^done,bkpt={number=\"4\"")
-
+ # Test pointers as local variable:
+ # Run to BP_local_pointer_test
+ line = line_number('main.cpp', '// BP_local_pointer_test')
+ self.runCmd("-break-insert --file main.cpp:%d" % line)
+ self.expect("\^done,bkpt={number=\"5\"")
self.runCmd("-exec-continue")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_stack_info_depth(self):
"""Test that 'lldb-mi --interpreter' can shows depth of the stack."""
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_stack_info_frame(self):
"""Test that 'lldb-mi --interpreter' can show information about current frame."""
# Test that -stack-info-frame works when program is running
self.runCmd("-stack-info-frame")
- self.expect("\^done,frame=\{level=\"0\",addr=\".+\",func=\"main\",file=\"main\.c\",fullname=\".*main\.c\",line=\"\d+\"\}")
+ self.expect("\^done,frame=\{level=\"0\",addr=\".+\",func=\"main\",file=\"main\.cpp\",fullname=\".*main\.cpp\",line=\"\d+\"\}")
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_stack_list_frames(self):
"""Test that 'lldb-mi --interpreter' can lists the frames on the stack."""
# Test stack frame: get frame #0 info
self.runCmd("-stack-list-frames 0 0")
- self.expect("\^done,stack=\[frame=\{level=\"0\",addr=\".+\",func=\"main\",file=\"main\.c\",fullname=\".*main\.c\",line=\".+\"\}\]")
+ self.expect("\^done,stack=\[frame=\{level=\"0\",addr=\".+\",func=\"main\",file=\"main\.cpp\",fullname=\".*main\.cpp\",line=\".+\"\}\]")
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_stack_select_frame(self):
"""Test that 'lldb-mi --interpreter' can choose current frame."""
# Test that current frame is #0
self.runCmd("-stack-info-frame")
- self.expect("\^done,frame=\{level=\"0\",addr=\".+\",func=\"main\",file=\"main\.c\",fullname=\".*main\.c\",line=\"\d+\"\}")
+ self.expect("\^done,frame=\{level=\"0\",addr=\".+\",func=\"main\",file=\"main\.cpp\",fullname=\".*main\.cpp\",line=\"\d+\"\}")
# Test that -stack-select-frame can select the selected frame
self.runCmd("-stack-select-frame 0")
# Test that current frame is still #0
self.runCmd("-stack-info-frame")
- self.expect("\^done,frame=\{level=\"0\",addr=\".+\",func=\"main\",file=\"main\.c\",fullname=\".*main\.c\",line=\"\d+\"\}")
+ self.expect("\^done,frame=\{level=\"0\",addr=\".+\",func=\"main\",file=\"main\.cpp\",fullname=\".*main\.cpp\",line=\"\d+\"\}")
# Test that -stack-select-frame can select frame #1 (parent frame)
self.runCmd("-stack-select-frame 1")
# Test that current frame is #0 and it has the same information
self.runCmd("-stack-info-frame")
- self.expect("\^done,frame=\{level=\"0\",addr=\".+\",func=\"main\",file=\"main\.c\",fullname=\".*main\.c\",line=\"\d+\"\}")
+ self.expect("\^done,frame=\{level=\"0\",addr=\".+\",func=\"main\",file=\"main\.cpp\",fullname=\".*main\.cpp\",line=\"\d+\"\}")
if __name__ == '__main__':
unittest2.main()
--- /dev/null
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+struct inner
+{
+ int var_d;
+};
+
+struct my_type
+{
+ int var_a;
+ char var_b;
+ struct inner inner_;
+};
+
+int
+local_int_test(void)
+{
+ int a = 10, b = 20;
+ return 0; // BP_local_int_test
+}
+
+int
+local_struct_test(void)
+{
+ struct my_type var_c;
+ var_c.var_a = 10;
+ var_c.var_b = 'a';
+ var_c.inner_.var_d = 30;
+ return 0; // BP_local_struct_test
+}
+
+int
+local_array_test(void)
+{
+ int array[3];
+ array[0] = 100;
+ array[1] = 200;
+ array[2] = 300;
+ return 0; // BP_local_array_test
+}
+
+int
+local_pointer_test(void)
+{
+ const char *test_str = "Rakaposhi";
+ int var_e = 24;
+ int *ptr = &var_e;
+ return 0; // BP_local_pointer_test
+}
+
+int
+main(int argc, char const *argv[])
+{
+ local_int_test();
+ local_struct_test();
+ local_array_test();
+ local_pointer_test();
+ return 0;
+}
--- /dev/null
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
"""
-Test that the lldb-mi driver works with -symbol-xxx commands
+Test lldb-mi -symbol-xxx commands.
"""
import lldbmi_testcase
class MiSymbolTestCase(lldbmi_testcase.MiTestCaseBase):
+ mydir = TestBase.compute_mydir(__file__)
+
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_symbol_list_lines_file(self):
"""Test that 'lldb-mi --interpreter' works for -symbol-list-lines when file exists."""
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- # Get address of main
+ # Get address of main and its line
self.runCmd("-data-evaluate-expression main")
self.expect("\^done,value=\"0x[0-9a-f]+\"")
- main_addr = int(self.child.after.split("\"")[1], 16)
- main_line = line_number('main.c', '//FUNC_main')
+ addr = int(self.child.after.split("\"")[1], 16)
+ line = line_number('main.cpp', '// FUNC_main')
# Test that -symbol-list-lines works on valid data
- self.runCmd("-symbol-list-lines main.c")
- self.expect("\^done,lines=\[\{pc=\"0x0*%x\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"\d+\"\})+\]" % (main_addr, main_line))
+ 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 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 \"")
# Test that -symbol-list-lines fails when file is specified using relative path
- self.runCmd("-symbol-list-lines ./main.c")
- self.expect("\^error,message=\"warning: No source filenames matched './main.c'. error: no source filenames matched any command arguments \"")
+ 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 \"")
# Test that -symbol-list-lines works when file is specified using absolute path
import os
- main_file = os.path.join(os.getcwd(), "main.c")
- self.runCmd("-symbol-list-lines \"%s\"" % main_file)
- self.expect("\^done,lines=\[\{pc=\"0x0*%x\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"\d+\"\})+\]" % (main_addr, main_line))
+ path = os.path.join(os.getcwd(), "main.cpp")
+ self.runCmd("-symbol-list-lines \"%s\"" % path)
+ self.expect("\^done,lines=\[\{pc=\"0x0*%x\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"\d+\"\})+\]" % (addr, line))
# Test that -symbol-list-lines fails when file doesn't exist
- self.runCmd("-symbol-list-lines unknown_dir/main.c")
- self.expect("\^error,message=\"warning: No source filenames matched 'unknown_dir/main.c'. error: no source filenames matched any command arguments \"")
+ self.runCmd("-symbol-list-lines unknown_dir/main.cpp")
+ self.expect("\^error,message=\"warning: No source filenames matched 'unknown_dir/main.cpp'. error: no source filenames matched any command arguments \"")
if __name__ == '__main__':
unittest2.main()
--- /dev/null
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int
+main(int argc, char const *argv[])
+{ // FUNC_main
+ return 0;
+}
--- /dev/null
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
"""
-Test that the lldb-mi driver can evaluate expressions.
+Test lldb-mi -var-xxx commands.
"""
import lldbmi_testcase
from lldbtest import *
import unittest2
-class MiEvaluateTestCase(lldbmi_testcase.MiTestCaseBase):
+class MiVarTestCase(lldbmi_testcase.MiTestCaseBase):
+
+ mydir = TestBase.compute_mydir(__file__)
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_eval(self):
"""Test that 'lldb-mi --interpreter' works for evaluating."""
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
- # Run to program return (marked BP_source)
- line = line_number('main.c', '//BP_source')
- self.runCmd("-break-insert main.c:%d" % line)
+ # Run to program return
+ line = line_number('main.cpp', '// BP_return')
+ self.runCmd("-break-insert main.cpp:%d" % line)
self.expect("\^done,bkpt={number=\"1\"")
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\^done,value=\"3\"")
self.runCmd("-var-show-attributes var2")
self.expect("\^done,status=\"editable\"")
+ self.runCmd("-var-list-children var2")
+ self.expect("\^done,numchild=\"0\",children=\"\[\]\"")
self.runCmd("-data-evaluate-expression \"g_MyVar=30\"")
self.expect("\^done,value=\"30\"")
- self.runCmd("-var-update var2")
- #self.expect("name=\"var2\",value=\"30\"") #FIXME -var-update doesn't work
+ self.runCmd("-var-update --all-values var2")
+ #self.expect("\^done,changelist=\[\{name=\"var2\",value=\"30\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]") #FIXME -var-update doesn't work
self.runCmd("-var-delete var2")
self.expect("\^done")
self.runCmd("-var-create var2 * g_MyVar")
self.expect("\^done,value=\"30\"")
self.runCmd("-var-show-attributes var3")
self.expect("\^done,status=\"editable\"")
+ self.runCmd("-var-list-children var3")
+ self.expect("\^done,numchild=\"0\",children=\"\[\]\"")
self.runCmd("-data-evaluate-expression \"s_MyVar=3\"")
self.expect("\^done,value=\"3\"")
- self.runCmd("-var-update var3")
- #self.expect("name=\"var3\",value=\"3\"") #FIXME -var-update doesn't work
+ self.runCmd("-var-update --all-values var3")
+ #self.expect("\^done,changelist=\[\{name=\"var3\",value=\"3\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]") #FIXME -var-update doesn't work
self.runCmd("-var-delete var3")
self.expect("\^done")
self.runCmd("-var-create var3 * s_MyVar")
self.expect("\^done,value=\"20\"")
self.runCmd("-var-show-attributes var4")
self.expect("\^done,status=\"editable\"")
+ self.runCmd("-var-list-children var4")
+ self.expect("\^done,numchild=\"0\",children=\"\[\]\"")
self.runCmd("-data-evaluate-expression \"b=2\"")
self.expect("\^done,value=\"2\"")
- self.runCmd("-var-update var4")
- #self.expect("name=\"var4\",value=\"2\"") #FIXME -var-update doesn't work
+ self.runCmd("-var-update --all-values var4")
+ #self.expect("\^done,changelist=\[\{name=\"var4\",value=\"2\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]") #FIXME -var-update doesn't work
self.runCmd("-var-delete var4")
self.expect("\^done")
self.runCmd("-var-create var4 * b")
self.expect("\^done,value=\"12\"")
self.runCmd("-var-show-attributes var5")
self.expect("\^done,status=\"editable\"") #FIXME editable or not?
+ self.runCmd("-var-list-children var5")
+ self.expect("\^done,numchild=\"0\",children=\"\[\]\"")
# Print argument "argv[0]"
self.runCmd("-data-evaluate-expression \"argv[0]\"")
self.expect("\^done,value=\"0x[0-9a-f]+\"")
self.runCmd("-var-show-attributes var6")
self.expect("\^done,status=\"editable\"")
+ self.runCmd("-var-list-children var6")
+ #self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var6\.\*\$15\",exp=\"\*\$15\",numchild=\"0\",type=\"const char\",thread-id=\"1\",has_more=\"0\"\}\]") #FIXME -var-list-children shows invalid thread-id
if __name__ == '__main__':
unittest2.main()
--- /dev/null
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int g_MyVar = 3;
+static int s_MyVar = 4;
+
+int
+main(int argc, char const *argv[])
+{
+ int a = 10, b = 20;
+ s_MyVar = a + b;
+ return 0; // BP_return
+}