11 changes: 11 additions & 0 deletions lldb/source/Plugins/JITLoader/GDB/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -12,3 +20,6 @@ add_lldb_library(lldbPluginJITLoaderGDB PLUGIN
Support
)

add_dependencies(lldbPluginJITLoaderGDB
LLDBPluginJITLoaderGDBPropertiesGen
LLDBPluginJITLoaderGDBPropertiesEnumGen)
14 changes: 8 additions & 6 deletions lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,15 @@ static constexpr OptionEnumValueElement g_enable_jit_loader_gdb_enumerators[] =
};

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:
Expand Down
9 changes: 9 additions & 0 deletions lldb/source/Plugins/JITLoader/GDB/Properties.td
Original file line number Diff line number Diff line change
@@ -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)">;
}
14 changes: 13 additions & 1 deletion lldb/source/Plugins/Platform/MacOSX/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -29,7 +37,7 @@ endif()

add_lldb_library(lldbPluginPlatformMacOSX PLUGIN
${PLUGIN_PLATFORM_MACOSX_SOURCES}

LINK_LIBS
clangBasic
lldbBreakpoint
Expand All @@ -44,3 +52,7 @@ add_lldb_library(lldbPluginPlatformMacOSX PLUGIN
LINK_COMPONENTS
Support
)

add_dependencies(lldbPluginPlatformMacOSX
LLDBPluginPlatformMacOSXPropertiesGen
LLDBPluginPlatformMacOSXPropertiesEnumGen)
16 changes: 8 additions & 8 deletions lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,14 @@ const char *PlatformDarwinKernel::GetDescriptionStatic() {
/// 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."}};

enum { ePropertySearchForKexts = 0, ePropertyKextDirectories };
#define LLDB_PROPERTIES_platformdarwinkernel
#include "Properties.inc"
};

enum {
#define LLDB_PROPERTIES_platformdarwinkernel
#include "PropertiesEnum.inc"
};

class PlatformDarwinKernelProperties : public Properties {
public:
Expand Down
11 changes: 11 additions & 0 deletions lldb/source/Plugins/Platform/MacOSX/Properties.td
Original file line number Diff line number Diff line change
@@ -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.">;
}
12 changes: 12 additions & 0 deletions lldb/source/Plugins/Process/MacOSX-Kernel/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -20,3 +28,7 @@ add_lldb_library(lldbPluginProcessMacOSXKernel PLUGIN
lldbPluginDynamicLoaderStatic
lldbPluginProcessUtility
)

add_dependencies(lldbPluginProcessMacOSXKernel
LLDBPluginProcessMacOSXKernelPropertiesGen
LLDBPluginProcessMacOSXKernelPropertiesEnumGen)
12 changes: 8 additions & 4 deletions lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,14 @@ using namespace lldb_private;
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:
Expand All @@ -72,7 +76,7 @@ class PluginProperties : public Properties {
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);
}
Expand Down
8 changes: 8 additions & 0 deletions lldb/source/Plugins/Process/MacOSX-Kernel/Properties.td
Original file line number Diff line number Diff line change
@@ -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.">;
}
12 changes: 12 additions & 0 deletions lldb/source/Plugins/Process/gdb-remote/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()
Expand Down Expand Up @@ -40,3 +48,7 @@ add_lldb_library(lldbPluginProcessGDBRemote PLUGIN
LINK_COMPONENTS
Support
)

add_dependencies(lldbPluginProcessGDBRemote
LLDBPluginProcessGDBRemotePropertiesGen
LLDBPluginProcessGDBRemotePropertiesEnumGen)
38 changes: 6 additions & 32 deletions lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,39 +111,13 @@ void DumpProcessGDBRemotePacketHistory(void *p, const char *path) {
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 {
Expand Down Expand Up @@ -2469,7 +2443,7 @@ void ProcessGDBRemote::RefreshStateAfterStop() {
// 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);
Expand Down
16 changes: 16 additions & 0 deletions lldb/source/Plugins/Process/gdb-remote/Properties.td
Original file line number Diff line number Diff line change
@@ -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.">;
}
12 changes: 12 additions & 0 deletions lldb/source/Plugins/StructuredData/DarwinLog/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -8,3 +16,7 @@ add_lldb_library(lldbPluginStructuredDataDarwinLog PLUGIN
lldbInterpreter
lldbTarget
)

add_dependencies(lldbPluginStructuredDataDarwinLog
LLDBPluginStructuredDataDarwinLogPropertiesGen
LLDBPluginStructuredDataDarwinLogPropertiesEnumGen)
12 changes: 12 additions & 0 deletions lldb/source/Plugins/StructuredData/DarwinLog/Properties.td
Original file line number Diff line number Diff line change
@@ -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.">;
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,29 +105,14 @@ void SetGlobalEnableOptions(const DebuggerSP &debugger_sp,
/// 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
}};

enum { ePropertyEnableOnStartup = 0, ePropertyAutoEnableOptions = 1 };
#define LLDB_PROPERTIES_darwinlog
#include "Properties.inc"
};

enum {
#define LLDB_PROPERTIES_darwinlog
#include "PropertiesEnum.inc"
};

class StructuredDataDarwinLogProperties : public Properties {
public:
Expand Down
12 changes: 12 additions & 0 deletions lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -52,3 +60,7 @@ add_lldb_library(lldbPluginSymbolFileDWARF PLUGIN
DebugInfoDWARF
Support
)

add_dependencies(lldbPluginSymbolFileDWARF
LLDBPluginSymbolFileDWARFPropertiesGen
LLDBPluginSymbolFileDWARFPropertiesEnumGen)
12 changes: 12 additions & 0 deletions lldb/source/Plugins/SymbolFile/DWARF/Properties.td
Original file line number Diff line number Diff line change
@@ -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.">;
}
14 changes: 5 additions & 9 deletions lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,13 @@ using namespace lldb_private;
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 {
Expand Down
2 changes: 2 additions & 0 deletions lldb/source/Target/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,5 @@ add_lldb_library(lldbTarget
LINK_COMPONENTS
Support
)

add_dependencies(lldbTarget LLDBPropertiesGen LLDBPropertiesEnumGen)
12 changes: 7 additions & 5 deletions lldb/source/Target/Platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,14 @@ const char *Platform::GetHostPlatformName() { return "host"; }
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

Expand Down
49 changes: 4 additions & 45 deletions lldb/source/Target/Process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,54 +113,13 @@ class ProcessOptionValueProperties : public OptionValueProperties {
};

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)
Expand Down
245 changes: 13 additions & 232 deletions lldb/source/Target/Target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3274,221 +3274,13 @@ static constexpr OptionEnumValueElement g_memory_module_load_level_values[] = {
"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,
};

Expand Down Expand Up @@ -3565,25 +3357,14 @@ class TargetOptionValueProperties : public OptionValueProperties {

// 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."}};

enum { ePropertyInjectLocalVars = 0, ePropertyUseModernTypeLookup };
#define LLDB_PROPERTIES_experimental
#include "lldb/Core/Properties.inc"
};

enum {
#define LLDB_PROPERTIES_experimental
#include "lldb/Core/PropertiesEnum.inc"
};

class TargetExperimentalOptionValueProperties : public OptionValueProperties {
public:
Expand Down
27 changes: 5 additions & 22 deletions lldb/source/Target/Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,30 +64,13 @@ const ThreadPropertiesSP &Thread::GetGlobalProperties() {
}

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 {
Expand Down
1 change: 1 addition & 0 deletions lldb/utils/TableGen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ else()

add_tablegen(lldb-tblgen LLDB
LLDBOptionDefEmitter.cpp
LLDBPropertyDefEmitter.cpp
LLDBTableGen.cpp
)
set_target_properties(lldb-tblgen PROPERTIES FOLDER "LLDB tablegenning")
Expand Down
173 changes: 173 additions & 0 deletions lldb/utils/TableGen/LLDBPropertyDefEmitter.cpp
Original file line number Diff line number Diff line change
@@ -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 <map>
#include <vector>

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<std::string, std::vector<Record *>> RecordsByDefinition;

/// Groups all properties by their definition.
static RecordsByDefinition getPropertyList(std::vector<Record *> 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<Record *> 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<Record *> 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<Record *> 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<Record *> Properties =
Records.getAllDerivedDefinitions("Property");
for (auto &PropertyRecordPair : getPropertyList(Properties)) {
emitPropertyEnum(PropertyRecordPair.first, PropertyRecordPair.second, OS);
}
}
28 changes: 20 additions & 8 deletions lldb/utils/TableGen/LLDBTableGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,22 @@ enum ActionType {
PrintRecords,
DumpJSON,
GenOptionDefs,
GenPropertyDefs,
GenPropertyEnumDefs,
};

static cl::opt<ActionType>
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<ActionType> 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) {
Expand All @@ -47,6 +53,12 @@ static bool LLDBTableGenMain(raw_ostream &OS, RecordKeeper &Records) {
case GenOptionDefs:
EmitOptionDefs(Records, OS);
break;
case GenPropertyDefs:
EmitPropertyDefs(Records, OS);
break;
case GenPropertyEnumDefs:
EmitPropertyEnumDefs(Records, OS);
break;
}
return false;
}
Expand Down
2 changes: 2 additions & 0 deletions lldb/utils/TableGen/LLDBTableGenBackends.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ using llvm::RecordKeeper;
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

Expand Down