diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:50:09 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:50:09 +0000 | 
| commit | f3fbd1c0586ff6ec7895991e6c28f61a503c36a8 (patch) | |
| tree | 48d008fd3df8c0e73271a4b18474e0aac6dbfe33 /packages/Python/lldbsuite/test/expression_command/ir-interpreter-phi-nodes | |
| parent | 2fc5d2d1dfaf623ce4e24cd8590565902f8c557c (diff) | |
Notes
Diffstat (limited to 'packages/Python/lldbsuite/test/expression_command/ir-interpreter-phi-nodes')
3 files changed, 62 insertions, 0 deletions
| diff --git a/packages/Python/lldbsuite/test/expression_command/ir-interpreter-phi-nodes/Makefile b/packages/Python/lldbsuite/test/expression_command/ir-interpreter-phi-nodes/Makefile new file mode 100644 index 000000000000..8a7102e347af --- /dev/null +++ b/packages/Python/lldbsuite/test/expression_command/ir-interpreter-phi-nodes/Makefile @@ -0,0 +1,5 @@ +LEVEL = ../../make + +CXX_SOURCES := main.cpp + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/expression_command/ir-interpreter-phi-nodes/TestIRInterpreterPHINodes.py b/packages/Python/lldbsuite/test/expression_command/ir-interpreter-phi-nodes/TestIRInterpreterPHINodes.py new file mode 100644 index 000000000000..c4f176703225 --- /dev/null +++ b/packages/Python/lldbsuite/test/expression_command/ir-interpreter-phi-nodes/TestIRInterpreterPHINodes.py @@ -0,0 +1,40 @@ +""" +Test PHI nodes work in the IR interpreter. +""" + +import os, os.path + +import lldb +from lldbsuite.test.lldbtest import * +import lldbsuite.test.lldbutil as lldbutil + +class IRInterpreterPHINodesTestCase(TestBase): +    mydir = TestBase.compute_mydir(__file__) + +    def test_phi_node_support(self): +        """Test support for PHI nodes in the IR interpreter.""" +         +        self.build() +        exe = os.path.join(os.getcwd(), 'a.out') +        self.runCmd('file ' + exe, CURRENT_EXECUTABLE_SET) +         +        # Break on the first assignment to i +        line = line_number('main.cpp', 'i = 5') +        lldbutil.run_break_set_by_file_and_line(self, 'main.cpp', line, num_expected_locations=1, loc_exact=True) +         +        self.runCmd('run', RUN_SUCCEEDED) +         +        # The stop reason of the thread should be breakpoint +        self.expect('thread list', STOPPED_DUE_TO_BREAKPOINT, +            substrs = ['stopped', 'stop reason = breakpoint']) +         +        self.runCmd('s') +         +        # The logical 'or' causes a PHI node to be generated. Execute without JIT +        # to test that the interpreter can handle this +        self.expect('expr -j 0 -- i == 3 || i == 5', substrs=['true']) +         +        self.runCmd('s') +        self.expect('expr -j 0 -- i == 3 || i == 5', substrs=['false']) +        self.runCmd('s') +        self.expect('expr -j 0 -- i == 3 || i == 5', substrs=['true']) diff --git a/packages/Python/lldbsuite/test/expression_command/ir-interpreter-phi-nodes/main.cpp b/packages/Python/lldbsuite/test/expression_command/ir-interpreter-phi-nodes/main.cpp new file mode 100644 index 000000000000..b144f9cc1b47 --- /dev/null +++ b/packages/Python/lldbsuite/test/expression_command/ir-interpreter-phi-nodes/main.cpp @@ -0,0 +1,17 @@ +//===-- 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 i; +    i = 5; +    i = 2; +    i = 3; +    return 0; +} | 
