]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/functionalities/multidebugger_commands/TestMultipleDebuggersCommands.py
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / functionalities / multidebugger_commands / TestMultipleDebuggersCommands.py
1 """
2 Test that commands do not try and hold on to stale CommandInterpreters in a multiple debuggers scenario
3 """
4
5 from __future__ import print_function
6
7
8 import os
9 import time
10 import lldb
11 from lldbsuite.test.decorators import *
12 from lldbsuite.test.lldbtest import *
13 from lldbsuite.test import lldbutil
14
15
16 class MultipleDebuggersCommandsTestCase(TestBase):
17
18     mydir = TestBase.compute_mydir(__file__)
19
20     @no_debug_info_test
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'"
25
26         debugger_1 = lldb.SBDebugger.Create(source_init_files)
27         interpreter_1 = debugger_1.GetCommandInterpreter()
28
29         retobj = lldb.SBCommandReturnObject()
30         interpreter_1.HandleCommand("apropos env", retobj)
31         self.assertTrue(
32             magic_text in str(retobj),
33             "[interpreter_1]: the output does not contain the correct words")
34
35         if self.TraceOn():
36             print(str(retobj))
37
38         lldb.SBDebugger.Destroy(debugger_1)
39
40         # now do this again with a different debugger - we shouldn't crash
41
42         debugger_2 = lldb.SBDebugger.Create(source_init_files)
43         interpreter_2 = debugger_2.GetCommandInterpreter()
44
45         retobj = lldb.SBCommandReturnObject()
46         interpreter_2.HandleCommand("apropos env", retobj)
47         self.assertTrue(
48             magic_text in str(retobj),
49             "[interpreter_2]: the output does not contain the correct words")
50
51         if self.TraceOn():
52             print(str(retobj))
53
54         lldb.SBDebugger.Destroy(debugger_2)