Skip to content

Commit ec67e73

Browse files
committed
[lldb] Tablegenify expr/frame/log/register/memory
llvm-svn: 367009
1 parent 88ed70e commit ec67e73

6 files changed

+161
-70
lines changed

lldb/source/Commands/CommandObjectExpression.cpp

+2-17
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,8 @@ static constexpr OptionEnumValues DescriptionVerbosityTypes() {
4848
}
4949

5050
static constexpr OptionDefinition g_expression_options[] = {
51-
// clang-format off
52-
{LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "all-threads", 'a', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "Should we run all threads if the execution doesn't complete on one thread."},
53-
{LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "ignore-breakpoints", 'i', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "Ignore breakpoint hits while running expressions"},
54-
{LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "timeout", 't', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeUnsignedInteger, "Timeout value (in microseconds) for running the expression."},
55-
{LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "unwind-on-error", 'u', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "Clean up program state if the expression causes a crash, or raises a signal. "
56-
"Note, unlike gdb hitting a breakpoint is controlled by another option (-i)."},
57-
{LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "debug", 'g', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "When specified, debug the JIT code by setting a breakpoint on the first instruction "
58-
"and forcing breakpoints to not be ignored (-i0) and no unwinding to happen on error (-u0)."},
59-
{LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "language", 'l', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeLanguage, "Specifies the Language to use when parsing the expression. If not set the target.language "
60-
"setting is used." },
61-
{LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "apply-fixits", 'X', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeLanguage, "If true, simple fix-it hints will be automatically applied to the expression." },
62-
{LLDB_OPT_SET_1, false, "description-verbosity", 'v', OptionParser::eOptionalArgument, nullptr, DescriptionVerbosityTypes(), 0, eArgTypeDescriptionVerbosity, "How verbose should the output of this expression be, if the object description is asked for."},
63-
{LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "top-level", 'p', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Interpret the expression as a complete translation unit, without injecting it into the local "
64-
"context. Allows declaration of persistent, top-level entities without a $ prefix."},
65-
{LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "allow-jit", 'j', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "Controls whether the expression can fall back to being JITted if it's not supported by "
66-
"the interpreter (defaults to true)."}
67-
// clang-format on
51+
#define LLDB_OPTIONS_expression
52+
#include "CommandOptions.inc"
6853
};
6954

7055
Status CommandObjectExpression::CommandOptions::SetOptionValue(

lldb/source/Commands/CommandObjectFrame.cpp

+6-14
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,8 @@ using namespace lldb_private;
5454
// CommandObjectFrameDiagnose
5555

5656
static constexpr OptionDefinition g_frame_diag_options[] = {
57-
// clang-format off
58-
{ LLDB_OPT_SET_1, false, "register", 'r', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeRegisterName, "A register to diagnose." },
59-
{ LLDB_OPT_SET_1, false, "address", 'a', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeAddress, "An address to diagnose." },
60-
{ LLDB_OPT_SET_1, false, "offset", 'o', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeOffset, "An optional offset. Requires --register." }
61-
// clang-format on
57+
#define LLDB_OPTIONS_frame_diag
58+
#include "CommandOptions.inc"
6259
};
6360

6461
class CommandObjectFrameDiagnose : public CommandObjectParsed {
@@ -238,9 +235,8 @@ class CommandObjectFrameInfo : public CommandObjectParsed {
238235
// CommandObjectFrameSelect
239236

240237
static OptionDefinition g_frame_select_options[] = {
241-
// clang-format off
242-
{ LLDB_OPT_SET_1, false, "relative", 'r', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeOffset, "A relative frame index offset from the current frame index." },
243-
// clang-format on
238+
#define LLDB_OPTIONS_frame_select
239+
#include "CommandOptions.inc"
244240
};
245241

246242
class CommandObjectFrameSelect : public CommandObjectParsed {
@@ -744,12 +740,8 @@ class CommandObjectFrameVariable : public CommandObjectParsed {
744740
#pragma mark CommandObjectFrameRecognizer
745741

746742
static OptionDefinition g_frame_recognizer_add_options[] = {
747-
// clang-format off
748-
{ LLDB_OPT_SET_ALL, false, "shlib", 's', OptionParser::eRequiredArgument, nullptr, {}, CommandCompletions::eModuleCompletion, eArgTypeShlibName, "Name of the module or shared library that this recognizer applies to." },
749-
{ LLDB_OPT_SET_ALL, false, "function", 'n', OptionParser::eRequiredArgument, nullptr, {}, CommandCompletions::eSymbolCompletion, eArgTypeName, "Name of the function that this recognizer applies to." },
750-
{ LLDB_OPT_SET_2, false, "python-class", 'l', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypePythonClass, "Give the name of a Python class to use for this frame recognizer." },
751-
{ LLDB_OPT_SET_ALL, false, "regex", 'x', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Function name and module name are actually regular expressions." }
752-
// clang-format on
743+
#define LLDB_OPTIONS_frame_recognizer_add
744+
#include "CommandOptions.inc"
753745
};
754746

755747
class CommandObjectFrameRecognizerAdd : public CommandObjectParsed {

lldb/source/Commands/CommandObjectLog.cpp

+2-12
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,8 @@ using namespace lldb;
3232
using namespace lldb_private;
3333

3434
static constexpr OptionDefinition g_log_options[] = {
35-
// clang-format off
36-
{ LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeFilename, "Set the destination file to log to." },
37-
{ LLDB_OPT_SET_1, false, "threadsafe", 't', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Enable thread safe logging to avoid interweaved log lines." },
38-
{ LLDB_OPT_SET_1, false, "verbose", 'v', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Enable verbose logging." },
39-
{ LLDB_OPT_SET_1, false, "sequence", 's', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Prepend all log lines with an increasing integer sequence id." },
40-
{ LLDB_OPT_SET_1, false, "timestamp", 'T', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Prepend all log lines with a timestamp." },
41-
{ LLDB_OPT_SET_1, false, "pid-tid", 'p', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Prepend all log lines with the process and thread ID that generates the log line." },
42-
{ LLDB_OPT_SET_1, false, "thread-name",'n', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Prepend all log lines with the thread name for the thread that generates the log line." },
43-
{ LLDB_OPT_SET_1, false, "stack", 'S', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Append a stack backtrace to each log line." },
44-
{ LLDB_OPT_SET_1, false, "append", 'a', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Append to the log file instead of overwriting." },
45-
{ LLDB_OPT_SET_1, false, "file-function",'F',OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Prepend the names of files and function that generate the logs." },
46-
// clang-format on
35+
#define LLDB_OPTIONS_log
36+
#include "CommandOptions.inc"
4737
};
4838

4939
class CommandObjectLogEnable : public CommandObjectParsed {

lldb/source/Commands/CommandObjectMemory.cpp

+6-22
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,8 @@ using namespace lldb;
4747
using namespace lldb_private;
4848

4949
static constexpr OptionDefinition g_read_memory_options[] = {
50-
// clang-format off
51-
{LLDB_OPT_SET_1, false, "num-per-line", 'l', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeNumberPerLine, "The number of items per line to display." },
52-
{LLDB_OPT_SET_2, false, "binary", 'b', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "If true, memory will be saved as binary. If false, the memory is saved save as an ASCII dump that "
53-
"uses the format, size, count and number per line settings." },
54-
{LLDB_OPT_SET_3 |
55-
LLDB_OPT_SET_4, true , "type", 't', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeName, "The name of a type to view memory as." },
56-
{LLDB_OPT_SET_4, false, "language", 'x', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeLanguage, "The language of the type to view memory as."},
57-
{LLDB_OPT_SET_3, false, "offset", 'E', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeCount, "How many elements of the specified type to skip before starting to display data." },
58-
{LLDB_OPT_SET_1 |
59-
LLDB_OPT_SET_2 |
60-
LLDB_OPT_SET_3, false, "force", 'r', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Necessary if reading over target.max-memory-read-size bytes." },
61-
// clang-format on
50+
#define LLDB_OPTIONS_memory_read
51+
#include "CommandOptions.inc"
6252
};
6353

6454
class OptionGroupReadMemory : public OptionGroup {
@@ -907,12 +897,8 @@ class CommandObjectMemoryRead : public CommandObjectParsed {
907897
};
908898

909899
static constexpr OptionDefinition g_memory_find_option_table[] = {
910-
// clang-format off
911-
{LLDB_OPT_SET_1, true, "expression", 'e', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeExpression, "Evaluate an expression to obtain a byte pattern."},
912-
{LLDB_OPT_SET_2, true, "string", 's', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeName, "Use text to find a byte pattern."},
913-
{LLDB_OPT_SET_ALL, false, "count", 'c', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeCount, "How many times to perform the search."},
914-
{LLDB_OPT_SET_ALL, false, "dump-offset", 'o', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeOffset, "When dumping memory for a match, an offset from the match location to start dumping from."},
915-
// clang-format on
900+
#define LLDB_OPTIONS_memory_find
901+
#include "CommandOptions.inc"
916902
};
917903

918904
// Find the specified data in memory
@@ -1204,10 +1190,8 @@ class CommandObjectMemoryFind : public CommandObjectParsed {
12041190
};
12051191

12061192
static constexpr OptionDefinition g_memory_write_option_table[] = {
1207-
// clang-format off
1208-
{LLDB_OPT_SET_1, true, "infile", 'i', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeFilename, "Write memory using the contents of a file."},
1209-
{LLDB_OPT_SET_1, false, "offset", 'o', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeOffset, "Start writing bytes from an offset within the input file."},
1210-
// clang-format on
1193+
#define LLDB_OPTIONS_memory_write
1194+
#include "CommandOptions.inc"
12111195
};
12121196

12131197
// Write memory to the inferior process

lldb/source/Commands/CommandObjectRegister.cpp

+2-5
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,8 @@ using namespace lldb_private;
3434
// "register read"
3535

3636
static constexpr OptionDefinition g_register_read_options[] = {
37-
// clang-format off
38-
{ LLDB_OPT_SET_ALL, false, "alternate", 'A', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Display register names using the alternate register name if there is one." },
39-
{ LLDB_OPT_SET_1, false, "set", 's', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeIndex, "Specify which register sets to dump by index." },
40-
{ LLDB_OPT_SET_2, false, "all", 'a', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Show all register sets." },
41-
// clang-format on
37+
#define LLDB_OPTIONS_register_read
38+
#include "CommandOptions.inc"
4239
};
4340

4441
class CommandObjectRegisterRead : public CommandObjectParsed {

0 commit comments

Comments
 (0)