summaryrefslogtreecommitdiffstats
path: root/lldb/test/persistent_variables/TestPersistentVariables.py
blob: 64637e3c33fc28b9c9cd7337938f32bdc3498620 (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
"""
Test that lldb persistent variables works correctly.
"""

import os, time
import unittest2
import lldb
from lldbtest import *

class TestPersistentVariables(TestBase):

    mydir = "persistent_variables"

    def test_persistent_variables(self):
        """Test that lldb persistent variables works correctly."""
        self.runCmd("file ../array_types/a.out", CURRENT_EXECUTABLE_SET)

        self.runCmd("breakpoint set --name main")

        self.runCmd("run", RUN_STOPPED)

        self.runCmd("expr int $i = 5; $i + 1")
        # $0 = (int)6

        self.runCmd("expr $i + 3")
        # $1 = (int)8

        self.runCmd("expr $1 + $0")
        # $2 = (int)14

        self.expect("expr $2",
            startstr = "$3 = (int) 14")
        # $3 = (int)14


if __name__ == '__main__':
    import atexit
    lldb.SBDebugger.Initialize()
    atexit.register(lambda: lldb.SBDebugger.Terminate())
    unittest2.main()
OpenPOWER on IntegriCloud