xref: /llvm-project/lldb/test/API/python_api/debugger/TestDebuggerAPI.py (revision 122a4ebde3f4394a84e9f93b9c7085f088be6dd7)
1"""
2Test Debugger APIs.
3"""
4
5import lldb
6
7from lldbsuite.test.decorators import *
8from lldbsuite.test.lldbtest import *
9from lldbsuite.test import lldbutil
10
11
12class DebuggerAPITestCase(TestBase):
13
14    mydir = TestBase.compute_mydir(__file__)
15    NO_DEBUG_INFO_TESTCASE = True
16
17    @add_test_categories(['pyapi'])
18    def test_debugger_api_boundary_condition(self):
19        """Exercise SBDebugger APIs with boundary conditions."""
20        self.dbg.HandleCommand(None)
21        self.dbg.SetDefaultArchitecture(None)
22        self.dbg.GetScriptingLanguage(None)
23        self.dbg.CreateTarget(None)
24        self.dbg.CreateTarget(None, None, None, True, lldb.SBError())
25        self.dbg.CreateTargetWithFileAndTargetTriple(None, None)
26        self.dbg.CreateTargetWithFileAndArch(None, None)
27        self.dbg.FindTargetWithFileAndArch(None, None)
28        self.dbg.SetInternalVariable(None, None, None)
29        self.dbg.GetInternalVariableValue(None, None)
30        # FIXME (filcab): We must first allow for the swig bindings to know if
31        # a Python callback is set. (Check python-typemaps.swig)
32        # self.dbg.SetLoggingCallback(None)
33        self.dbg.SetPrompt(None)
34        self.dbg.SetCurrentPlatform(None)
35        self.dbg.SetCurrentPlatformSDKRoot(None)
36
37        fresh_dbg = lldb.SBDebugger()
38        self.assertEquals(len(fresh_dbg), 0)
39
40    @add_test_categories(['pyapi'])
41    def test_debugger_delete_invalid_target(self):
42        """SBDebugger.DeleteTarget() should not crash LLDB given and invalid target."""
43        target = lldb.SBTarget()
44        self.assertFalse(target.IsValid())
45        self.dbg.DeleteTarget(target)
46