]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/expression_command/ir-interpreter-phi-nodes/TestIRInterpreterPHINodes.py
Vendor import of lldb release_39 branch r276489:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / expression_command / ir-interpreter-phi-nodes / TestIRInterpreterPHINodes.py
1 """
2 Test PHI nodes work in the IR interpreter.
3 """
4
5 import os, os.path
6
7 import lldb
8 from lldbsuite.test.lldbtest import *
9 import lldbsuite.test.lldbutil as lldbutil
10
11 class IRInterpreterPHINodesTestCase(TestBase):
12     mydir = TestBase.compute_mydir(__file__)
13
14     def test_phi_node_support(self):
15         """Test support for PHI nodes in the IR interpreter."""
16         
17         self.build()
18         exe = os.path.join(os.getcwd(), 'a.out')
19         self.runCmd('file ' + exe, CURRENT_EXECUTABLE_SET)
20         
21         # Break on the first assignment to i
22         line = line_number('main.cpp', 'i = 5')
23         lldbutil.run_break_set_by_file_and_line(self, 'main.cpp', line, num_expected_locations=1, loc_exact=True)
24         
25         self.runCmd('run', RUN_SUCCEEDED)
26         
27         # The stop reason of the thread should be breakpoint
28         self.expect('thread list', STOPPED_DUE_TO_BREAKPOINT,
29             substrs = ['stopped', 'stop reason = breakpoint'])
30         
31         self.runCmd('s')
32         
33         # The logical 'or' causes a PHI node to be generated. Execute without JIT
34         # to test that the interpreter can handle this
35         self.expect('expr -j 0 -- i == 3 || i == 5', substrs=['true'])
36         
37         self.runCmd('s')
38         self.expect('expr -j 0 -- i == 3 || i == 5', substrs=['false'])
39         self.runCmd('s')
40         self.expect('expr -j 0 -- i == 3 || i == 5', substrs=['true'])