aboutsummaryrefslogtreecommitdiff
path: root/lldb/test/API/python_api
diff options
context:
space:
mode:
authorJacob Lalonde <jalalonde@fb.com>2024-07-18 17:10:15 -0700
committerGitHub <noreply@github.com>2024-07-18 17:10:15 -0700
commit4120570dc408a6ccc7133b4bdbaf5cf6c4af9db7 (patch)
tree5eb2d81a5dac8722296ee3a60ed32386164623d0 /lldb/test/API/python_api
parent996d31c7ba841fdc3bd375f3fed4d8324618425b (diff)
downloadllvm-4120570dc408a6ccc7133b4bdbaf5cf6c4af9db7.zip
llvm-4120570dc408a6ccc7133b4bdbaf5cf6c4af9db7.tar.gz
llvm-4120570dc408a6ccc7133b4bdbaf5cf6c4af9db7.tar.bz2
[LLDB][SaveCore] Add SBSaveCoreOptions Object, and SBProcess::SaveCore() overload (#98403)
This PR adds `SBSaveCoreOptions`, which is a container class for options when LLDB is taking coredumps. For this first iteration this container just keeps parity with the extant API of `file, style, plugin`. In the future this options object can be extended to allow users to take a subset of their core dumps.
Diffstat (limited to 'lldb/test/API/python_api')
-rw-r--r--lldb/test/API/python_api/sbsavecoreoptions/TestSBSaveCoreOptions.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/lldb/test/API/python_api/sbsavecoreoptions/TestSBSaveCoreOptions.py b/lldb/test/API/python_api/sbsavecoreoptions/TestSBSaveCoreOptions.py
new file mode 100644
index 0000000..c509e81
--- /dev/null
+++ b/lldb/test/API/python_api/sbsavecoreoptions/TestSBSaveCoreOptions.py
@@ -0,0 +1,28 @@
+"""Test the SBSaveCoreOptions APIs."""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+
+
+class SBSaveCoreOptionsAPICase(TestBase):
+ def test_plugin_name_assignment(self):
+ """Test assignment ensuring valid plugin names only."""
+ options = lldb.SBSaveCoreOptions()
+ error = options.SetPluginName(None)
+ self.assertTrue(error.Success())
+ self.assertEqual(options.GetPluginName(), None)
+ error = options.SetPluginName("Not a real plugin")
+ self.assertTrue(error.Fail())
+ self.assertEqual(options.GetPluginName(), None)
+ error = options.SetPluginName("minidump")
+ self.assertTrue(error.Success())
+ self.assertEqual(options.GetPluginName(), "minidump")
+ error = options.SetPluginName("")
+ self.assertTrue(error.Success())
+ self.assertEqual(options.GetPluginName(), None)
+
+ def test_default_corestyle_behavior(self):
+ """Test that the default core style is unspecified."""
+ options = lldb.SBSaveCoreOptions()
+ self.assertEqual(options.GetStyle(), lldb.eSaveCoreUnspecified)