Fix crash in SBStructuredData::GetDescription() when there's no StructuredDataPlugin.

Also, use the StructuredData::Dump method to print the StructuredData if there
is no plugin, rather than just returning an error.

Differential Revision: https://reviews.llvm.org/D88266
This commit is contained in:
Jim Ingham
2020-09-30 11:46:59 -07:00
parent ad865d9d10
commit afaeb6af79
2 changed files with 16 additions and 5 deletions

View File

@@ -35,6 +35,13 @@ class TestStructuredDataAPI(TestBase):
# Tests for invalid data type
self.invalid_struct_test(example)
# Test that GetDescription works:
s.Clear()
error = example.GetDescription(s)
self.assertTrue(error.Success(), "GetDescription works")
if not "key_float" in s.GetData():
self.fail("FAILED: could not find key_float in description output")
dict_struct = lldb.SBStructuredData()
dict_struct = example.GetValueForKey("key_dict")