lldb_private::UUID CommunicationKDP::GetUUID() { UUID uuid; if (GetKernelVersion() == NULL) return uuid; if (m_kernel_version.find("UUID=") == std::string::npos) return uuid; size_t p = m_kernel_version.find("UUID=") + strlen("UUID="); std::string uuid_str = m_kernel_version.substr(p, 36); if (uuid_str.size() < 32) return uuid; if (uuid.SetFromCString(uuid_str.c_str()) == 0) { UUID invalid_uuid; return invalid_uuid; } return uuid; }
Property::Property (const PropertyDefinition &definition) : m_name (definition.name), m_description (definition.description), m_value_sp (), m_is_global (definition.global) { switch (definition.type) { case OptionValue::eTypeInvalid: case OptionValue::eTypeProperties: break; case OptionValue::eTypeArch: // "definition.default_uint_value" is not used // "definition.default_cstr_value" as a string value that represents the default string value for the architecture/triple m_value_sp.reset (new OptionValueArch(definition.default_cstr_value)); break; case OptionValue::eTypeArgs: // "definition.default_uint_value" is always a OptionValue::Type m_value_sp.reset (new OptionValueArgs()); break; case OptionValue::eTypeArray: // "definition.default_uint_value" is always a OptionValue::Type m_value_sp.reset (new OptionValueArray(OptionValue::ConvertTypeToMask((OptionValue::Type)definition.default_uint_value))); break; case OptionValue::eTypeBoolean: // "definition.default_uint_value" is the default boolean value if // "definition.default_cstr_value" is NULL, otherwise interpret // "definition.default_cstr_value" as a string value that represents the default // value. if (definition.default_cstr_value) m_value_sp.reset (new OptionValueBoolean(Args::StringToBoolean (definition.default_cstr_value, false, nullptr))); else m_value_sp.reset (new OptionValueBoolean(definition.default_uint_value != 0)); break; case OptionValue::eTypeDictionary: // "definition.default_uint_value" is always a OptionValue::Type m_value_sp.reset (new OptionValueDictionary(OptionValue::ConvertTypeToMask((OptionValue::Type)definition.default_uint_value))); break; case OptionValue::eTypeEnum: // "definition.default_uint_value" is the default enumeration value if // "definition.default_cstr_value" is NULL, otherwise interpret // "definition.default_cstr_value" as a string value that represents the default // value. { OptionValueEnumeration *enum_value = new OptionValueEnumeration(definition.enum_values, definition.default_uint_value); m_value_sp.reset (enum_value); if (definition.default_cstr_value) { if (enum_value->SetValueFromCString(definition.default_cstr_value).Success()) { enum_value->SetDefaultValue(enum_value->GetCurrentValue()); // Call Clear() since we don't want the value to appear as // having been set since we called SetValueFromCString() above. // Clear will set the current value to the default and clear // the boolean that says that the value has been set. enum_value->Clear(); } } } break; case OptionValue::eTypeFileSpec: // "definition.default_uint_value" represents if the "definition.default_cstr_value" should // be resolved or not m_value_sp.reset (new OptionValueFileSpec(FileSpec(definition.default_cstr_value, definition.default_uint_value != 0))); break; case OptionValue::eTypeFileSpecList: // "definition.default_uint_value" is not used for a OptionValue::eTypeFileSpecList m_value_sp.reset (new OptionValueFileSpecList()); break; case OptionValue::eTypeFormat: // "definition.default_uint_value" is the default format enumeration value if // "definition.default_cstr_value" is NULL, otherwise interpret // "definition.default_cstr_value" as a string value that represents the default // value. { Format new_format = eFormatInvalid; if (definition.default_cstr_value) Args::StringToFormat (definition.default_cstr_value, new_format, nullptr); else new_format = (Format)definition.default_uint_value; m_value_sp.reset (new OptionValueFormat(new_format)); } break; case OptionValue::eTypePathMap: // "definition.default_uint_value" tells us if notifications should occur for // path mappings m_value_sp.reset (new OptionValuePathMappings(definition.default_uint_value != 0)); break; case OptionValue::eTypeRegex: // "definition.default_uint_value" is used to the regular expression flags // "definition.default_cstr_value" the default regular expression value // value. m_value_sp.reset (new OptionValueRegex(definition.default_cstr_value, definition.default_uint_value)); break; case OptionValue::eTypeSInt64: // "definition.default_uint_value" is the default integer value if // "definition.default_cstr_value" is NULL, otherwise interpret // "definition.default_cstr_value" as a string value that represents the default // value. m_value_sp.reset (new OptionValueSInt64(definition.default_cstr_value ? Args::StringToSInt64 (definition.default_cstr_value) : definition.default_uint_value)); break; case OptionValue::eTypeUInt64: // "definition.default_uint_value" is the default unsigned integer value if // "definition.default_cstr_value" is NULL, otherwise interpret // "definition.default_cstr_value" as a string value that represents the default // value. m_value_sp.reset (new OptionValueUInt64(definition.default_cstr_value ? Args::StringToUInt64 (definition.default_cstr_value) : definition.default_uint_value)); break; case OptionValue::eTypeUUID: // "definition.default_uint_value" is not used for a OptionValue::eTypeUUID // "definition.default_cstr_value" can contain a default UUID value { UUID uuid; if (definition.default_cstr_value) uuid.SetFromCString (definition.default_cstr_value); m_value_sp.reset (new OptionValueUUID(uuid)); } break; case OptionValue::eTypeString: // "definition.default_uint_value" can contain the string option flags OR'ed together // "definition.default_cstr_value" can contain a default string value { OptionValueString *string_value = new OptionValueString(definition.default_cstr_value); if (definition.default_uint_value != 0) string_value->GetOptions().Reset(definition.default_uint_value); m_value_sp.reset (string_value); } break; } }