brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 98d7e8e Raw
51 lines · python
1"""2Test that commands do not try and hold on to stale CommandInterpreters in a multiple debuggers scenario3"""4 5import lldb6from lldbsuite.test.decorators import *7from lldbsuite.test.lldbtest import *8from lldbsuite.test import lldbutil9 10 11class MultipleDebuggersCommandsTestCase(TestBase):12    @no_debug_info_test13    def test_multipledebuggers_commands(self):14        """Test that commands do not try and hold on to stale CommandInterpreters in a multiple debuggers scenario"""15        source_init_files = False16        magic_text = "The following commands may relate to 'env'"17 18        debugger_1 = lldb.SBDebugger.Create(source_init_files)19        interpreter_1 = debugger_1.GetCommandInterpreter()20 21        retobj = lldb.SBCommandReturnObject()22        interpreter_1.HandleCommand("apropos env", retobj)23        self.assertIn(24            magic_text,25            str(retobj),26            "[interpreter_1]: the output does not contain the correct words",27        )28 29        if self.TraceOn():30            print(str(retobj))31 32        lldb.SBDebugger.Destroy(debugger_1)33 34        # now do this again with a different debugger - we shouldn't crash35 36        debugger_2 = lldb.SBDebugger.Create(source_init_files)37        interpreter_2 = debugger_2.GetCommandInterpreter()38 39        retobj = lldb.SBCommandReturnObject()40        interpreter_2.HandleCommand("apropos env", retobj)41        self.assertIn(42            magic_text,43            str(retobj),44            "[interpreter_2]: the output does not contain the correct words",45        )46 47        if self.TraceOn():48            print(str(retobj))49 50        lldb.SBDebugger.Destroy(debugger_2)51