Index: lldb/trunk/CMakeLists.txt =================================================================== --- lldb/trunk/CMakeLists.txt +++ lldb/trunk/CMakeLists.txt @@ -57,6 +57,9 @@ add_subdirectory(tools) add_subdirectory(docs) +# Needed by tablegen. +add_subdirectory(include/lldb/Core) + option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." ${LLVM_INCLUDE_TESTS}) option(LLDB_TEST_USE_CUSTOM_C_COMPILER "Use the C compiler provided via LLDB_TEST_C_COMPILER for building test inferiors (instead of the just-built compiler). Defaults to OFF." OFF) option(LLDB_TEST_USE_CUSTOM_CXX_COMPILER "Use the C++ compiler provided via LLDB_TEST_CXX_COMPILER for building test inferiors (instead of the just-built compiler). Defaults to OFF." OFF) Index: lldb/trunk/include/lldb/Core/CMakeLists.txt =================================================================== --- lldb/trunk/include/lldb/Core/CMakeLists.txt +++ lldb/trunk/include/lldb/Core/CMakeLists.txt @@ -0,0 +1,7 @@ +lldb_tablegen(Properties.inc -gen-lldb-property-defs + SOURCE Properties.td + TARGET LLDBPropertiesGen) + +lldb_tablegen(PropertiesEnum.inc -gen-lldb-property-enum-defs + SOURCE Properties.td + TARGET LLDBPropertiesEnumGen) Index: lldb/trunk/include/lldb/Core/Properties.td =================================================================== --- lldb/trunk/include/lldb/Core/Properties.td +++ lldb/trunk/include/lldb/Core/Properties.td @@ -0,0 +1,379 @@ +include "PropertiesBase.td" + +let Definition = "experimental" in { + def InjectLocalVars : Property<"inject-local-vars", "Boolean">, + Global, DefaultTrue, + Desc<"If true, inject local variables explicitly into the expression text. This will fix symbol resolution when there are name collisions between ivars and local variables. But it can make expressions run much more slowly.">; + def UseModernTypeLookup : Property<"use-modern-type-lookup", "Boolean">, + Global, DefaultFalse, + Desc<"If true, use Clang's modern type lookup infrastructure.">; +} + +let Definition = "target" in { + def DefaultArch: Property<"default-arch", "Arch">, + Global, + DefaultStringValue<"">, + Desc<"Default architecture to choose, when there's a choice.">; + def MoveToNearestCode: Property<"move-to-nearest-code", "Boolean">, + DefaultTrue, + Desc<"Move breakpoints to nearest code.">; + def Language: Property<"language", "Language">, + DefaultEnumValue<"eLanguageTypeUnknown">, + Desc<"The language to use when interpreting expressions entered in commands.">; + def ExprPrefix: Property<"expr-prefix", "FileSpec">, + DefaultStringValue<"">, + Desc<"Path to a file containing expressions to be prepended to all expressions.">; + def PreferDynamic: Property<"prefer-dynamic-value", "Enum">, + DefaultEnumValue<"eDynamicDontRunTarget">, + EnumValues<"OptionEnumValues(g_dynamic_value_types)">, + Desc<"Should printed values be shown as their dynamic value.">; + def EnableSynthetic: Property<"enable-synthetic-value", "Boolean">, + DefaultTrue, + Desc<"Should synthetic values be used by default whenever available.">; + def SkipPrologue: Property<"skip-prologue", "Boolean">, + DefaultTrue, + Desc<"Skip function prologues when setting breakpoints by name.">; + def SourceMap: Property<"source-map", "PathMap">, + DefaultStringValue<"">, + Desc<"Source path remappings are used to track the change of location between a source file when built, and where it exists on the current system. It consists of an array of duples, the first element of each duple is some part (starting at the root) of the path to the file when it was built, and the second is where the remainder of the original build hierarchy is rooted on the local system. Each element of the array is checked in order and the first one that results in a match wins.">; + def ExecutableSearchPaths: Property<"exec-search-paths", "FileSpecList">, + DefaultStringValue<"">, + Desc<"Executable search paths to use when locating executable files whose paths don't match the local file system.">; + def DebugFileSearchPaths: Property<"debug-file-search-paths", "FileSpecList">, + DefaultStringValue<"">, + Desc<"List of directories to be searched when locating debug symbol files. See also symbols.enable-external-lookup.">; + def ClangModuleSearchPaths: Property<"clang-module-search-paths", "FileSpecList">, + DefaultStringValue<"">, + Desc<"List of directories to be searched when locating modules for Clang.">; + def AutoImportClangModules: Property<"auto-import-clang-modules", "Boolean">, + DefaultTrue, + Desc<"Automatically load Clang modules referred to by the program.">; + def ImportStdModule: Property<"import-std-module", "Boolean">, + DefaultFalse, + Desc<"Import the C++ std module to improve debugging STL containers.">; + def AutoApplyFixIts: Property<"auto-apply-fixits", "Boolean">, + DefaultTrue, + Desc<"Automatically apply fix-it hints to expressions.">; + def NotifyAboutFixIts: Property<"notify-about-fixits", "Boolean">, + DefaultTrue, + Desc<"Print the fixed expression text.">; + def SaveObjects: Property<"save-jit-objects", "Boolean">, + DefaultFalse, + Desc<"Save intermediate object files generated by the LLVM JIT">; + def MaxChildrenCount: Property<"max-children-count", "SInt64">, + DefaultUnsignedValue<256>, + Desc<"Maximum number of children to expand in any level of depth.">; + def MaxSummaryLength: Property<"max-string-summary-length", "SInt64">, + DefaultUnsignedValue<1024>, + Desc<"Maximum number of characters to show when using %s in summary strings.">; + def MaxMemReadSize: Property<"max-memory-read-size", "SInt64">, + DefaultUnsignedValue<1024>, + Desc<"Maximum number of bytes that 'memory read' will fetch before --force must be specified.">; + def BreakpointUseAvoidList: Property<"breakpoints-use-platform-avoid-list", "Boolean">, + DefaultTrue, + Desc<"Consult the platform module avoid list when setting non-module specific breakpoints.">; + def Arg0: Property<"arg0", "String">, + DefaultStringValue<"">, + Desc<"The first argument passed to the program in the argument array which can be different from the executable itself.">; + def RunArgs: Property<"run-args", "Args">, + 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>, + 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, + Desc<"Inherit the environment from the process that is running LLDB.">; + def InputPath: Property<"input-path", "FileSpec">, + DefaultStringValue<"">, + Desc<"The file/path to be used by the executable program for reading its standard input.">; + def OutputPath: Property<"output-path", "FileSpec">, + DefaultStringValue<"">, + Desc<"The file/path to be used by the executable program for writing its standard output.">; + def ErrorPath: Property<"error-path", "FileSpec">, + DefaultStringValue<"">, + Desc<"The file/path to be used by the executable program for writing its standard error.">; + def DetachOnError: Property<"detach-on-error", "Boolean">, + DefaultTrue, + Desc<"debugserver will detach (rather than killing) a process if it loses connection with lldb.">; + def PreloadSymbols: Property<"preload-symbols", "Boolean">, + DefaultTrue, + Desc<"Enable loading of symbol tables before they are needed.">; + def DisableASLR: Property<"disable-aslr", "Boolean">, + DefaultTrue, + Desc<"Disable Address Space Layout Randomization (ASLR)">; + def DisableSTDIO: Property<"disable-stdio", "Boolean">, + DefaultFalse, + Desc<"Disable stdin/stdout for process (e.g. for a GUI application)">; + def InlineStrategy: Property<"inline-breakpoint-strategy", "Enum">, + DefaultEnumValue<"eInlineBreakpointsAlways">, + EnumValues<"OptionEnumValues(g_inline_breakpoint_enums)">, + Desc<"The strategy to use when settings breakpoints by file and line. Breakpoint locations can end up being inlined by the compiler, so that a compile unit 'a.c' might contain an inlined function from another source file. Usually this is limited to breakpoint locations from inlined functions from header or other include files, or more accurately non-implementation source files. Sometimes code might #include implementation files and cause inlined breakpoint locations in inlined implementation files. Always checking for inlined breakpoint locations can be expensive (memory and time), so if you have a project with many headers and find that setting breakpoints is slow, then you can change this setting to headers. This setting allows you to control exactly which strategy is used when setting file and line breakpoints.">; + def DisassemblyFlavor: Property<"x86-disassembly-flavor", "Enum">, + DefaultEnumValue<"eX86DisFlavorDefault">, + EnumValues<"OptionEnumValues(g_x86_dis_flavor_value_types)">, + Desc<"The default disassembly flavor to use for x86 or x86-64 targets.">; + def UseHexImmediates: Property<"use-hex-immediates", "Boolean">, + DefaultTrue, + Desc<"Show immediates in disassembly as hexadecimal.">; + def HexImmediateStyle: Property<"hex-immediate-style", "Enum">, + DefaultEnumValue<"Disassembler::eHexStyleC">, + EnumValues<"OptionEnumValues(g_hex_immediate_style_values)">, + Desc<"Which style to use for printing hexadecimal disassembly values.">; + def UseFastStepping: Property<"use-fast-stepping", "Boolean">, + DefaultTrue, + Desc<"Use a fast stepping algorithm based on running from branch to branch rather than instruction single-stepping.">; + def LoadScriptFromSymbolFile: Property<"load-script-from-symbol-file", "Enum">, + DefaultEnumValue<"eLoadScriptFromSymFileWarn">, + EnumValues<"OptionEnumValues(g_load_script_from_sym_file_values)">, + Desc<"Allow LLDB to load scripting resources embedded in symbol files when available.">; + def LoadCWDlldbinitFile: Property<"load-cwd-lldbinit", "Enum">, + DefaultEnumValue<"eLoadCWDlldbinitWarn">, + EnumValues<"OptionEnumValues(g_load_current_working_dir_lldbinit_values)">, + Desc<"Allow LLDB to .lldbinit files from the current directory automatically.">; + def MemoryModuleLoadLevel: Property<"memory-module-load-level", "Enum">, + DefaultEnumValue<"eMemoryModuleLoadLevelComplete">, + EnumValues<"OptionEnumValues(g_memory_module_load_level_values)">, + Desc<"Loading modules from memory can be slow as reading the symbol tables and other data can take a long time depending on your connection to the debug target. This setting helps users control how much information gets loaded when loading modules from memory.'complete' is the default value for this setting which will load all sections and symbols by reading them from memory (slowest, most accurate). 'partial' will load sections and attempt to find function bounds without downloading the symbol table (faster, still accurate, missing symbol names). 'minimal' is the fastest setting and will load section data with no symbols, but should rarely be used as stack frames in these memory regions will be inaccurate and not provide any context (fastest). ">; + def DisplayExpressionsInCrashlogs: Property<"display-expression-in-crashlogs", "Boolean">, + DefaultFalse, + 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>, + 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, + Desc<"If true, LLDB will show variables that are meant to support the operation of a language's runtime support.">; + def DisplayRecognizedArguments: Property<"display-recognized-arguments", "Boolean">, + DefaultFalse, + Desc<"Show recognized arguments in variable listings by default.">; + def NonStopModeEnabled: Property<"non-stop-mode", "Boolean">, + DefaultFalse, + Desc<"Disable lock-step debugging, instead control threads independently.">; + def RequireHardwareBreakpoints: Property<"require-hardware-breakpoint", "Boolean">, + DefaultFalse, + Desc<"Require all breakpoints to be hardware breakpoints.">; +} + +let Definition = "process" in { + def DisableMemCache: Property<"disable-memory-cache", "Boolean">, + DefaultFalse, + Desc<"Disable reading and caching of memory in fixed-size units.">; + def ExtraStartCommand: Property<"extra-startup-command", "Array">, + DefaultUnsignedValue<16>, + 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, + DefaultTrue, + Desc<"If true, breakpoints will be ignored during expression evaluation.">; + def UnwindOnErrorInExpressions: Property<"unwind-on-error-in-expressions", "Boolean">, + Global, + DefaultTrue, + Desc<"If true, errors in expression evaluation will unwind the stack back to the state before the call.">; + def PythonOSPluginPath: Property<"python-os-plugin-path", "FileSpec">, + DefaultUnsignedValue<1>, + Desc<"A path to a python OS plug-in module file that contains a OperatingSystemPlugIn class.">; + def StopOnSharedLibraryEvents: Property<"stop-on-sharedlibrary-events", "Boolean">, + Global, + DefaultFalse, + Desc<"If true, stop when a shared library is loaded or unloaded.">; + def DetachKeepsStopped: Property<"detach-keeps-stopped", "Boolean">, + Global, + DefaultFalse, + Desc<"If true, detach will attempt to keep the process stopped.">; + def MemCacheLineSize: Property<"memory-cache-line-size", "UInt64">, + DefaultUnsignedValue<512>, + Desc<"The memory cache line size">; + def WarningOptimization: Property<"optimization-warnings", "Boolean">, + DefaultTrue, + Desc<"If true, warn when stopped in code that is optimized where stepping and variable availability may not behave as expected.">; + def StopOnExec: Property<"stop-on-exec", "Boolean">, + Global, + DefaultTrue, + Desc<"If true, stop when a shared library is loaded or unloaded.">; + def UtilityExpressionTimeout: Property<"utility-expression-timeout", "UInt64">, + DefaultUnsignedValue<15>, + Desc<"The time in seconds to wait for LLDB-internal utility expressions.">; +} + +let Definition = "platform" in { + def UseModuleCache: Property<"use-module-cache", "Boolean">, + Global, + DefaultTrue, + Desc<"Use module cache.">; + def ModuleCacheDirectory: Property<"module-cache-directory", "FileSpec">, + Global, + DefaultStringValue<"">, + Desc<"Root directory for cached modules.">; +} + +let Definition = "thread" in { + def StepInAvoidsNoDebug: Property<"step-in-avoid-nodebug", "Boolean">, + Global, + DefaultTrue, + Desc<"If true, step-in will not stop in functions with no debug information.">; + def StepOutAvoidsNoDebug: Property<"step-out-avoid-nodebug", "Boolean">, + Global, + DefaultFalse, + Desc<"If true, when step-in/step-out/step-over leave the current frame, they will continue to step out till they come to a function with debug information. Passing a frame argument to step-out will override this option.">; + def StepAvoidRegex: Property<"step-avoid-regexp", "Regex">, + Global, + DefaultStringValue<"^std::">, + Desc<"A regular expression defining functions step-in won't stop in.">; + def StepAvoidLibraries: Property<"step-avoid-libraries", "FileSpecList">, + Global, + DefaultStringValue<"">, + Desc<"A list of libraries that source stepping won't stop in.">; + def EnableThreadTrace: Property<"trace-thread", "Boolean">, + DefaultFalse, + Desc<"If true, this thread will single-step and log execution.">; + def MaxBacktraceDepth: Property<"max-backtrace-depth", "UInt64">, + DefaultUnsignedValue<300000>, + Desc<"Maximum number of frames to backtrace.">; +} + +let Definition = "modulelist" in { + def EnableExternalLookup: Property<"enable-external-lookup", "Boolean">, + Global, + DefaultTrue, + Desc<"Control the use of external tools and repositories to locate symbol files. Directories listed in target.debug-file-search-paths and directory of the executable are always checked first for separate debug info files. Then depending on this setting: On macOS, Spotlight would be also used to locate a matching .dSYM bundle based on the UUID of the executable. On NetBSD, directory /usr/libdata/debug would be also searched. On platforms other than NetBSD directory /usr/lib/debug would be also searched.">; + def ClangModulesCachePath: Property<"clang-modules-cache-path", "FileSpec">, + Global, + DefaultStringValue<"">, + Desc<"The path to the clang modules cache directory (-fmodules-cache-path).">; +} + +let Definition = "debugger" in { + def AutoConfirm: Property<"auto-confirm", "Boolean">, + Global, + DefaultFalse, + Desc<"If true all confirmation prompts will receive their default reply.">; + def DisassemblyFormat: Property<"disassembly-format", "FormatEntity">, + Global, + DefaultStringValue<"{${function.initial-function}{${module.file.basename}`}{${function.name-without-args}}:\n}{${function.changed}\n{${module.file.basename}`}{${function.name-without-args}}:\n}{${current-pc-arrow} }${addr-file-or-load}{ <${function.concrete-only-addr-offset-no-padding}>}: ">, + Desc<"The default disassembly format string to use when disassembling instruction sequences.">; + def FrameFormat: Property<"frame-format", "FormatEntity">, + Global, + DefaultStringValue<"frame #${frame.index}: ${ansi.fg.yellow}${frame.pc}${ansi.normal}{ ${module.file.basename}{`${function.name-with-args}{${frame.no-debug}${function.pc-offset}}}}{ at ${ansi.fg.cyan}${line.file.basename}${ansi.normal}:${ansi.fg.yellow}${line.number}${ansi.normal}{:${ansi.fg.yellow}${line.column}${ansi.normal}}}{${function.is-optimized} [opt]}{${frame.is-artificial} [artificial]}\n">, + Desc<"The default frame format string to use when displaying stack frame information for threads.">; + def NotiftVoid: Property<"notify-void", "Boolean">, + Global, + DefaultFalse, + Desc<"Notify the user explicitly if an expression returns void (default: false).">; + def Prompt: Property<"prompt", "String">, + Global, + DefaultEnumValue<"OptionValueString::eOptionEncodeCharacterEscapeSequences">, + DefaultStringValue<"(lldb) ">, + Desc<"The debugger command line prompt displayed for the user.">; + def ScriptLanguage: Property<"script-lang", "Enum">, + Global, + DefaultEnumValue<"eScriptLanguagePython">, + EnumValues<"OptionEnumValues(g_language_enumerators)">, + Desc<"The script language to be used for evaluating user-written scripts.">; + def StopDisassemblyCount: Property<"stop-disassembly-count", "SInt64">, + Global, + DefaultUnsignedValue<4>, + Desc<"The number of disassembly lines to show when displaying a stopped context.">; + def StopDisassemblyDisplay: Property<"stop-disassembly-display", "Enum">, + Global, + DefaultEnumValue<"Debugger::eStopDisassemblyTypeNoDebugInfo">, + EnumValues<"OptionEnumValues(g_show_disassembly_enum_values)">, + Desc<"Control when to display disassembly when displaying a stopped context.">; + def StopLineCountAfter: Property<"stop-line-count-after", "SInt64">, + Global, + DefaultUnsignedValue<3>, + Desc<"The number of sources lines to display that come after the current source line when displaying a stopped context.">; + def StopLineCountBefore: Property<"stop-line-count-before", "SInt64">, + Global, + DefaultUnsignedValue<3>, + Desc<"The number of sources lines to display that come before the current source line when displaying a stopped context.">; + def HighlightSource: Property<"highlight-source", "Boolean">, + Global, + DefaultTrue, + Desc<"If true, LLDB will highlight the displayed source code.">; + def StopShowColumn: Property<"stop-show-column", "Enum">, + DefaultEnumValue<"eStopShowColumnAnsiOrCaret">, + EnumValues<"OptionEnumValues(s_stop_show_column_values)">, + Desc<"If true, LLDB will use the column information from the debug info to mark the current position when displaying a stopped context.">; + def StopShowColumnAnsiPrefix: Property<"stop-show-column-ansi-prefix", "String">, + Global, + DefaultStringValue<"${ansi.underline}">, + Desc<"When displaying the column marker in a color-enabled (i.e. ANSI) terminal, use the ANSI terminal code specified in this format at the immediately before the column to be marked.">; + def StopShowColumnAnsiSuffix: Property<"stop-show-column-ansi-suffix", "String">, + Global, + DefaultStringValue<"${ansi.normal}">, + Desc<"When displaying the column marker in a color-enabled (i.e. ANSI) terminal, use the ANSI terminal code specified in this format immediately after the column to be marked.">; + def TerminalWidth: Property<"term-width", "SInt64">, + Global, + DefaultUnsignedValue<80>, + Desc<"The maximum number of columns to use for displaying text.">; + def ThreadFormat: Property<"thread-format", "FormatEntity">, + Global, + DefaultStringValue<"thread #${thread.index}: tid = ${thread.id%tid}{, ${frame.pc}}{ ${module.file.basename}{`${function.name-with-args}{${frame.no-debug}${function.pc-offset}}}}{ at ${ansi.fg.cyan}${line.file.basename}${ansi.normal}:${ansi.fg.yellow}${line.number}${ansi.normal}{:${ansi.fg.yellow}${line.column}${ansi.normal}}}{, name = ${ansi.fg.green}'${thread.name}'${ansi.normal}}{, queue = ${ansi.fg.green}'${thread.queue}'${ansi.normal}}{, activity = ${ansi.fg.green}'${thread.info.activity.name}'${ansi.normal}}{, ${thread.info.trace_messages} messages}{, stop reason = ${ansi.fg.red}${thread.stop-reason}${ansi.normal}}{\nReturn value: ${thread.return-value}}{\nCompleted expression: ${thread.completed-expression}}\n">, + Desc<"The default thread format string to use when displaying thread information.">; + def ThreadStopFormat: Property<"thread-stop-format", "FormatEntity">, + Global, + DefaultStringValue<"thread #${thread.index}{, name = '${thread.name}'}{, queue = ${ansi.fg.green}'${thread.queue}'${ansi.normal}}{, activity = ${ansi.fg.green}'${thread.info.activity.name}'${ansi.normal}}{, ${thread.info.trace_messages} messages}{, stop reason = ${ansi.fg.red}${thread.stop-reason}${ansi.normal}}{\nReturn value: ${thread.return-value}}{\nCompleted expression: ${thread.completed-expression}}\n">, + Desc<"The default thread format string to use when displaying thread information as part of the stop display.">; + def UseExternalEditor: Property<"use-external-editor", "Boolean">, + Global, + DefaultFalse, + Desc<"Whether to use an external editor or not.">; + def UseColor: Property<"use-color", "Boolean">, + Global, + DefaultTrue, + Desc<"Whether to use Ansi color codes or not.">; + def AutoOneLineSummaries: Property<"auto-one-line-summaries", "Boolean">, + Global, + DefaultTrue, + Desc<"If true, LLDB will automatically display small structs in one-liner format (default: true).">; + def AutoIndent: Property<"auto-indent", "Boolean">, + Global, + DefaultTrue, + Desc<"If true, LLDB will auto indent/outdent code. Currently only supported in the REPL (default: true).">; + def PrintDecls: Property<"print-decls", "Boolean">, + Global, + DefaultTrue, + Desc<"If true, LLDB will print the values of variables declared in an expression. Currently only supported in the REPL (default: true).">; + def TabSize: Property<"tab-size", "UInt64">, + Global, + DefaultUnsignedValue<4>, + Desc<"The tab size to use when indenting code in multi-line input mode (default: 4).">; + def EscapeNonPrintables: Property<"escape-non-printables", "Boolean">, + Global, + DefaultTrue, + Desc<"If true, LLDB will automatically escape non-printable and escape characters when formatting strings.">; + def FrameFormatUnique: Property<"frame-format-unique", "FormatEntity">, + Global, + DefaultStringValue<"frame #${frame.index}: ${ansi.fg.yellow}${frame.pc}${ansi.normal}{ ${module.file.basename}{`${function.name-without-args}{${frame.no-debug}${function.pc-offset}}}}{ at ${ansi.fg.cyan}${line.file.basename}${ansi.normal}:${ansi.fg.yellow}${line.number}${ansi.normal}{:${ansi.fg.yellow}${line.column}${ansi.normal}}}{${function.is-optimized} [opt]}{${frame.is-artificial} [artificial]}\n">, + Desc<"The default frame format string to use when displaying stack frameinformation for threads from thread backtrace unique.">; +} + + +let Definition = "commandinterpreter" in { + def ExpandRegexAliases: Property<"expand-regex-aliases", "Boolean">, + Global, + DefaultFalse, + Desc<"If true, regular expression alias commands will show the expanded command that will be executed. This can be used to debug new regular expression alias commands.">; + def PromptOnQuit: Property<"prompt-on-quit", "Boolean">, + Global, + DefaultTrue, + Desc<"If true, LLDB will prompt you before quitting if there are any live processes being debugged. If false, LLDB will quit without asking in any case.">; + def StopCmdSourceOnError: Property<"stop-command-source-on-error", "Boolean">, + Global, + DefaultTrue, + Desc<"If true, LLDB will stop running a 'command source' script upon encountering an error.">; + def SpaceReplPrompts: Property<"space-repl-prompts", "Boolean">, + Global, + DefaultFalse, + Desc<"If true, blank lines will be printed between between REPL submissions.">; + def EchoCommands: Property<"echo-commands", "Boolean">, + Global, + DefaultTrue, + Desc<"If true, commands will be echoed before they are evaluated.">; + def EchoCommentCommands: Property<"echo-comment-commands", "Boolean">, + Global, + DefaultTrue, + Desc<"If true, commands will be echoed even if they are pure comment lines.">; +} Index: lldb/trunk/include/lldb/Core/PropertiesBase.td =================================================================== --- lldb/trunk/include/lldb/Core/PropertiesBase.td +++ lldb/trunk/include/lldb/Core/PropertiesBase.td @@ -0,0 +1,49 @@ +// Base class for all options. +class Property { + string Name = name; + string Type = type; + string Definition; +} + +// Sets the description for the property that should be displayed to the user. +class Desc { + string Description = description; +} + +// Marks the property as global. +class Global { + bit Global = 1; +} + +class DefaultTrue { + int DefaultUnsignedValue = 1; + bit HasDefaultUnsignedValue = 1; +} + +class DefaultFalse { + int DefaultUnsignedValue = 0; + bit HasDefaultUnsignedValue = 1; +} + +// Gives the property a default string value. +class DefaultStringValue { + string DefaultStringValue = value; + bit HasDefaultStringValue = 1; +} + +// Gives the property a default enum value. +class DefaultEnumValue { + string DefaultEnumValue = value; + bit HasDefaultEnumValue = 1; +} + +// Gives the property a default string value. +class DefaultUnsignedValue { + int DefaultUnsignedValue = value; + bit HasDefaultUnsignedValue = 1; +} + +// Gives the property enum values. +class EnumValues { + string EnumValues = enum; +} Index: lldb/trunk/source/Core/CMakeLists.txt =================================================================== --- lldb/trunk/source/Core/CMakeLists.txt +++ lldb/trunk/source/Core/CMakeLists.txt @@ -76,6 +76,8 @@ Demangle ) +add_dependencies(lldbCore LLDBPropertiesGen LLDBPropertiesEnumGen) + # Needed to properly resolve references in a debug build. # TODO: Remove once we have better layering set_target_properties(lldbCore PROPERTIES LINK_INTERFACE_MULTIPLICITY 4) Index: lldb/trunk/source/Core/Debugger.cpp =================================================================== --- lldb/trunk/source/Core/Debugger.cpp +++ lldb/trunk/source/Core/Debugger.cpp @@ -203,119 +203,13 @@ {eStopShowColumnNone, "none", "Do not highlight the stop column."}}; static constexpr PropertyDefinition g_properties[] = { - {"auto-confirm", OptionValue::eTypeBoolean, true, false, nullptr, {}, - "If true all confirmation prompts will receive their default reply."}, - {"disassembly-format", OptionValue::eTypeFormatEntity, true, 0, - DEFAULT_DISASSEMBLY_FORMAT, {}, - "The default disassembly format " - "string to use when disassembling " - "instruction sequences."}, - {"frame-format", OptionValue::eTypeFormatEntity, true, 0, - DEFAULT_FRAME_FORMAT, {}, - "The default frame format string to use " - "when displaying stack frame information " - "for threads."}, - {"notify-void", OptionValue::eTypeBoolean, true, false, nullptr, {}, - "Notify the user explicitly if an expression returns void (default: " - "false)."}, - {"prompt", OptionValue::eTypeString, true, - OptionValueString::eOptionEncodeCharacterEscapeSequences, "(lldb) ", {}, - "The debugger command line prompt displayed for the user."}, - {"script-lang", OptionValue::eTypeEnum, true, eScriptLanguagePython, - nullptr, OptionEnumValues(g_language_enumerators), - "The script language to be used for evaluating user-written scripts."}, - {"stop-disassembly-count", OptionValue::eTypeSInt64, true, 4, nullptr, {}, - "The number of disassembly lines to show when displaying a " - "stopped context."}, - {"stop-disassembly-display", OptionValue::eTypeEnum, true, - Debugger::eStopDisassemblyTypeNoDebugInfo, nullptr, - OptionEnumValues(g_show_disassembly_enum_values), - "Control when to display disassembly when displaying a stopped context."}, - {"stop-line-count-after", OptionValue::eTypeSInt64, true, 3, nullptr, {}, - "The number of sources lines to display that come after the " - "current source line when displaying a stopped context."}, - {"stop-line-count-before", OptionValue::eTypeSInt64, true, 3, nullptr, {}, - "The number of sources lines to display that come before the " - "current source line when displaying a stopped context."}, - {"highlight-source", OptionValue::eTypeBoolean, true, true, nullptr, {}, - "If true, LLDB will highlight the displayed source code."}, - {"stop-show-column", OptionValue::eTypeEnum, false, - eStopShowColumnAnsiOrCaret, nullptr, OptionEnumValues(s_stop_show_column_values), - "If true, LLDB will use the column information from the debug info to " - "mark the current position when displaying a stopped context."}, - {"stop-show-column-ansi-prefix", OptionValue::eTypeString, true, 0, - "${ansi.underline}", {}, - "When displaying the column marker in a color-enabled (i.e. ANSI) " - "terminal, use the ANSI terminal code specified in this format at the " - "immediately before the column to be marked."}, - {"stop-show-column-ansi-suffix", OptionValue::eTypeString, true, 0, - "${ansi.normal}", {}, - "When displaying the column marker in a color-enabled (i.e. ANSI) " - "terminal, use the ANSI terminal code specified in this format " - "immediately after the column to be marked."}, - {"term-width", OptionValue::eTypeSInt64, true, 80, nullptr, {}, - "The maximum number of columns to use for displaying text."}, - {"thread-format", OptionValue::eTypeFormatEntity, true, 0, - DEFAULT_THREAD_FORMAT, {}, - "The default thread format string to use " - "when displaying thread information."}, - {"thread-stop-format", OptionValue::eTypeFormatEntity, true, 0, - DEFAULT_THREAD_STOP_FORMAT, {}, - "The default thread format " - "string to use when displaying thread " - "information as part of the stop display."}, - {"use-external-editor", OptionValue::eTypeBoolean, true, false, nullptr, {}, - "Whether to use an external editor or not."}, - {"use-color", OptionValue::eTypeBoolean, true, true, nullptr, {}, - "Whether to use Ansi color codes or not."}, - {"auto-one-line-summaries", OptionValue::eTypeBoolean, true, true, nullptr, - {}, - "If true, LLDB will automatically display small structs in " - "one-liner format (default: true)."}, - {"auto-indent", OptionValue::eTypeBoolean, true, true, nullptr, {}, - "If true, LLDB will auto indent/outdent code. Currently only supported in " - "the REPL (default: true)."}, - {"print-decls", OptionValue::eTypeBoolean, true, true, nullptr, {}, - "If true, LLDB will print the values of variables declared in an " - "expression. Currently only supported in the REPL (default: true)."}, - {"tab-size", OptionValue::eTypeUInt64, true, 4, nullptr, {}, - "The tab size to use when indenting code in multi-line input mode " - "(default: 4)."}, - {"escape-non-printables", OptionValue::eTypeBoolean, true, true, nullptr, - {}, - "If true, LLDB will automatically escape non-printable and " - "escape characters when formatting strings."}, - {"frame-format-unique", OptionValue::eTypeFormatEntity, true, 0, - DEFAULT_FRAME_FORMAT_NO_ARGS, {}, - "The default frame format string to use when displaying stack frame" - "information for threads from thread backtrace unique."}}; +#define LLDB_PROPERTIES_debugger +#include "lldb/Core/Properties.inc" +}; enum { - ePropertyAutoConfirm = 0, - ePropertyDisassemblyFormat, - ePropertyFrameFormat, - ePropertyNotiftVoid, - ePropertyPrompt, - ePropertyScriptLanguage, - ePropertyStopDisassemblyCount, - ePropertyStopDisassemblyDisplay, - ePropertyStopLineCountAfter, - ePropertyStopLineCountBefore, - ePropertyHighlightSource, - ePropertyStopShowColumn, - ePropertyStopShowColumnAnsiPrefix, - ePropertyStopShowColumnAnsiSuffix, - ePropertyTerminalWidth, - ePropertyThreadFormat, - ePropertyThreadStopFormat, - ePropertyUseExternalEditor, - ePropertyUseColor, - ePropertyAutoOneLineSummaries, - ePropertyAutoIndent, - ePropertyPrintDecls, - ePropertyTabSize, - ePropertyEscapeNonPrintables, - ePropertyFrameFormatUnique, +#define LLDB_PROPERTIES_debugger +#include "lldb/Core/PropertiesEnum.inc" }; LoadPluginCallbackType Debugger::g_load_plugin_callback = nullptr; Index: lldb/trunk/source/Core/ModuleList.cpp =================================================================== --- lldb/trunk/source/Core/ModuleList.cpp +++ lldb/trunk/source/Core/ModuleList.cpp @@ -66,23 +66,14 @@ namespace { static constexpr PropertyDefinition g_properties[] = { - {"enable-external-lookup", OptionValue::eTypeBoolean, true, true, nullptr, - {}, - "Control the use of external tools and repositories to locate symbol " - "files. Directories listed in target.debug-file-search-paths and " - "directory of the executable are always checked first for separate debug " - "info files. Then depending on this setting: " - "On macOS, Spotlight would be also used to locate a matching .dSYM " - "bundle based on the UUID of the executable. " - "On NetBSD, directory /usr/libdata/debug would be also searched. " - "On platforms other than NetBSD directory /usr/lib/debug would be " - "also searched." - }, - {"clang-modules-cache-path", OptionValue::eTypeFileSpec, true, 0, nullptr, - {}, - "The path to the clang modules cache directory (-fmodules-cache-path)."}}; +#define LLDB_PROPERTIES_modulelist +#include "lldb/Core/Properties.inc" +}; -enum { ePropertyEnableExternalLookup, ePropertyClangModulesCachePath }; +enum { +#define LLDB_PROPERTIES_modulelist +#include "lldb/Core/PropertiesEnum.inc" +}; } // namespace Index: lldb/trunk/source/Interpreter/CommandInterpreter.cpp =================================================================== --- lldb/trunk/source/Interpreter/CommandInterpreter.cpp +++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp @@ -77,10 +77,6 @@ static const char *k_white_space = " \t\v"; -static constexpr bool NoGlobalSetting = true; -static constexpr uintptr_t DefaultValueTrue = true; -static constexpr uintptr_t DefaultValueFalse = false; -static constexpr const char *NoCStrDefault = nullptr; static constexpr const char *InitFileWarning = "There is a .lldbinit file in the current directory which is not being " "read.\n" @@ -94,37 +90,13 @@ "accept the security risk."; static constexpr PropertyDefinition g_properties[] = { - {"expand-regex-aliases", OptionValue::eTypeBoolean, NoGlobalSetting, - DefaultValueFalse, NoCStrDefault, {}, - "If true, regular expression alias commands will show the " - "expanded command that will be executed. This can be used to " - "debug new regular expression alias commands."}, - {"prompt-on-quit", OptionValue::eTypeBoolean, NoGlobalSetting, - DefaultValueTrue, NoCStrDefault, {}, - "If true, LLDB will prompt you before quitting if there are any live " - "processes being debugged. If false, LLDB will quit without asking in any " - "case."}, - {"stop-command-source-on-error", OptionValue::eTypeBoolean, NoGlobalSetting, - DefaultValueTrue, NoCStrDefault, {}, - "If true, LLDB will stop running a 'command source' " - "script upon encountering an error."}, - {"space-repl-prompts", OptionValue::eTypeBoolean, NoGlobalSetting, - DefaultValueFalse, NoCStrDefault, {}, - "If true, blank lines will be printed between between REPL submissions."}, - {"echo-commands", OptionValue::eTypeBoolean, NoGlobalSetting, - DefaultValueTrue, NoCStrDefault, {}, - "If true, commands will be echoed before they are evaluated."}, - {"echo-comment-commands", OptionValue::eTypeBoolean, NoGlobalSetting, - DefaultValueTrue, NoCStrDefault, {}, - "If true, commands will be echoed even if they are pure comment lines."}}; +#define LLDB_PROPERTIES_commandinterpreter +#include "lldb/Core/Properties.inc" +}; enum { - ePropertyExpandRegexAliases = 0, - ePropertyPromptOnQuit = 1, - ePropertyStopCmdSourceOnError = 2, - eSpaceReplPrompts = 3, - eEchoCommands = 4, - eEchoCommentCommands = 5 +#define LLDB_PROPERTIES_commandinterpreter +#include "lldb/Core/PropertiesEnum.inc" }; ConstString &CommandInterpreter::GetStaticBroadcasterClass() { @@ -170,24 +142,24 @@ } bool CommandInterpreter::GetEchoCommands() const { - const uint32_t idx = eEchoCommands; + const uint32_t idx = ePropertyEchoCommands; return m_collection_sp->GetPropertyAtIndexAsBoolean( nullptr, idx, g_properties[idx].default_uint_value != 0); } void CommandInterpreter::SetEchoCommands(bool b) { - const uint32_t idx = eEchoCommands; + const uint32_t idx = ePropertyEchoCommands; m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b); } bool CommandInterpreter::GetEchoCommentCommands() const { - const uint32_t idx = eEchoCommentCommands; + const uint32_t idx = ePropertyEchoCommentCommands; return m_collection_sp->GetPropertyAtIndexAsBoolean( nullptr, idx, g_properties[idx].default_uint_value != 0); } void CommandInterpreter::SetEchoCommentCommands(bool b) { - const uint32_t idx = eEchoCommentCommands; + const uint32_t idx = ePropertyEchoCommentCommands; m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b); } @@ -227,7 +199,7 @@ } bool CommandInterpreter::GetSpaceReplPrompts() const { - const uint32_t idx = eSpaceReplPrompts; + const uint32_t idx = ePropertySpaceReplPrompts; return m_collection_sp->GetPropertyAtIndexAsBoolean( nullptr, idx, g_properties[idx].default_uint_value != 0); } Index: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/CMakeLists.txt =================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/CMakeLists.txt +++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/CMakeLists.txt @@ -1,3 +1,11 @@ +lldb_tablegen(Properties.inc -gen-lldb-property-defs + SOURCE Properties.td + TARGET LLDBPluginDynamicLoaderDarwinKernelPropertiesGen) + +lldb_tablegen(PropertiesEnum.inc -gen-lldb-property-enum-defs + SOURCE Properties.td + TARGET LLDBPluginDynamicLoaderDarwinKernelPropertiesEnumGen) + add_lldb_library(lldbPluginDynamicLoaderDarwinKernel PLUGIN DynamicLoaderDarwinKernel.cpp @@ -11,3 +19,7 @@ lldbUtility lldbPluginPlatformMacOSX ) + +add_dependencies(lldbPluginDynamicLoaderDarwinKernel + LLDBPluginDynamicLoaderDarwinKernelPropertiesGen + LLDBPluginDynamicLoaderDarwinKernelPropertiesEnumGen) Index: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp =================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp @@ -73,14 +73,14 @@ "on 32-bit targets)."}}; static constexpr PropertyDefinition g_properties[] = { - {"load-kexts", OptionValue::eTypeBoolean, true, true, nullptr, {}, - "Automatically loads kext images when attaching to a kernel."}, - {"scan-type", OptionValue::eTypeEnum, true, eKASLRScanNearPC, nullptr, - OptionEnumValues(g_kaslr_kernel_scan_enum_values), - "Control how many reads lldb will make while searching for a Darwin " - "kernel on attach."}}; +#define LLDB_PROPERTIES_dynamicloaderdarwinkernel +#include "Properties.inc" +}; -enum { ePropertyLoadKexts, ePropertyScanType }; +enum { +#define LLDB_PROPERTIES_dynamicloaderdarwinkernel +#include "PropertiesEnum.inc" +}; class DynamicLoaderDarwinKernelProperties : public Properties { public: Index: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/Properties.td =================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/Properties.td +++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/Properties.td @@ -0,0 +1,13 @@ +include "../../../../include/lldb/Core/PropertiesBase.td" + +let Definition = "dynamicloaderdarwinkernel" in { + def LoadKexts: Property<"load-kexts", "Boolean">, + Global, + DefaultTrue, + Desc<"Automatically loads kext images when attaching to a kernel.">; + def ScanType: Property<"scan-type", "Enum">, + Global, + DefaultEnumValue<"eKASLRScanNearPC">, + EnumValues<"OptionEnumValues(g_kaslr_kernel_scan_enum_values)">, + Desc<"Control how many reads lldb will make while searching for a Darwin kernel on attach.">; +} Index: lldb/trunk/source/Plugins/JITLoader/GDB/CMakeLists.txt =================================================================== --- lldb/trunk/source/Plugins/JITLoader/GDB/CMakeLists.txt +++ lldb/trunk/source/Plugins/JITLoader/GDB/CMakeLists.txt @@ -1,3 +1,11 @@ +lldb_tablegen(Properties.inc -gen-lldb-property-defs + SOURCE Properties.td + TARGET LLDBPluginJITLoaderGDBPropertiesGen) + +lldb_tablegen(PropertiesEnum.inc -gen-lldb-property-enum-defs + SOURCE Properties.td + TARGET LLDBPluginJITLoaderGDBPropertiesEnumGen) + add_lldb_library(lldbPluginJITLoaderGDB PLUGIN JITLoaderGDB.cpp @@ -12,3 +20,6 @@ Support ) +add_dependencies(lldbPluginJITLoaderGDB + LLDBPluginJITLoaderGDBPropertiesGen + LLDBPluginJITLoaderGDBPropertiesEnumGen) Index: lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp =================================================================== --- lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp +++ lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp @@ -67,13 +67,15 @@ }; static constexpr PropertyDefinition g_properties[] = { - {"enable", OptionValue::eTypeEnum, true, - eEnableJITLoaderGDBDefault, nullptr, - OptionEnumValues(g_enable_jit_loader_gdb_enumerators), - "Enable GDB's JIT compilation interface (default: enabled on " - "all platforms except macOS)"}}; +#define LLDB_PROPERTIES_jitloadergdb +#include "Properties.inc" +}; -enum { ePropertyEnable, ePropertyEnableJITBreakpoint }; +enum { +#define LLDB_PROPERTIES_jitloadergdb +#include "PropertiesEnum.inc" + ePropertyEnableJITBreakpoint +}; class PluginProperties : public Properties { public: Index: lldb/trunk/source/Plugins/JITLoader/GDB/Properties.td =================================================================== --- lldb/trunk/source/Plugins/JITLoader/GDB/Properties.td +++ lldb/trunk/source/Plugins/JITLoader/GDB/Properties.td @@ -0,0 +1,9 @@ +include "../../../../include/lldb/Core/PropertiesBase.td" + +let Definition = "jitloadergdb" in { + def Enable: Property<"enable", "Enum">, + Global, + DefaultEnumValue<"eEnableJITLoaderGDBDefault">, + EnumValues<"OptionEnumValues(g_enable_jit_loader_gdb_enumerators)">, + Desc<"Enable GDB's JIT compilation interface (default: enabled on all platforms except macOS)">; +} Index: lldb/trunk/source/Plugins/Platform/MacOSX/CMakeLists.txt =================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/CMakeLists.txt +++ lldb/trunk/source/Plugins/Platform/MacOSX/CMakeLists.txt @@ -1,3 +1,11 @@ +lldb_tablegen(Properties.inc -gen-lldb-property-defs + SOURCE Properties.td + TARGET LLDBPluginPlatformMacOSXPropertiesGen) + +lldb_tablegen(PropertiesEnum.inc -gen-lldb-property-enum-defs + SOURCE Properties.td + TARGET LLDBPluginPlatformMacOSXPropertiesEnumGen) + list(APPEND PLUGIN_PLATFORM_MACOSX_SOURCES PlatformDarwin.cpp PlatformDarwinKernel.cpp @@ -29,7 +37,7 @@ add_lldb_library(lldbPluginPlatformMacOSX PLUGIN ${PLUGIN_PLATFORM_MACOSX_SOURCES} - + LINK_LIBS clangBasic lldbBreakpoint @@ -44,3 +52,7 @@ LINK_COMPONENTS Support ) + +add_dependencies(lldbPluginPlatformMacOSX + LLDBPluginPlatformMacOSXPropertiesGen + LLDBPluginPlatformMacOSXPropertiesEnumGen) Index: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp @@ -178,14 +178,14 @@ /// Code to handle the PlatformDarwinKernel settings static constexpr PropertyDefinition g_properties[] = { - {"search-locally-for-kexts", OptionValue::eTypeBoolean, true, true, NULL, - {}, "Automatically search for kexts on the local system when doing " - "kernel debugging."}, - {"kext-directories", OptionValue::eTypeFileSpecList, false, 0, NULL, {}, - "Directories/KDKs to search for kexts in when starting a kernel debug " - "session."}}; +#define LLDB_PROPERTIES_platformdarwinkernel +#include "Properties.inc" +}; -enum { ePropertySearchForKexts = 0, ePropertyKextDirectories }; +enum { +#define LLDB_PROPERTIES_platformdarwinkernel +#include "PropertiesEnum.inc" +}; class PlatformDarwinKernelProperties : public Properties { public: Index: lldb/trunk/source/Plugins/Platform/MacOSX/Properties.td =================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/Properties.td +++ lldb/trunk/source/Plugins/Platform/MacOSX/Properties.td @@ -0,0 +1,11 @@ +include "../../../../include/lldb/Core/PropertiesBase.td" + +let Definition = "platformdarwinkernel" in { + def SearchForKexts: Property<"search-locally-for-kexts", "Boolean">, + Global, + DefaultTrue, + Desc<"Automatically search for kexts on the local system when doing kernel debugging.">; + def KextDirectories: Property<"kext-directories", "FileSpecList">, + DefaultStringValue<"">, + Desc<"Directories/KDKs to search for kexts in when starting a kernel debug session.">; +} Index: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CMakeLists.txt =================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CMakeLists.txt +++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CMakeLists.txt @@ -1,3 +1,11 @@ +lldb_tablegen(Properties.inc -gen-lldb-property-defs + SOURCE Properties.td + TARGET LLDBPluginProcessMacOSXKernelPropertiesGen) + +lldb_tablegen(PropertiesEnum.inc -gen-lldb-property-enum-defs + SOURCE Properties.td + TARGET LLDBPluginProcessMacOSXKernelPropertiesEnumGen) + add_lldb_library(lldbPluginProcessMacOSXKernel PLUGIN CommunicationKDP.cpp ProcessKDP.cpp @@ -20,3 +28,7 @@ lldbPluginDynamicLoaderStatic lldbPluginProcessUtility ) + +add_dependencies(lldbPluginProcessMacOSXKernel + LLDBPluginProcessMacOSXKernelPropertiesGen + LLDBPluginProcessMacOSXKernelPropertiesEnumGen) Index: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp +++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp @@ -53,10 +53,14 @@ namespace { static constexpr PropertyDefinition g_properties[] = { - {"packet-timeout", OptionValue::eTypeUInt64, true, 5, NULL, {}, - "Specify the default packet timeout in seconds."}}; +#define LLDB_PROPERTIES_processkdp +#include "Properties.inc" +}; -enum { ePropertyPacketTimeout }; +enum { +#define LLDB_PROPERTIES_processkdp +#include "PropertiesEnum.inc" +}; class PluginProperties : public Properties { public: @@ -72,7 +76,7 @@ virtual ~PluginProperties() {} uint64_t GetPacketTimeout() { - const uint32_t idx = ePropertyPacketTimeout; + const uint32_t idx = ePropertyKDPPacketTimeout; return m_collection_sp->GetPropertyAtIndexAsUInt64( NULL, idx, g_properties[idx].default_uint_value); } Index: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/Properties.td =================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/Properties.td +++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/Properties.td @@ -0,0 +1,8 @@ +include "../../../../include/lldb/Core/PropertiesBase.td" + +let Definition = "processkdp" in { + def KDPPacketTimeout: Property<"packet-timeout", "UInt64">, + Global, + DefaultUnsignedValue<5>, + Desc<"Specify the default packet timeout in seconds.">; +} Index: lldb/trunk/source/Plugins/Process/gdb-remote/CMakeLists.txt =================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/CMakeLists.txt +++ lldb/trunk/source/Plugins/Process/gdb-remote/CMakeLists.txt @@ -1,3 +1,11 @@ +lldb_tablegen(Properties.inc -gen-lldb-property-defs + SOURCE Properties.td + TARGET LLDBPluginProcessGDBRemotePropertiesGen) + +lldb_tablegen(PropertiesEnum.inc -gen-lldb-property-enum-defs + SOURCE Properties.td + TARGET LLDBPluginProcessGDBRemotePropertiesEnumGen) + if (CMAKE_SYSTEM_NAME MATCHES "Darwin") include_directories(${LIBXML2_INCLUDE_DIR}) endif() @@ -40,3 +48,7 @@ LINK_COMPONENTS Support ) + +add_dependencies(lldbPluginProcessGDBRemote + LLDBPluginProcessGDBRemotePropertiesGen + LLDBPluginProcessGDBRemotePropertiesEnumGen) Index: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -111,39 +111,13 @@ namespace { static constexpr PropertyDefinition g_properties[] = { - {"packet-timeout", - OptionValue::eTypeUInt64, - true, - 5 -#if defined(__has_feature) -#if __has_feature(address_sanitizer) - * 2 -#endif -#endif - , - nullptr, - {}, - "Specify the default packet timeout in seconds."}, - {"target-definition-file", - OptionValue::eTypeFileSpec, - true, - 0, - nullptr, - {}, - "The file that provides the description for remote target registers."}, - {"use-libraries-svr4", - OptionValue::eTypeBoolean, - true, - false, - nullptr, - {}, - "If true, the libraries-svr4 feature will be used to get a hold of the " - "process's loaded modules."}}; +#define LLDB_PROPERTIES_processgdbremote +#include "Properties.inc" +}; enum { - ePropertyPacketTimeout, - ePropertyTargetDefinitionFile, - ePropertyUseSVR4 +#define LLDB_PROPERTIES_processgdbremote +#include "PropertiesEnum.inc" }; class PluginProperties : public Properties { @@ -2469,7 +2443,7 @@ // Clear the thread stop stack m_stop_packet_stack.clear(); } - + // If we have queried for a default thread id if (m_initial_tid != LLDB_INVALID_THREAD_ID) { m_thread_list.SetSelectedThreadByID(m_initial_tid); Index: lldb/trunk/source/Plugins/Process/gdb-remote/Properties.td =================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/Properties.td +++ lldb/trunk/source/Plugins/Process/gdb-remote/Properties.td @@ -0,0 +1,16 @@ +include "../../../../include/lldb/Core/PropertiesBase.td" + +let Definition = "processgdbremote" in { + def PacketTimeout: Property<"packet-timeout", "UInt64">, + Global, + DefaultUnsignedValue<5>, + Desc<"Specify the default packet timeout in seconds.">; + def TargetDefinitionFile: Property<"target-definition-file", "FileSpec">, + Global, + DefaultStringValue<"">, + Desc<"The file that provides the description for remote target registers.">; + def UseSVR4: Property<"use-libraries-svr4", "Boolean">, + Global, + DefaultFalse, + Desc<"If true, the libraries-svr4 feature will be used to get a hold of the process's loaded modules.">; +} Index: lldb/trunk/source/Plugins/StructuredData/DarwinLog/CMakeLists.txt =================================================================== --- lldb/trunk/source/Plugins/StructuredData/DarwinLog/CMakeLists.txt +++ lldb/trunk/source/Plugins/StructuredData/DarwinLog/CMakeLists.txt @@ -1,3 +1,11 @@ +lldb_tablegen(Properties.inc -gen-lldb-property-defs + SOURCE Properties.td + TARGET LLDBPluginStructuredDataDarwinLogPropertiesGen) + +lldb_tablegen(PropertiesEnum.inc -gen-lldb-property-enum-defs + SOURCE Properties.td + TARGET LLDBPluginStructuredDataDarwinLogPropertiesEnumGen) + add_lldb_library(lldbPluginStructuredDataDarwinLog PLUGIN StructuredDataDarwinLog.cpp @@ -8,3 +16,7 @@ lldbInterpreter lldbTarget ) + +add_dependencies(lldbPluginStructuredDataDarwinLog + LLDBPluginStructuredDataDarwinLogPropertiesGen + LLDBPluginStructuredDataDarwinLogPropertiesEnumGen) Index: lldb/trunk/source/Plugins/StructuredData/DarwinLog/Properties.td =================================================================== --- lldb/trunk/source/Plugins/StructuredData/DarwinLog/Properties.td +++ lldb/trunk/source/Plugins/StructuredData/DarwinLog/Properties.td @@ -0,0 +1,12 @@ +include "../../../../include/lldb/Core/PropertiesBase.td" + +let Definition = "darwinlog" in { + def EnableOnStartup: Property<"enable-on-startup", "Boolean">, + Global, + DefaultFalse, + Desc<"Enable Darwin os_log collection when debugged process is launched or attached.">; + def AutoEnableOptions: Property<"auto-enable-options", "String">, + Global, + DefaultStringValue<"">, + Desc<"Specify the options to 'plugin structured-data darwin-log enable' that should be applied when automatically enabling logging on startup/attach.">; +} Index: lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp =================================================================== --- lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp +++ lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp @@ -105,29 +105,14 @@ /// Code to handle the StructuredDataDarwinLog settings static constexpr PropertyDefinition g_properties[] = { - { - "enable-on-startup", // name - OptionValue::eTypeBoolean, // type - true, // global - false, // default uint value - nullptr, // default cstring value - {}, // enum values - "Enable Darwin os_log collection when debugged process is launched " - "or attached." // description - }, - { - "auto-enable-options", // name - OptionValue::eTypeString, // type - true, // global - 0, // default uint value - "", // default cstring value - {}, // enum values - "Specify the options to 'plugin structured-data darwin-log enable' " - "that should be applied when automatically enabling logging on " - "startup/attach." // description - }}; +#define LLDB_PROPERTIES_darwinlog +#include "Properties.inc" +}; -enum { ePropertyEnableOnStartup = 0, ePropertyAutoEnableOptions = 1 }; +enum { +#define LLDB_PROPERTIES_darwinlog +#include "PropertiesEnum.inc" +}; class StructuredDataDarwinLogProperties : public Properties { public: Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt @@ -1,3 +1,11 @@ +lldb_tablegen(Properties.inc -gen-lldb-property-defs + SOURCE Properties.td + TARGET LLDBPluginSymbolFileDWARFPropertiesGen) + +lldb_tablegen(PropertiesEnum.inc -gen-lldb-property-enum-defs + SOURCE Properties.td + TARGET LLDBPluginSymbolFileDWARFPropertiesEnumGen) + add_lldb_library(lldbPluginSymbolFileDWARF PLUGIN AppleDWARFIndex.cpp DebugNamesDWARFIndex.cpp @@ -52,3 +60,7 @@ DebugInfoDWARF Support ) + +add_dependencies(lldbPluginSymbolFileDWARF + LLDBPluginSymbolFileDWARFPropertiesGen + LLDBPluginSymbolFileDWARFPropertiesEnumGen) Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/Properties.td =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/Properties.td +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/Properties.td @@ -0,0 +1,12 @@ +include "../../../../include/lldb/Core/PropertiesBase.td" + +let Definition = "symbolfiledwarf" in { + def SymLinkPaths: Property<"comp-dir-symlink-paths", "FileSpecList">, + Global, + DefaultStringValue<"">, + Desc<"If the DW_AT_comp_dir matches any of these paths the symbolic links will be resolved at DWARF parse time.">; + def IgnoreIndexes: Property<"ignore-file-indexes", "Boolean">, + Global, + DefaultFalse, + Desc<"Ignore indexes present in the object files and always index DWARF manually.">; +} Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -114,17 +114,13 @@ namespace { static constexpr PropertyDefinition g_properties[] = { - {"comp-dir-symlink-paths", OptionValue::eTypeFileSpecList, true, 0, nullptr, - {}, - "If the DW_AT_comp_dir matches any of these paths the symbolic " - "links will be resolved at DWARF parse time."}, - {"ignore-file-indexes", OptionValue::eTypeBoolean, true, 0, nullptr, {}, - "Ignore indexes present in the object files and always index DWARF " - "manually."}}; +#define LLDB_PROPERTIES_symbolfiledwarf +#include "Properties.inc" +}; enum { - ePropertySymLinkPaths, - ePropertyIgnoreIndexes, +#define LLDB_PROPERTIES_symbolfiledwarf +#include "PropertiesEnum.inc" }; class PluginProperties : public Properties { Index: lldb/trunk/source/Target/CMakeLists.txt =================================================================== --- lldb/trunk/source/Target/CMakeLists.txt +++ lldb/trunk/source/Target/CMakeLists.txt @@ -70,3 +70,5 @@ LINK_COMPONENTS Support ) + +add_dependencies(lldbTarget LLDBPropertiesGen LLDBPropertiesEnumGen) Index: lldb/trunk/source/Target/Platform.cpp =================================================================== --- lldb/trunk/source/Target/Platform.cpp +++ lldb/trunk/source/Target/Platform.cpp @@ -64,12 +64,14 @@ namespace { static constexpr PropertyDefinition g_properties[] = { - {"use-module-cache", OptionValue::eTypeBoolean, true, true, nullptr, - {}, "Use module cache."}, - {"module-cache-directory", OptionValue::eTypeFileSpec, true, 0, nullptr, - {}, "Root directory for cached modules."}}; +#define LLDB_PROPERTIES_platform +#include "lldb/Core/Properties.inc" +}; -enum { ePropertyUseModuleCache, ePropertyModuleCacheDirectory }; +enum { +#define LLDB_PROPERTIES_platform +#include "lldb/Core/PropertiesEnum.inc" +}; } // namespace Index: lldb/trunk/source/Target/Process.cpp =================================================================== --- lldb/trunk/source/Target/Process.cpp +++ lldb/trunk/source/Target/Process.cpp @@ -113,54 +113,13 @@ }; static constexpr PropertyDefinition g_properties[] = { - {"disable-memory-cache", OptionValue::eTypeBoolean, false, - DISABLE_MEM_CACHE_DEFAULT, nullptr, {}, - "Disable reading and caching of memory in fixed-size units."}, - {"extra-startup-command", OptionValue::eTypeArray, false, - OptionValue::eTypeString, nullptr, {}, - "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;\""}, - {"ignore-breakpoints-in-expressions", OptionValue::eTypeBoolean, true, true, - nullptr, {}, - "If true, breakpoints will be ignored during expression evaluation."}, - {"unwind-on-error-in-expressions", OptionValue::eTypeBoolean, true, true, - nullptr, {}, "If true, errors in expression evaluation will unwind " - "the stack back to the state before the call."}, - {"python-os-plugin-path", OptionValue::eTypeFileSpec, false, true, nullptr, - {}, "A path to a python OS plug-in module file that contains a " - "OperatingSystemPlugIn class."}, - {"stop-on-sharedlibrary-events", OptionValue::eTypeBoolean, true, false, - nullptr, {}, - "If true, stop when a shared library is loaded or unloaded."}, - {"detach-keeps-stopped", OptionValue::eTypeBoolean, true, false, nullptr, - {}, "If true, detach will attempt to keep the process stopped."}, - {"memory-cache-line-size", OptionValue::eTypeUInt64, false, 512, nullptr, - {}, "The memory cache line size"}, - {"optimization-warnings", OptionValue::eTypeBoolean, false, true, nullptr, - {}, "If true, warn when stopped in code that is optimized where " - "stepping and variable availability may not behave as expected."}, - {"stop-on-exec", OptionValue::eTypeBoolean, true, true, - nullptr, {}, - "If true, stop when a shared library is loaded or unloaded."}, - {"utility-expression-timeout", OptionValue::eTypeUInt64, false, 15, - nullptr, {}, - "The time in seconds to wait for LLDB-internal utility expressions."} +#define LLDB_PROPERTIES_process +#include "lldb/Core/Properties.inc" }; enum { - ePropertyDisableMemCache, - ePropertyExtraStartCommand, - ePropertyIgnoreBreakpointsInExpressions, - ePropertyUnwindOnErrorInExpressions, - ePropertyPythonOSPluginPath, - ePropertyStopOnSharedLibraryEvents, - ePropertyDetachKeepsStopped, - ePropertyMemCacheLineSize, - ePropertyWarningOptimization, - ePropertyStopOnExec, - ePropertyUtilityExpressionTimeout, +#define LLDB_PROPERTIES_process +#include "lldb/Core/PropertiesEnum.inc" }; ProcessProperties::ProcessProperties(lldb_private::Process *process) Index: lldb/trunk/source/Target/Target.cpp =================================================================== --- lldb/trunk/source/Target/Target.cpp +++ lldb/trunk/source/Target/Target.cpp @@ -3274,221 +3274,13 @@ "this setting loads sections and all symbols."} }; static constexpr PropertyDefinition g_properties[] = { - {"default-arch", OptionValue::eTypeArch, true, 0, nullptr, {}, - "Default architecture to choose, when there's a choice."}, - {"move-to-nearest-code", OptionValue::eTypeBoolean, false, true, nullptr, - {}, "Move breakpoints to nearest code."}, - {"language", OptionValue::eTypeLanguage, false, eLanguageTypeUnknown, - nullptr, {}, - "The language to use when interpreting expressions entered in commands."}, - {"expr-prefix", OptionValue::eTypeFileSpec, false, 0, nullptr, {}, - "Path to a file containing expressions to be prepended to all " - "expressions."}, - {"prefer-dynamic-value", OptionValue::eTypeEnum, false, - eDynamicDontRunTarget, nullptr, OptionEnumValues(g_dynamic_value_types), - "Should printed values be shown as their dynamic value."}, - {"enable-synthetic-value", OptionValue::eTypeBoolean, false, true, nullptr, - {}, "Should synthetic values be used by default whenever available."}, - {"skip-prologue", OptionValue::eTypeBoolean, false, true, nullptr, {}, - "Skip function prologues when setting breakpoints by name."}, - {"source-map", OptionValue::eTypePathMap, false, 0, nullptr, {}, - "Source path remappings are used to track the change of location between " - "a source file when built, and " - "where it exists on the current system. It consists of an array of " - "duples, the first element of each duple is " - "some part (starting at the root) of the path to the file when it was " - "built, " - "and the second is where the remainder of the original build hierarchy is " - "rooted on the local system. " - "Each element of the array is checked in order and the first one that " - "results in a match wins."}, - {"exec-search-paths", OptionValue::eTypeFileSpecList, false, 0, nullptr, - {}, "Executable search paths to use when locating executable files " - "whose paths don't match the local file system."}, - {"debug-file-search-paths", OptionValue::eTypeFileSpecList, false, 0, - nullptr, {}, - "List of directories to be searched when locating debug symbol files. " - "See also symbols.enable-external-lookup."}, - {"clang-module-search-paths", OptionValue::eTypeFileSpecList, false, 0, - nullptr, {}, - "List of directories to be searched when locating modules for Clang."}, - {"auto-import-clang-modules", OptionValue::eTypeBoolean, false, true, - nullptr, {}, - "Automatically load Clang modules referred to by the program."}, - {"import-std-module", OptionValue::eTypeBoolean, false, false, - nullptr, {}, - "Import the C++ std module to improve debugging STL containers."}, - {"auto-apply-fixits", OptionValue::eTypeBoolean, false, true, nullptr, - {}, "Automatically apply fix-it hints to expressions."}, - {"notify-about-fixits", OptionValue::eTypeBoolean, false, true, nullptr, - {}, "Print the fixed expression text."}, - {"save-jit-objects", OptionValue::eTypeBoolean, false, false, nullptr, - {}, "Save intermediate object files generated by the LLVM JIT"}, - {"max-children-count", OptionValue::eTypeSInt64, false, 256, nullptr, - {}, "Maximum number of children to expand in any level of depth."}, - {"max-string-summary-length", OptionValue::eTypeSInt64, false, 1024, - nullptr, {}, - "Maximum number of characters to show when using %s in summary strings."}, - {"max-memory-read-size", OptionValue::eTypeSInt64, false, 1024, nullptr, - {}, "Maximum number of bytes that 'memory read' will fetch before " - "--force must be specified."}, - {"breakpoints-use-platform-avoid-list", OptionValue::eTypeBoolean, false, - true, nullptr, {}, "Consult the platform module avoid list when " - "setting non-module specific breakpoints."}, - {"arg0", OptionValue::eTypeString, false, 0, nullptr, {}, - "The first argument passed to the program in the argument array which can " - "be different from the executable itself."}, - {"run-args", OptionValue::eTypeArgs, false, 0, nullptr, {}, - "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."}, - {"env-vars", OptionValue::eTypeDictionary, false, OptionValue::eTypeString, - nullptr, {}, "A list of all the environment variables to be passed " - "to the executable's environment, and their values."}, - {"inherit-env", OptionValue::eTypeBoolean, false, true, nullptr, {}, - "Inherit the environment from the process that is running LLDB."}, - {"input-path", OptionValue::eTypeFileSpec, false, 0, nullptr, {}, - "The file/path to be used by the executable program for reading its " - "standard input."}, - {"output-path", OptionValue::eTypeFileSpec, false, 0, nullptr, {}, - "The file/path to be used by the executable program for writing its " - "standard output."}, - {"error-path", OptionValue::eTypeFileSpec, false, 0, nullptr, {}, - "The file/path to be used by the executable program for writing its " - "standard error."}, - {"detach-on-error", OptionValue::eTypeBoolean, false, true, nullptr, - {}, "debugserver will detach (rather than killing) a process if it " - "loses connection with lldb."}, - {"preload-symbols", OptionValue::eTypeBoolean, false, true, nullptr, {}, - "Enable loading of symbol tables before they are needed."}, - {"disable-aslr", OptionValue::eTypeBoolean, false, true, nullptr, {}, - "Disable Address Space Layout Randomization (ASLR)"}, - {"disable-stdio", OptionValue::eTypeBoolean, false, false, nullptr, {}, - "Disable stdin/stdout for process (e.g. for a GUI application)"}, - {"inline-breakpoint-strategy", OptionValue::eTypeEnum, false, - eInlineBreakpointsAlways, nullptr, - OptionEnumValues(g_inline_breakpoint_enums), - "The strategy to use when settings breakpoints by file and line. " - "Breakpoint locations can end up being inlined by the compiler, so that a " - "compile unit 'a.c' might contain an inlined function from another source " - "file. " - "Usually this is limited to breakpoint locations from inlined functions " - "from header or other include files, or more accurately " - "non-implementation source files. " - "Sometimes code might #include implementation files and cause inlined " - "breakpoint locations in inlined implementation files. " - "Always checking for inlined breakpoint locations can be expensive " - "(memory and time), so if you have a project with many headers " - "and find that setting breakpoints is slow, then you can change this " - "setting to headers. " - "This setting allows you to control exactly which strategy is used when " - "setting " - "file and line breakpoints."}, - // FIXME: This is the wrong way to do per-architecture settings, but we - // don't have a general per architecture settings system in place yet. - {"x86-disassembly-flavor", OptionValue::eTypeEnum, false, - eX86DisFlavorDefault, nullptr, - OptionEnumValues(g_x86_dis_flavor_value_types), - "The default disassembly flavor to use for x86 or x86-64 targets."}, - {"use-hex-immediates", OptionValue::eTypeBoolean, false, true, nullptr, - {}, "Show immediates in disassembly as hexadecimal."}, - {"hex-immediate-style", OptionValue::eTypeEnum, false, - Disassembler::eHexStyleC, nullptr, - OptionEnumValues(g_hex_immediate_style_values), - "Which style to use for printing hexadecimal disassembly values."}, - {"use-fast-stepping", OptionValue::eTypeBoolean, false, true, nullptr, - {}, "Use a fast stepping algorithm based on running from branch to " - "branch rather than instruction single-stepping."}, - {"load-script-from-symbol-file", OptionValue::eTypeEnum, false, - eLoadScriptFromSymFileWarn, nullptr, - OptionEnumValues(g_load_script_from_sym_file_values), - "Allow LLDB to load scripting resources embedded in symbol files when " - "available."}, - {"load-cwd-lldbinit", OptionValue::eTypeEnum, false, eLoadCWDlldbinitWarn, - nullptr, OptionEnumValues(g_load_current_working_dir_lldbinit_values), - "Allow LLDB to .lldbinit files from the current directory automatically."}, - {"memory-module-load-level", OptionValue::eTypeEnum, false, - eMemoryModuleLoadLevelComplete, nullptr, - OptionEnumValues(g_memory_module_load_level_values), - "Loading modules from memory can be slow as reading the symbol tables and " - "other data can take a long time depending on your connection to the " - "debug target. " - "This setting helps users control how much information gets loaded when " - "loading modules from memory." - "'complete' is the default value for this setting which will load all " - "sections and symbols by reading them from memory (slowest, most " - "accurate). " - "'partial' will load sections and attempt to find function bounds without " - "downloading the symbol table (faster, still accurate, missing symbol " - "names). " - "'minimal' is the fastest setting and will load section data with no " - "symbols, but should rarely be used as stack frames in these memory " - "regions will be inaccurate and not provide any context (fastest). "}, - {"display-expression-in-crashlogs", OptionValue::eTypeBoolean, false, false, - nullptr, {}, "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."}, - {"trap-handler-names", OptionValue::eTypeArray, true, - OptionValue::eTypeString, nullptr, {}, - "A list of trap handler function names, e.g. a common Unix user process " - "one is _sigtramp."}, - {"display-runtime-support-values", OptionValue::eTypeBoolean, false, false, - nullptr, {}, "If true, LLDB will show variables that are meant to " - "support the operation of a language's runtime support."}, - {"display-recognized-arguments", OptionValue::eTypeBoolean, false, false, - nullptr, {}, "Show recognized arguments in variable listings by default."}, - {"non-stop-mode", OptionValue::eTypeBoolean, false, 0, nullptr, {}, - "Disable lock-step debugging, instead control threads independently."}, - {"require-hardware-breakpoint", OptionValue::eTypeBoolean, false, 0, - nullptr, {}, "Require all breakpoints to be hardware breakpoints."}}; -// clang-format on +#define LLDB_PROPERTIES_target +#include "lldb/Core/Properties.inc" +}; enum { - ePropertyDefaultArch, - ePropertyMoveToNearestCode, - ePropertyLanguage, - ePropertyExprPrefix, - ePropertyPreferDynamic, - ePropertyEnableSynthetic, - ePropertySkipPrologue, - ePropertySourceMap, - ePropertyExecutableSearchPaths, - ePropertyDebugFileSearchPaths, - ePropertyClangModuleSearchPaths, - ePropertyAutoImportClangModules, - ePropertyImportStdModule, - ePropertyAutoApplyFixIts, - ePropertyNotifyAboutFixIts, - ePropertySaveObjects, - ePropertyMaxChildrenCount, - ePropertyMaxSummaryLength, - ePropertyMaxMemReadSize, - ePropertyBreakpointUseAvoidList, - ePropertyArg0, - ePropertyRunArgs, - ePropertyEnvVars, - ePropertyInheritEnv, - ePropertyInputPath, - ePropertyOutputPath, - ePropertyErrorPath, - ePropertyDetachOnError, - ePropertyPreloadSymbols, - ePropertyDisableASLR, - ePropertyDisableSTDIO, - ePropertyInlineStrategy, - ePropertyDisassemblyFlavor, - ePropertyUseHexImmediates, - ePropertyHexImmediateStyle, - ePropertyUseFastStepping, - ePropertyLoadScriptFromSymbolFile, - ePropertyLoadCWDlldbinitFile, - ePropertyMemoryModuleLoadLevel, - ePropertyDisplayExpressionsInCrashlogs, - ePropertyTrapHandlerNames, - ePropertyDisplayRuntimeSupportValues, - ePropertyDisplayRecognizedArguments, - ePropertyNonStopModeEnabled, - ePropertyRequireHardwareBreakpoints, +#define LLDB_PROPERTIES_target +#include "lldb/Core/PropertiesEnum.inc" ePropertyExperimental, }; @@ -3565,25 +3357,14 @@ // TargetProperties static constexpr PropertyDefinition g_experimental_properties[]{ - {"inject-local-vars", - OptionValue::eTypeBoolean, - true, - true, - nullptr, - {}, - "If true, inject local variables explicitly into the expression text. " - "This will fix symbol resolution when there are name collisions between " - "ivars and local variables. " - "But it can make expressions run much more slowly."}, - {"use-modern-type-lookup", - OptionValue::eTypeBoolean, - true, - false, - nullptr, - {}, - "If true, use Clang's modern type lookup infrastructure."}}; +#define LLDB_PROPERTIES_experimental +#include "lldb/Core/Properties.inc" +}; -enum { ePropertyInjectLocalVars = 0, ePropertyUseModernTypeLookup }; +enum { +#define LLDB_PROPERTIES_experimental +#include "lldb/Core/PropertiesEnum.inc" +}; class TargetExperimentalOptionValueProperties : public OptionValueProperties { public: Index: lldb/trunk/source/Target/Thread.cpp =================================================================== --- lldb/trunk/source/Target/Thread.cpp +++ lldb/trunk/source/Target/Thread.cpp @@ -64,30 +64,13 @@ } static constexpr PropertyDefinition g_properties[] = { - {"step-in-avoid-nodebug", OptionValue::eTypeBoolean, true, true, nullptr, - {}, - "If true, step-in will not stop in functions with no debug information."}, - {"step-out-avoid-nodebug", OptionValue::eTypeBoolean, true, false, nullptr, - {}, "If true, when step-in/step-out/step-over leave the current frame, " - "they will continue to step out till they come to a function with " - "debug information. Passing a frame argument to step-out will " - "override this option."}, - {"step-avoid-regexp", OptionValue::eTypeRegex, true, 0, "^std::", {}, - "A regular expression defining functions step-in won't stop in."}, - {"step-avoid-libraries", OptionValue::eTypeFileSpecList, true, 0, nullptr, - {}, "A list of libraries that source stepping won't stop in."}, - {"trace-thread", OptionValue::eTypeBoolean, false, false, nullptr, {}, - "If true, this thread will single-step and log execution."}, - {"max-backtrace-depth", OptionValue::eTypeUInt64, false, 300000, nullptr, - {}, "Maximum number of frames to backtrace."}}; +#define LLDB_PROPERTIES_thread +#include "lldb/Core/Properties.inc" +}; enum { - ePropertyStepInAvoidsNoDebug, - ePropertyStepOutAvoidsNoDebug, - ePropertyStepAvoidRegex, - ePropertyStepAvoidLibraries, - ePropertyEnableThreadTrace, - ePropertyMaxBacktraceDepth +#define LLDB_PROPERTIES_thread +#include "lldb/Core/PropertiesEnum.inc" }; class ThreadOptionValueProperties : public OptionValueProperties { Index: lldb/trunk/utils/TableGen/CMakeLists.txt =================================================================== --- lldb/trunk/utils/TableGen/CMakeLists.txt +++ lldb/trunk/utils/TableGen/CMakeLists.txt @@ -8,6 +8,7 @@ add_tablegen(lldb-tblgen LLDB LLDBOptionDefEmitter.cpp + LLDBPropertyDefEmitter.cpp LLDBTableGen.cpp ) set_target_properties(lldb-tblgen PROPERTIES FOLDER "LLDB tablegenning") Index: lldb/trunk/utils/TableGen/LLDBPropertyDefEmitter.cpp =================================================================== --- lldb/trunk/utils/TableGen/LLDBPropertyDefEmitter.cpp +++ lldb/trunk/utils/TableGen/LLDBPropertyDefEmitter.cpp @@ -0,0 +1,173 @@ +//===- LLDBPropertyDefEmitter.cpp -----------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// These tablegen backends emits LLDB's PropertyDefinition values. +// +//===----------------------------------------------------------------------===// + +#include "LLDBTableGenBackends.h" +#include "llvm/ADT/StringExtras.h" +#include "llvm/TableGen/Record.h" +#include "llvm/TableGen/StringMatcher.h" +#include "llvm/TableGen/TableGenBackend.h" +#include +#include + +using namespace llvm; + +/// Map of properties definitions to their associated records. Also makes sure +/// our property definitions are sorted in a deterministic way. +typedef std::map> RecordsByDefinition; + +/// Groups all properties by their definition. +static RecordsByDefinition getPropertyList(std::vector Properties) { + RecordsByDefinition result; + for (Record *Property : Properties) + result[Property->getValueAsString("Definition").str()].push_back(Property); + return result; +} + +static void emitPropertyEnum(Record *Property, raw_ostream &OS) { + OS << "eProperty"; + OS << Property->getName(); + OS << ",\n"; +} + +static void emitProperty(Record *Property, raw_ostream &OS) { + OS << " {"; + + // Emit the property name. + OS << "\"" << Property->getValueAsString("Name") << "\""; + OS << ", "; + + // Emit the property type. + OS << "OptionValue::eType"; + OS << Property->getValueAsString("Type"); + OS << ", "; + + // Emit the property's global value. + OS << (Property->getValue("Global") ? "true" : "false"); + OS << ", "; + + bool hasDefaultUnsignedValue = Property->getValue("HasDefaultUnsignedValue"); + bool hasDefaultEnumValue = Property->getValue("HasDefaultEnumValue"); + bool hasDefaultStringValue = Property->getValue("HasDefaultStringValue"); + + // Guarantee that every property has a default value. + assert((hasDefaultUnsignedValue || hasDefaultEnumValue || + hasDefaultStringValue) && + "Property must have a default value"); + + // Guarantee that no property has both a default unsigned value and a default + // enum value, since they're bothed stored in the same field. + assert(!(hasDefaultUnsignedValue && hasDefaultEnumValue) && + "Property cannot have both a unsigned and enum default value."); + + // Emit the default uint value. + if (hasDefaultUnsignedValue) { + OS << std::to_string(Property->getValueAsInt("DefaultUnsignedValue")); + } else if (hasDefaultEnumValue) { + OS << Property->getValueAsString("DefaultEnumValue"); + } else { + OS << "0"; + } + OS << ", "; + + // Emit the default string value. + if (hasDefaultStringValue) { + if (auto D = Property->getValue("DefaultStringValue")) { + OS << "\""; + llvm::printEscapedString(D->getValue()->getAsUnquotedString(), OS); + OS << "\""; + } else { + OS << "\"\""; + } + } else { + OS << "nullptr"; + } + OS << ", "; + + // Emit the enum values value. + if (Property->getValue("EnumValues")) + OS << Property->getValueAsString("EnumValues"); + else + OS << "{}"; + OS << ", "; + + // Emit the property description. + if (auto D = Property->getValue("Description")) { + OS << "\""; + llvm::printEscapedString(D->getValue()->getAsUnquotedString(), OS); + OS << "\""; + } else { + OS << "\"\""; + } + + OS << "},\n"; +} + +/// Emits all property initializers to the raw_ostream. +static void emityProperties(std::string PropertyName, + std::vector PropertyRecords, + raw_ostream &OS) { + // Generate the macro that the user needs to define before including the + // *.inc file. + std::string NeededMacro = "LLDB_PROPERTIES_" + PropertyName; + std::replace(NeededMacro.begin(), NeededMacro.end(), ' ', '_'); + + // All options are in one file, so we need put them behind macros and ask the + // user to define the macro for the options that are needed. + OS << "// Property definitions for " << PropertyName << "\n"; + OS << "#ifdef " << NeededMacro << "\n"; + for (Record *R : PropertyRecords) + emitProperty(R, OS); + // We undefine the macro for the user like Clang's include files are doing it. + OS << "#undef " << NeededMacro << "\n"; + OS << "#endif // " << PropertyName << " Property\n\n"; +} + +/// Emits all property initializers to the raw_ostream. +static void emitPropertyEnum(std::string PropertyName, + std::vector PropertyRecords, + raw_ostream &OS) { + // Generate the macro that the user needs to define before including the + // *.inc file. + std::string NeededMacro = "LLDB_PROPERTIES_" + PropertyName; + std::replace(NeededMacro.begin(), NeededMacro.end(), ' ', '_'); + + // All options are in one file, so we need put them behind macros and ask the + // user to define the macro for the options that are needed. + OS << "// Property enum cases for " << PropertyName << "\n"; + OS << "#ifdef " << NeededMacro << "\n"; + for (Record *R : PropertyRecords) + emitPropertyEnum(R, OS); + // We undefine the macro for the user like Clang's include files are doing it. + OS << "#undef " << NeededMacro << "\n"; + OS << "#endif // " << PropertyName << " Property\n\n"; +} + +void lldb_private::EmitPropertyDefs(RecordKeeper &Records, raw_ostream &OS) { + emitSourceFileHeader("Property definitions for LLDB.", OS); + + std::vector Properties = + Records.getAllDerivedDefinitions("Property"); + for (auto &PropertyRecordPair : getPropertyList(Properties)) { + emityProperties(PropertyRecordPair.first, PropertyRecordPair.second, OS); + } +} + +void lldb_private::EmitPropertyEnumDefs(RecordKeeper &Records, + raw_ostream &OS) { + emitSourceFileHeader("Property definition enum for LLDB.", OS); + + std::vector Properties = + Records.getAllDerivedDefinitions("Property"); + for (auto &PropertyRecordPair : getPropertyList(Properties)) { + emitPropertyEnum(PropertyRecordPair.first, PropertyRecordPair.second, OS); + } +} Index: lldb/trunk/utils/TableGen/LLDBTableGen.cpp =================================================================== --- lldb/trunk/utils/TableGen/LLDBTableGen.cpp +++ lldb/trunk/utils/TableGen/LLDBTableGen.cpp @@ -25,16 +25,22 @@ PrintRecords, DumpJSON, GenOptionDefs, + GenPropertyDefs, + GenPropertyEnumDefs, }; -static cl::opt - Action(cl::desc("Action to perform:"), - cl::values(clEnumValN(PrintRecords, "print-records", - "Print all records to stdout (default)"), - clEnumValN(DumpJSON, "dump-json", - "Dump all records as machine-readable JSON"), - clEnumValN(GenOptionDefs, "gen-lldb-option-defs", - "Generate lldb option definitions"))); +static cl::opt Action( + cl::desc("Action to perform:"), + cl::values(clEnumValN(PrintRecords, "print-records", + "Print all records to stdout (default)"), + clEnumValN(DumpJSON, "dump-json", + "Dump all records as machine-readable JSON"), + clEnumValN(GenOptionDefs, "gen-lldb-option-defs", + "Generate lldb option definitions"), + clEnumValN(GenPropertyDefs, "gen-lldb-property-defs", + "Generate lldb property definitions"), + clEnumValN(GenPropertyEnumDefs, "gen-lldb-property-enum-defs", + "Generate lldb property enum definitions"))); static bool LLDBTableGenMain(raw_ostream &OS, RecordKeeper &Records) { switch (Action) { @@ -47,6 +53,12 @@ case GenOptionDefs: EmitOptionDefs(Records, OS); break; + case GenPropertyDefs: + EmitPropertyDefs(Records, OS); + break; + case GenPropertyEnumDefs: + EmitPropertyEnumDefs(Records, OS); + break; } return false; } Index: lldb/trunk/utils/TableGen/LLDBTableGenBackends.h =================================================================== --- lldb/trunk/utils/TableGen/LLDBTableGenBackends.h +++ lldb/trunk/utils/TableGen/LLDBTableGenBackends.h @@ -29,6 +29,8 @@ namespace lldb_private { void EmitOptionDefs(RecordKeeper &RK, raw_ostream &OS); +void EmitPropertyDefs(RecordKeeper &RK, raw_ostream &OS); +void EmitPropertyEnumDefs(RecordKeeper &RK, raw_ostream &OS); } // namespace lldb_private