Format OptionEnumValueElement (NFC)

Reformat OptionEnumValueElement to make it easier to distinguish between
its fields. This also removes the need to disable clang-format for these
arrays.

Differential revision: https://reviews.llvm.org/D65489

llvm-svn: 367638
This commit is contained in:
Jonas Devlieghere 2019-08-02 00:18:44 +00:00
parent 12961ff0fa
commit e063eccc19
11 changed files with 367 additions and 150 deletions

View File

@ -26,19 +26,26 @@
using namespace lldb;
using namespace lldb_private;
// CommandObjectBreakpointCommandAdd
// FIXME: "script-type" needs to have its contents determined dynamically, so
// somebody can add a new scripting
// language to lldb and have it pickable here without having to change this
// enumeration by hand and rebuild lldb proper.
// somebody can add a new scripting language to lldb and have it pickable here
// without having to change this enumeration by hand and rebuild lldb proper.
static constexpr OptionEnumValueElement g_script_option_enumeration[] = {
{eScriptLanguageNone, "command",
"Commands are in the lldb command interpreter language"},
{eScriptLanguagePython, "python", "Commands are in the Python language."},
{eSortOrderByName, "default-script",
"Commands are in the default scripting language."} };
{
eScriptLanguageNone,
"command",
"Commands are in the lldb command interpreter language",
},
{
eScriptLanguagePython,
"python",
"Commands are in the Python language.",
},
{
eSortOrderByName,
"default-script",
"Commands are in the default scripting language.",
},
};
static constexpr OptionEnumValues ScriptOptionEnum() {
return OptionEnumValues(g_script_option_enumeration);
@ -558,7 +565,7 @@ protected:
BreakpointIDList valid_bp_ids;
CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs(
command, target, result, &valid_bp_ids,
command, target, result, &valid_bp_ids,
BreakpointName::Permissions::PermissionKinds::listPerm);
if (result.Succeeded()) {
@ -648,7 +655,7 @@ protected:
BreakpointIDList valid_bp_ids;
CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs(
command, target, result, &valid_bp_ids,
command, target, result, &valid_bp_ids,
BreakpointName::Permissions::PermissionKinds::listPerm);
if (result.Succeeded()) {

View File

@ -1486,12 +1486,22 @@ protected:
// CommandObjectCommandsScriptAdd
static constexpr OptionEnumValueElement g_script_synchro_type[] = {
{eScriptedCommandSynchronicitySynchronous, "synchronous",
"Run synchronous"},
{eScriptedCommandSynchronicityAsynchronous, "asynchronous",
"Run asynchronous"},
{eScriptedCommandSynchronicityCurrentValue, "current",
"Do not alter current setting"} };
{
eScriptedCommandSynchronicitySynchronous,
"synchronous",
"Run synchronous",
},
{
eScriptedCommandSynchronicityAsynchronous,
"asynchronous",
"Run asynchronous",
},
{
eScriptedCommandSynchronicityCurrentValue,
"current",
"Do not alter current setting",
},
};
static constexpr OptionEnumValues ScriptSynchroType() {
return OptionEnumValues(g_script_synchro_type);

View File

@ -38,10 +38,17 @@ CommandObjectExpression::CommandOptions::CommandOptions() : OptionGroup() {}
CommandObjectExpression::CommandOptions::~CommandOptions() = default;
static constexpr OptionEnumValueElement g_description_verbosity_type[] = {
{eLanguageRuntimeDescriptionDisplayVerbosityCompact, "compact",
"Only show the description string"},
{eLanguageRuntimeDescriptionDisplayVerbosityFull, "full",
"Show the full output, including persistent variable's name and type"} };
{
eLanguageRuntimeDescriptionDisplayVerbosityCompact,
"compact",
"Only show the description string",
},
{
eLanguageRuntimeDescriptionDisplayVerbosityFull,
"full",
"Show the full output, including persistent variable's name and type",
},
};
static constexpr OptionEnumValues DescriptionVerbosityTypes() {
return OptionEnumValues(g_description_verbosity_type);

View File

@ -135,14 +135,24 @@ static uint32_t DumpTargetList(TargetList &target_list,
}
// Note that the negation in the argument name causes a slightly confusing
// mapping of the enum values,
// mapping of the enum values.
static constexpr OptionEnumValueElement g_dependents_enumaration[] = {
{eLoadDependentsDefault, "default",
"Only load dependents when the target is an executable."},
{eLoadDependentsNo, "true",
"Don't load dependents, even if the target is an executable."},
{eLoadDependentsYes, "false",
"Load dependents, even if the target is not an executable."}};
{
eLoadDependentsDefault,
"default",
"Only load dependents when the target is an executable.",
},
{
eLoadDependentsNo,
"true",
"Don't load dependents, even if the target is an executable.",
},
{
eLoadDependentsYes,
"false",
"Load dependents, even if the target is not an executable.",
},
};
#define LLDB_OPTIONS_target_dependents
#include "CommandOptions.inc"
@ -1959,10 +1969,22 @@ protected:
#pragma mark CommandObjectTargetModulesDumpSymtab
static constexpr OptionEnumValueElement g_sort_option_enumeration[] = {
{eSortOrderNone, "none",
"No sorting, use the original symbol table order."},
{eSortOrderByAddress, "address", "Sort output by symbol address."},
{eSortOrderByName, "name", "Sort output by symbol name."} };
{
eSortOrderNone,
"none",
"No sorting, use the original symbol table order.",
},
{
eSortOrderByAddress,
"address",
"Sort output by symbol address.",
},
{
eSortOrderByName,
"name",
"Sort output by symbol name.",
},
};
#define LLDB_OPTIONS_target_modules_dump_symtab
#include "CommandOptions.inc"

View File

@ -24,19 +24,26 @@
using namespace lldb;
using namespace lldb_private;
// CommandObjectWatchpointCommandAdd
// FIXME: "script-type" needs to have its contents determined dynamically, so
// somebody can add a new scripting
// language to lldb and have it pickable here without having to change this
// enumeration by hand and rebuild lldb proper.
// somebody can add a new scripting language to lldb and have it pickable here
// without having to change this enumeration by hand and rebuild lldb proper.
static constexpr OptionEnumValueElement g_script_option_enumeration[] = {
{eScriptLanguageNone, "command",
"Commands are in the lldb command interpreter language"},
{eScriptLanguagePython, "python", "Commands are in the Python language."},
{eSortOrderByName, "default-script",
"Commands are in the default scripting language."} };
{
eScriptLanguageNone,
"command",
"Commands are in the lldb command interpreter language",
},
{
eScriptLanguagePython,
"python",
"Commands are in the Python language.",
},
{
eSortOrderByName,
"default-script",
"Commands are in the default scripting language.",
},
};
static constexpr OptionEnumValues ScriptOptionEnum() {
return OptionEnumValues(g_script_option_enumeration);

View File

@ -93,22 +93,47 @@ static DebuggerList *g_debugger_list_ptr =
nullptr; // NOTE: intentional leak to avoid issues with C++ destructor chain
static constexpr OptionEnumValueElement g_show_disassembly_enum_values[] = {
{Debugger::eStopDisassemblyTypeNever, "never",
"Never show disassembly when displaying a stop context."},
{Debugger::eStopDisassemblyTypeNoDebugInfo, "no-debuginfo",
"Show disassembly when there is no debug information."},
{Debugger::eStopDisassemblyTypeNoSource, "no-source",
"Show disassembly when there is no source information, or the source file "
"is missing when displaying a stop context."},
{Debugger::eStopDisassemblyTypeAlways, "always",
"Always show disassembly when displaying a stop context."} };
{
Debugger::eStopDisassemblyTypeNever,
"never",
"Never show disassembly when displaying a stop context.",
},
{
Debugger::eStopDisassemblyTypeNoDebugInfo,
"no-debuginfo",
"Show disassembly when there is no debug information.",
},
{
Debugger::eStopDisassemblyTypeNoSource,
"no-source",
"Show disassembly when there is no source information, or the source "
"file "
"is missing when displaying a stop context.",
},
{
Debugger::eStopDisassemblyTypeAlways,
"always",
"Always show disassembly when displaying a stop context.",
},
};
static constexpr OptionEnumValueElement g_language_enumerators[] = {
{eScriptLanguageNone, "none", "Disable scripting languages."},
{eScriptLanguagePython, "python",
"Select python as the default scripting language."},
{eScriptLanguageDefault, "default",
"Select the lldb default as the default scripting language."} };
{
eScriptLanguageNone,
"none",
"Disable scripting languages.",
},
{
eScriptLanguagePython,
"python",
"Select python as the default scripting language.",
},
{
eScriptLanguageDefault,
"default",
"Select the lldb default as the default scripting language.",
},
};
#define MODULE_WITH_FUNC \
"{ " \
@ -189,18 +214,32 @@ static constexpr OptionEnumValueElement g_language_enumerators[] = {
// without-args}}:\n}{${current-pc-arrow} }{${addr-file-or-load}}:
static constexpr OptionEnumValueElement s_stop_show_column_values[] = {
{eStopShowColumnAnsiOrCaret, "ansi-or-caret",
"Highlight the stop column with ANSI terminal codes when color/ANSI mode "
"is enabled; otherwise, fall back to using a text-only caret (^) as if "
"\"caret-only\" mode was selected."},
{eStopShowColumnAnsi, "ansi", "Highlight the stop column with ANSI "
"terminal codes when running LLDB with "
"color/ANSI enabled."},
{eStopShowColumnCaret, "caret",
"Highlight the stop column with a caret character (^) underneath the stop "
"column. This method introduces a new line in source listings that "
"display thread stop locations."},
{eStopShowColumnNone, "none", "Do not highlight the stop column."}};
{
eStopShowColumnAnsiOrCaret,
"ansi-or-caret",
"Highlight the stop column with ANSI terminal codes when color/ANSI "
"mode is enabled; otherwise, fall back to using a text-only caret (^) "
"as if \"caret-only\" mode was selected.",
},
{
eStopShowColumnAnsi,
"ansi",
"Highlight the stop column with ANSI terminal codes when running LLDB "
"with color/ANSI enabled.",
},
{
eStopShowColumnCaret,
"caret",
"Highlight the stop column with a caret character (^) underneath the "
"stop column. This method introduces a new line in source listings "
"that display thread stop locations.",
},
{
eStopShowColumnNone,
"none",
"Do not highlight the stop column.",
},
};
#define LLDB_PROPERTIES_debugger
#include "CoreProperties.inc"
@ -216,7 +255,8 @@ Status Debugger::SetPropertyValue(const ExecutionContext *exe_ctx,
VarSetOperationType op,
llvm::StringRef property_path,
llvm::StringRef value) {
bool is_load_script = (property_path == "target.load-script-from-symbol-file");
bool is_load_script =
(property_path == "target.load-script-from-symbol-file");
bool is_escape_non_printables = (property_path == "escape-non-printables");
TargetSP target_sp;
LoadScriptFromSymFile load_script_old_value;
@ -609,8 +649,7 @@ void Debugger::Destroy(DebuggerSP &debugger_sp) {
}
}
DebuggerSP
Debugger::FindDebuggerWithInstanceName(ConstString instance_name) {
DebuggerSP Debugger::FindDebuggerWithInstanceName(ConstString instance_name) {
DebuggerSP debugger_sp;
if (g_debugger_list_ptr && g_debugger_list_mutex_ptr) {
std::lock_guard<std::recursive_mutex> guard(*g_debugger_list_mutex_ptr);
@ -1487,8 +1526,9 @@ bool Debugger::StartEventHandlerThread() {
eBroadcastBitEventThreadIsListening);
auto thread_name =
full_name.GetLength() < llvm::get_max_thread_name_length() ?
full_name.AsCString() : "dbg.evt-handler";
full_name.GetLength() < llvm::get_max_thread_name_length()
? full_name.AsCString()
: "dbg.evt-handler";
// Use larger 8MB stack for this thread
llvm::Expected<HostThread> event_handler_thread =

View File

@ -16,16 +16,45 @@ using namespace lldb;
using namespace lldb_private;
static constexpr OptionEnumValueElement g_watch_type[] = {
{OptionGroupWatchpoint::eWatchRead, "read", "Watch for read"},
{OptionGroupWatchpoint::eWatchWrite, "write", "Watch for write"},
{OptionGroupWatchpoint::eWatchReadWrite, "read_write",
"Watch for read/write"} };
{
OptionGroupWatchpoint::eWatchRead,
"read",
"Watch for read",
},
{
OptionGroupWatchpoint::eWatchWrite,
"write",
"Watch for write",
},
{
OptionGroupWatchpoint::eWatchReadWrite,
"read_write",
"Watch for read/write",
},
};
static constexpr OptionEnumValueElement g_watch_size[] = {
{1, "1", "Watch for byte size of 1"},
{2, "2", "Watch for byte size of 2"},
{4, "4", "Watch for byte size of 4"},
{8, "8", "Watch for byte size of 8"} };
{
1,
"1",
"Watch for byte size of 1",
},
{
2,
"2",
"Watch for byte size of 2",
},
{
4,
"4",
"Watch for byte size of 4",
},
{
8,
"8",
"Watch for byte size of 8",
},
};
static constexpr OptionDefinition g_option_table[] = {
{LLDB_OPT_SET_1, false, "watch", 'w', OptionParser::eRequiredArgument,

View File

@ -31,8 +31,8 @@
#include "DynamicLoaderDarwinKernel.h"
#include <memory>
#include <algorithm>
#include <memory>
//#define ENABLE_DEBUG_PRINTF // COMMENT THIS LINE OUT PRIOR TO CHECKIN
#ifdef ENABLE_DEBUG_PRINTF
@ -61,16 +61,30 @@ enum KASLRScanType {
};
static constexpr OptionEnumValueElement g_kaslr_kernel_scan_enum_values[] = {
{eKASLRScanNone, "none",
"Do not read memory looking for a Darwin kernel when attaching."},
{eKASLRScanLowgloAddresses, "basic", "Check for the Darwin kernel's load "
"addr in the lowglo page "
"(boot-args=debug) only."},
{eKASLRScanNearPC, "fast-scan", "Scan near the pc value on attach to find "
"the Darwin kernel's load address."},
{eKASLRScanExhaustiveScan, "exhaustive-scan",
"Scan through the entire potential address range of Darwin kernel (only "
"on 32-bit targets)."}};
{
eKASLRScanNone,
"none",
"Do not read memory looking for a Darwin kernel when attaching.",
},
{
eKASLRScanLowgloAddresses,
"basic",
"Check for the Darwin kernel's load addr in the lowglo page "
"(boot-args=debug) only.",
},
{
eKASLRScanNearPC,
"fast-scan",
"Scan near the pc value on attach to find the Darwin kernel's load "
"address.",
},
{
eKASLRScanExhaustiveScan,
"exhaustive-scan",
"Scan through the entire potential address range of Darwin kernel "
"(only on 32-bit targets).",
},
};
#define LLDB_PROPERTIES_dynamicloaderdarwinkernel
#include "DynamicLoaderDarwinKernelProperties.inc"

View File

@ -57,12 +57,24 @@ enum EnableJITLoaderGDB {
eEnableJITLoaderGDBOff,
};
static constexpr OptionEnumValueElement g_enable_jit_loader_gdb_enumerators[] = {
{eEnableJITLoaderGDBDefault, "default", "Enable JIT compilation interface "
"for all platforms except macOS"},
{eEnableJITLoaderGDBOn, "on", "Enable JIT compilation interface"},
{eEnableJITLoaderGDBOff, "off", "Disable JIT compilation interface"}
};
static constexpr OptionEnumValueElement g_enable_jit_loader_gdb_enumerators[] =
{
{
eEnableJITLoaderGDBDefault,
"default",
"Enable JIT compilation interface for all platforms except macOS",
},
{
eEnableJITLoaderGDBOn,
"on",
"Enable JIT compilation interface",
},
{
eEnableJITLoaderGDBOff,
"off",
"Disable JIT compilation interface",
},
};
#define LLDB_PROPERTIES_jitloadergdb
#include "JITLoaderGDBProperties.inc"

View File

@ -3231,33 +3231,51 @@ void Target::StopHook::GetDescription(Stream *s,
s->SetIndentLevel(indent_level);
}
// class TargetProperties
// clang-format off
static constexpr OptionEnumValueElement g_dynamic_value_types[] = {
{eNoDynamicValues, "no-dynamic-values",
"Don't calculate the dynamic type of values"},
{eDynamicCanRunTarget, "run-target", "Calculate the dynamic type of values "
"even if you have to run the target."},
{eDynamicDontRunTarget, "no-run-target",
"Calculate the dynamic type of values, but don't run the target."} };
{
eNoDynamicValues,
"no-dynamic-values",
"Don't calculate the dynamic type of values",
},
{
eDynamicCanRunTarget,
"run-target",
"Calculate the dynamic type of values "
"even if you have to run the target.",
},
{
eDynamicDontRunTarget,
"no-run-target",
"Calculate the dynamic type of values, but don't run the target.",
},
};
OptionEnumValues lldb_private::GetDynamicValueTypes() {
return OptionEnumValues(g_dynamic_value_types);
}
static constexpr OptionEnumValueElement g_inline_breakpoint_enums[] = {
{eInlineBreakpointsNever, "never", "Never look for inline breakpoint "
"locations (fastest). This setting "
"should only be used if you know that "
"no inlining occurs in your programs."},
{eInlineBreakpointsHeaders, "headers",
"Only check for inline breakpoint locations when setting breakpoints in "
"header files, but not when setting breakpoint in implementation source "
"files (default)."},
{eInlineBreakpointsAlways, "always",
"Always look for inline breakpoint locations when setting file and line "
"breakpoints (slower but most accurate)."} };
{
eInlineBreakpointsNever,
"never",
"Never look for inline breakpoint locations (fastest). This setting "
"should only be used if you know that no inlining occurs in your"
"programs.",
},
{
eInlineBreakpointsHeaders,
"headers",
"Only check for inline breakpoint locations when setting breakpoints "
"in header files, but not when setting breakpoint in implementation "
"source files (default).",
},
{
eInlineBreakpointsAlways,
"always",
"Always look for inline breakpoint locations when setting file and "
"line breakpoints (slower but most accurate).",
},
};
enum x86DisassemblyFlavor {
eX86DisFlavorDefault,
@ -3266,41 +3284,92 @@ enum x86DisassemblyFlavor {
};
static constexpr OptionEnumValueElement g_x86_dis_flavor_value_types[] = {
{eX86DisFlavorDefault, "default", "Disassembler default (currently att)."},
{eX86DisFlavorIntel, "intel", "Intel disassembler flavor."},
{eX86DisFlavorATT, "att", "AT&T disassembler flavor."} };
{
eX86DisFlavorDefault,
"default",
"Disassembler default (currently att).",
},
{
eX86DisFlavorIntel,
"intel",
"Intel disassembler flavor.",
},
{
eX86DisFlavorATT,
"att",
"AT&T disassembler flavor.",
},
};
static constexpr OptionEnumValueElement g_hex_immediate_style_values[] = {
{Disassembler::eHexStyleC, "c", "C-style (0xffff)."},
{Disassembler::eHexStyleAsm, "asm", "Asm-style (0ffffh)."} };
{
Disassembler::eHexStyleC,
"c",
"C-style (0xffff).",
},
{
Disassembler::eHexStyleAsm,
"asm",
"Asm-style (0ffffh).",
},
};
static constexpr OptionEnumValueElement g_load_script_from_sym_file_values[] = {
{eLoadScriptFromSymFileTrue, "true",
"Load debug scripts inside symbol files"},
{eLoadScriptFromSymFileFalse, "false",
"Do not load debug scripts inside symbol files."},
{eLoadScriptFromSymFileWarn, "warn",
"Warn about debug scripts inside symbol files but do not load them."} };
{
eLoadScriptFromSymFileTrue,
"true",
"Load debug scripts inside symbol files",
},
{
eLoadScriptFromSymFileFalse,
"false",
"Do not load debug scripts inside symbol files.",
},
{
eLoadScriptFromSymFileWarn,
"warn",
"Warn about debug scripts inside symbol files but do not load them.",
},
};
static constexpr
OptionEnumValueElement g_load_current_working_dir_lldbinit_values[] = {
{eLoadCWDlldbinitTrue, "true",
"Load .lldbinit files from current directory"},
{eLoadCWDlldbinitFalse, "false",
"Do not load .lldbinit files from current directory"},
{eLoadCWDlldbinitWarn, "warn",
"Warn about loading .lldbinit files from current directory"} };
static constexpr OptionEnumValueElement g_load_cwd_lldbinit_values[] = {
{
eLoadCWDlldbinitTrue,
"true",
"Load .lldbinit files from current directory",
},
{
eLoadCWDlldbinitFalse,
"false",
"Do not load .lldbinit files from current directory",
},
{
eLoadCWDlldbinitWarn,
"warn",
"Warn about loading .lldbinit files from current directory",
},
};
static constexpr OptionEnumValueElement g_memory_module_load_level_values[] = {
{eMemoryModuleLoadLevelMinimal, "minimal",
"Load minimal information when loading modules from memory. Currently "
"this setting loads sections only."},
{eMemoryModuleLoadLevelPartial, "partial",
"Load partial information when loading modules from memory. Currently "
"this setting loads sections and function bounds."},
{eMemoryModuleLoadLevelComplete, "complete",
"Load complete information when loading modules from memory. Currently "
"this setting loads sections and all symbols."} };
{
eMemoryModuleLoadLevelMinimal,
"minimal",
"Load minimal information when loading modules from memory. Currently "
"this setting loads sections only.",
},
{
eMemoryModuleLoadLevelPartial,
"partial",
"Load partial information when loading modules from memory. Currently "
"this setting loads sections and function bounds.",
},
{
eMemoryModuleLoadLevelComplete,
"complete",
"Load complete information when loading modules from memory. Currently "
"this setting loads sections and all symbols.",
},
};
#define LLDB_PROPERTIES_target
#include "TargetProperties.inc"

View File

@ -129,7 +129,7 @@ let Definition = "target" in {
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)">,
EnumValues<"OptionEnumValues(g_load_cwd_lldbinit_values)">,
Desc<"Allow LLDB to .lldbinit files from the current directory automatically.">;
def MemoryModuleLoadLevel: Property<"memory-module-load-level", "Enum">,
DefaultEnumValue<"eMemoryModuleLoadLevelComplete">,