When deserializing breakpoints some options may not be present.

The deserializer was not handling this case.  For now we just
accept the absent option, and set it to the breakpoint default.
This will be more important if/when I figure out how to serialize
the options set on breakpont locations.

<rdar://problem/48322664>

llvm-svn: 354702
This commit is contained in:
Jim Ingham 2019-02-22 23:54:11 +00:00
parent 9af9ab47b7
commit bac29fde53
2 changed files with 16 additions and 15 deletions

View File

@ -17,6 +17,7 @@ from lldbsuite.test import lldbutil
class BreakpointSerialization(TestBase):
mydir = TestBase.compute_mydir(__file__)
NO_DEBUG_INFO_TESTCASE = True
@add_test_categories(['pyapi'])
def test_resolvers(self):
@ -196,6 +197,11 @@ class BreakpointSerialization(TestBase):
bkpt.SetThreadName("grubby")
source_bps.Append(bkpt)
bkpt = self.orig_target.BreakpointCreateByName("blubby", lldb.eFunctionNameTypeAuto, empty_module_list, empty_cu_list)
bkpt.SetCondition("gonna remove this")
bkpt.SetCondition("")
source_bps.Append(bkpt)
bkpt = self.orig_target.BreakpointCreateByName("blubby", lldb.eFunctionNameTypeFull, empty_module_list,empty_cu_list)
bkpt.SetCondition("something != something_else")
bkpt.SetQueueName("grubby")

View File

@ -253,55 +253,50 @@ std::unique_ptr<BreakpointOptions> BreakpointOptions::CreateFromStructuredData(
const char *key = GetKey(OptionNames::EnabledState);
bool success;
if (key) {
if (key && options_dict.HasKey(key)) {
success = options_dict.GetValueForKeyAsBoolean(key, enabled);
if (!success) {
error.SetErrorStringWithFormat("%s key is not a boolean.",
GetKey(OptionNames::EnabledState));
error.SetErrorStringWithFormat("%s key is not a boolean.", key);
return nullptr;
}
set_options.Set(eEnabled);
}
key = GetKey(OptionNames::OneShotState);
if (key) {
if (key && options_dict.HasKey(key)) {
success = options_dict.GetValueForKeyAsBoolean(key, one_shot);
if (!success) {
error.SetErrorStringWithFormat("%s key is not a boolean.",
GetKey(OptionNames::OneShotState));
error.SetErrorStringWithFormat("%s key is not a boolean.", key);
return nullptr;
}
set_options.Set(eOneShot);
}
key = GetKey(OptionNames::AutoContinue);
if (key) {
if (key && options_dict.HasKey(key)) {
success = options_dict.GetValueForKeyAsBoolean(key, auto_continue);
if (!success) {
error.SetErrorStringWithFormat("%s key is not a boolean.",
GetKey(OptionNames::AutoContinue));
error.SetErrorStringWithFormat("%s key is not a boolean.", key);
return nullptr;
}
set_options.Set(eAutoContinue);
}
key = GetKey(OptionNames::IgnoreCount);
if (key) {
if (key && options_dict.HasKey(key)) {
success = options_dict.GetValueForKeyAsInteger(key, ignore_count);
if (!success) {
error.SetErrorStringWithFormat("%s key is not an integer.",
GetKey(OptionNames::IgnoreCount));
error.SetErrorStringWithFormat("%s key is not an integer.", key);
return nullptr;
}
set_options.Set(eIgnoreCount);
}
key = GetKey(OptionNames::ConditionText);
if (key) {
if (key && options_dict.HasKey(key)) {
success = options_dict.GetValueForKeyAsString(key, condition_ref);
if (!success) {
error.SetErrorStringWithFormat("%s key is not an string.",
GetKey(OptionNames::ConditionText));
error.SetErrorStringWithFormat("%s key is not an string.", key);
return nullptr;
}
set_options.Set(eCondition);