[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.
This commit is contained in:
Jacob Lalonde
2024-07-18 17:10:15 -07:00
committed by GitHub
parent 996d31c7ba
commit 4120570dc4
30 changed files with 412 additions and 62 deletions

View File

@@ -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)