2 Test that commands do not try and hold on to stale CommandInterpreters in a multiple debuggers scenario
5 from __future__ import print_function
11 from lldbsuite.test.decorators import *
12 from lldbsuite.test.lldbtest import *
13 from lldbsuite.test import lldbutil
16 class MultipleDebuggersCommandsTestCase(TestBase):
18 mydir = TestBase.compute_mydir(__file__)
21 def test_multipledebuggers_commands(self):
22 """Test that commands do not try and hold on to stale CommandInterpreters in a multiple debuggers scenario"""
23 source_init_files = False
24 magic_text = "The following commands may relate to 'env'"
26 debugger_1 = lldb.SBDebugger.Create(source_init_files)
27 interpreter_1 = debugger_1.GetCommandInterpreter()
29 retobj = lldb.SBCommandReturnObject()
30 interpreter_1.HandleCommand("apropos env", retobj)
32 magic_text in str(retobj),
33 "[interpreter_1]: the output does not contain the correct words")
38 lldb.SBDebugger.Destroy(debugger_1)
40 # now do this again with a different debugger - we shouldn't crash
42 debugger_2 = lldb.SBDebugger.Create(source_init_files)
43 interpreter_2 = debugger_2.GetCommandInterpreter()
45 retobj = lldb.SBCommandReturnObject()
46 interpreter_2.HandleCommand("apropos env", retobj)
48 magic_text in str(retobj),
49 "[interpreter_2]: the output does not contain the correct words")
54 lldb.SBDebugger.Destroy(debugger_2)