2 Test that commands do not try and hold on to stale CommandInterpreters in a multiple debuggers scenario
5 from __future__ import print_function
9 from lldbsuite.test.decorators import *
10 from lldbsuite.test.lldbtest import *
11 from lldbsuite.test import lldbutil
14 class MultipleDebuggersCommandsTestCase(TestBase):
16 mydir = TestBase.compute_mydir(__file__)
19 def test_multipledebuggers_commands(self):
20 """Test that commands do not try and hold on to stale CommandInterpreters in a multiple debuggers scenario"""
21 source_init_files = False
22 magic_text = "The following commands may relate to 'env'"
24 debugger_1 = lldb.SBDebugger.Create(source_init_files)
25 interpreter_1 = debugger_1.GetCommandInterpreter()
27 retobj = lldb.SBCommandReturnObject()
28 interpreter_1.HandleCommand("apropos env", retobj)
30 magic_text in str(retobj),
31 "[interpreter_1]: the output does not contain the correct words")
36 lldb.SBDebugger.Destroy(debugger_1)
38 # now do this again with a different debugger - we shouldn't crash
40 debugger_2 = lldb.SBDebugger.Create(source_init_files)
41 interpreter_2 = debugger_2.GetCommandInterpreter()
43 retobj = lldb.SBCommandReturnObject()
44 interpreter_2.HandleCommand("apropos env", retobj)
46 magic_text in str(retobj),
47 "[interpreter_2]: the output does not contain the correct words")
52 lldb.SBDebugger.Destroy(debugger_2)