diff --git a/lldb/include/lldb/Core/PropertiesBase.td b/lldb/include/lldb/Core/PropertiesBase.td --- a/lldb/include/lldb/Core/PropertiesBase.td +++ b/lldb/include/lldb/Core/PropertiesBase.td @@ -49,3 +49,9 @@ class EnumValues { string EnumValues = enum; } + +// Determines the element type for arrays and dictionaries. +class ElementType { + string ElementType = value; + bit HasElementType = 1; +} diff --git a/lldb/source/Target/TargetProperties.td b/lldb/source/Target/TargetProperties.td --- a/lldb/source/Target/TargetProperties.td +++ b/lldb/source/Target/TargetProperties.td @@ -79,7 +79,7 @@ DefaultStringValue<"">, Desc<"A list containing all the arguments to be passed to the executable when it is run. Note that this does NOT include the argv[0] which is in target.arg0.">; def EnvVars: Property<"env-vars", "Dictionary">, - DefaultUnsignedValue<16>, + ElementType<"String">, Desc<"A list of all the environment variables to be passed to the executable's environment, and their values.">; def InheritEnv: Property<"inherit-env", "Boolean">, DefaultTrue, @@ -140,7 +140,7 @@ Desc<"Expressions that crash will show up in crash logs if the host system supports executable specific crash log strings and this setting is set to true.">; def TrapHandlerNames: Property<"trap-handler-names", "Array">, Global, - DefaultUnsignedValue<16>, + ElementType<"String">, Desc<"A list of trap handler function names, e.g. a common Unix user process one is _sigtramp.">; def DisplayRuntimeSupportValues: Property<"display-runtime-support-values", "Boolean">, DefaultFalse, @@ -164,7 +164,7 @@ DefaultFalse, Desc<"Disable reading and caching of memory in fixed-size units.">; def ExtraStartCommand: Property<"extra-startup-command", "Array">, - DefaultUnsignedValue<16>, + ElementType<"String">, Desc<"A list containing extra commands understood by the particular process plugin used. For instance, to turn on debugserver logging set this to 'QSetLogging:bitmask=LOG_DEFAULT;'">; def IgnoreBreakpointsInExpressions: Property<"ignore-breakpoints-in-expressions", "Boolean">, Global, diff --git a/lldb/utils/TableGen/LLDBPropertyDefEmitter.cpp b/lldb/utils/TableGen/LLDBPropertyDefEmitter.cpp --- a/lldb/utils/TableGen/LLDBPropertyDefEmitter.cpp +++ b/lldb/utils/TableGen/LLDBPropertyDefEmitter.cpp @@ -35,8 +35,9 @@ OS << ", "; // Emit the property type. + llvm::StringRef type = Property->getValueAsString("Type"); OS << "OptionValue::eType"; - OS << Property->getValueAsString("Type"); + OS << type; OS << ", "; // Emit the property's global value. @@ -46,11 +47,12 @@ bool hasDefaultUnsignedValue = Property->getValue("HasDefaultUnsignedValue"); bool hasDefaultEnumValue = Property->getValue("HasDefaultEnumValue"); bool hasDefaultStringValue = Property->getValue("HasDefaultStringValue"); + bool hasElementType = Property->getValue("HasElementType"); // Guarantee that every property has a default value. assert((hasDefaultUnsignedValue || hasDefaultEnumValue || - hasDefaultStringValue) && - "Property must have a default value"); + hasDefaultStringValue || hasElementType) && + "Property must have a default value or an element type"); // Guarantee that no property has both a default unsigned value and a default // enum value, since they're bothed stored in the same field. @@ -72,11 +74,18 @@ !(Property->getValueAsString("Type") == "Enum" && !hasDefaultEnumValue) && "Enum property must have a enum default value."); + // Guarantee that only arrays and dictionaries have an element type; + assert(((type != "Array" && type != "Dictionary") || hasElementType) && + "Only dictionaries and arrays can have an element type."); + // Emit the default uint value. if (hasDefaultUnsignedValue) { OS << std::to_string(Property->getValueAsInt("DefaultUnsignedValue")); } else if (hasDefaultEnumValue) { OS << Property->getValueAsString("DefaultEnumValue"); + } else if (hasElementType) { + OS << "OptionValue::eType"; + OS << Property->getValueAsString("ElementType"); } else { OS << "0"; }