blob: 47d1631d7c23cffa4ad70d80dc406bf2ee03c089 (
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
|
"""
Test that lldb persistent variables works correctly.
"""
import os, time
import unittest2
import lldb
from lldbtest import *
class PersistentVariablesTestCase(TestBase):
mydir = os.path.join("expression_command", "persistent_variables")
def test_persistent_variables(self):
"""Test that lldb persistent variables works correctly."""
self.buildDefault()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
self.runCmd("breakpoint set --name main")
self.runCmd("run", RUN_SUCCEEDED)
self.expect("expression int $i = 5; $i + 1",
startstr = "(int) $0 = 6")
# (int) $0 = 6
self.expect("expression $i + 3",
startstr = "(int) $1 = 8")
# (int) $1 = 8
self.expect("expression $1 + $0",
startstr = "(int) $2 = 14")
# (int) $2 = 14
self.expect("expression $2",
startstr = "(int) $2 = 14")
# (int) $2 = 14
self.expect("expression $1",
startstr = "(int) $1 = 8")
# (int) $1 = 8
if __name__ == '__main__':
import atexit
lldb.SBDebugger.Initialize()
atexit.register(lambda: lldb.SBDebugger.Terminate())
unittest2.main()
|