blob: 2d664964ccd5b1fe1a217416a02e324ad113a79f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
"""
Test that the lldb-mi driver understands MI command syntax.
"""
import lldbmi_testcase
from lldbtest import *
import unittest2
class MiSyntaxTestCase(lldbmi_testcase.MiTestCaseBase):
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
def test_lldbmi_tokens(self):
"""Test that 'lldb-mi --interpreter' echos command tokens."""
self.spawnLldbMi(args = None)
# Load executable
self.runCmd("000-file-exec-and-symbols %s" % self.myexe)
self.expect("000\^done")
# Run to main
self.runCmd("100000001-break-insert -f b_MyFunction")
self.expect("100000001\^done,bkpt={number=\"1\"")
self.runCmd("2-exec-run")
self.expect("2\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
# Exit
self.runCmd("0000000000000000000003-exec-continue")
self.expect("0000000000000000000003\^running")
self.expect("\*stopped,reason=\"exited-normally\"")
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@unittest2.skip("lldb-mi doesn't handle special chars properly")
def test_lldbmi_specialchars(self):
"""Test that 'lldb-mi --interpreter' handles complicated strings."""
self.spawnLldbMi(args = None)
# Create alias for myexe
complicated_myexe = "C--mpl-x file's`s @#$%^&*()_+-={}[]| name"
if os.path.exists(complicated_myexe):
os.unlink(complicated_myexe)
os.symlink(self.myexe, complicated_myexe)
try:
# Try to load executable with complicated filename
self.runCmd("-file-exec-and-symbols \"%s\"" % complicated_myexe)
self.expect("\^done")
# Check that it was loaded correctly
self.runCmd("-break-insert -f a_MyFunction")
self.expect("\^done,bkpt={number=\"1\"")
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
finally:
# Clean up
os.unlink(complicated_myexe)
if __name__ == '__main__':
unittest2.main()
|