Skip to content

Commit

Permalink
[lldb] Tablegenify expr/frame/log/register/memory
Browse files Browse the repository at this point in the history
llvm-svn: 367009
  • Loading branch information
Teemperor committed Jul 25, 2019
1 parent 88ed70e commit ec67e73
Show file tree
Hide file tree
Showing 6 changed files with 161 additions and 70 deletions.
19 changes: 2 additions & 17 deletions lldb/source/Commands/CommandObjectExpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,8 @@ static constexpr OptionEnumValues DescriptionVerbosityTypes() {
}

static constexpr OptionDefinition g_expression_options[] = {
// clang-format off
{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."},
{LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "ignore-breakpoints", 'i', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "Ignore breakpoint hits while running expressions"},
{LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "timeout", 't', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeUnsignedInteger, "Timeout value (in microseconds) for running the expression."},
{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. "
"Note, unlike gdb hitting a breakpoint is controlled by another option (-i)."},
{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 "
"and forcing breakpoints to not be ignored (-i0) and no unwinding to happen on error (-u0)."},
{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 "
"setting is used." },
{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." },
{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."},
{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 "
"context. Allows declaration of persistent, top-level entities without a $ prefix."},
{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 "
"the interpreter (defaults to true)."}
// clang-format on
#define LLDB_OPTIONS_expression
#include "CommandOptions.inc"
};

Status CommandObjectExpression::CommandOptions::SetOptionValue(
Expand Down
20 changes: 6 additions & 14 deletions lldb/source/Commands/CommandObjectFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,8 @@ using namespace lldb_private;
// CommandObjectFrameDiagnose

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

class CommandObjectFrameDiagnose : public CommandObjectParsed {
Expand Down Expand Up @@ -238,9 +235,8 @@ class CommandObjectFrameInfo : public CommandObjectParsed {
// CommandObjectFrameSelect

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

class CommandObjectFrameSelect : public CommandObjectParsed {
Expand Down Expand Up @@ -744,12 +740,8 @@ class CommandObjectFrameVariable : public CommandObjectParsed {
#pragma mark CommandObjectFrameRecognizer

static OptionDefinition g_frame_recognizer_add_options[] = {
// clang-format off
{ 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." },
{ LLDB_OPT_SET_ALL, false, "function", 'n', OptionParser::eRequiredArgument, nullptr, {}, CommandCompletions::eSymbolCompletion, eArgTypeName, "Name of the function that this recognizer applies to." },
{ 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." },
{ LLDB_OPT_SET_ALL, false, "regex", 'x', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Function name and module name are actually regular expressions." }
// clang-format on
#define LLDB_OPTIONS_frame_recognizer_add
#include "CommandOptions.inc"
};

class CommandObjectFrameRecognizerAdd : public CommandObjectParsed {
Expand Down
14 changes: 2 additions & 12 deletions lldb/source/Commands/CommandObjectLog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,8 @@ using namespace lldb;
using namespace lldb_private;

static constexpr OptionDefinition g_log_options[] = {
// clang-format off
{ LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeFilename, "Set the destination file to log to." },
{ LLDB_OPT_SET_1, false, "threadsafe", 't', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Enable thread safe logging to avoid interweaved log lines." },
{ LLDB_OPT_SET_1, false, "verbose", 'v', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Enable verbose logging." },
{ LLDB_OPT_SET_1, false, "sequence", 's', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Prepend all log lines with an increasing integer sequence id." },
{ LLDB_OPT_SET_1, false, "timestamp", 'T', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Prepend all log lines with a timestamp." },
{ 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." },
{ 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." },
{ LLDB_OPT_SET_1, false, "stack", 'S', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Append a stack backtrace to each log line." },
{ LLDB_OPT_SET_1, false, "append", 'a', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Append to the log file instead of overwriting." },
{ LLDB_OPT_SET_1, false, "file-function",'F',OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Prepend the names of files and function that generate the logs." },
// clang-format on
#define LLDB_OPTIONS_log
#include "CommandOptions.inc"
};

class CommandObjectLogEnable : public CommandObjectParsed {
Expand Down
28 changes: 6 additions & 22 deletions lldb/source/Commands/CommandObjectMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,8 @@ using namespace lldb;
using namespace lldb_private;

static constexpr OptionDefinition g_read_memory_options[] = {
// clang-format off
{LLDB_OPT_SET_1, false, "num-per-line", 'l', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeNumberPerLine, "The number of items per line to display." },
{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 "
"uses the format, size, count and number per line settings." },
{LLDB_OPT_SET_3 |
LLDB_OPT_SET_4, true , "type", 't', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeName, "The name of a type to view memory as." },
{LLDB_OPT_SET_4, false, "language", 'x', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeLanguage, "The language of the type to view memory as."},
{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." },
{LLDB_OPT_SET_1 |
LLDB_OPT_SET_2 |
LLDB_OPT_SET_3, false, "force", 'r', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Necessary if reading over target.max-memory-read-size bytes." },
// clang-format on
#define LLDB_OPTIONS_memory_read
#include "CommandOptions.inc"
};

class OptionGroupReadMemory : public OptionGroup {
Expand Down Expand Up @@ -907,12 +897,8 @@ class CommandObjectMemoryRead : public CommandObjectParsed {
};

static constexpr OptionDefinition g_memory_find_option_table[] = {
// clang-format off
{LLDB_OPT_SET_1, true, "expression", 'e', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeExpression, "Evaluate an expression to obtain a byte pattern."},
{LLDB_OPT_SET_2, true, "string", 's', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeName, "Use text to find a byte pattern."},
{LLDB_OPT_SET_ALL, false, "count", 'c', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeCount, "How many times to perform the search."},
{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."},
// clang-format on
#define LLDB_OPTIONS_memory_find
#include "CommandOptions.inc"
};

// Find the specified data in memory
Expand Down Expand Up @@ -1204,10 +1190,8 @@ class CommandObjectMemoryFind : public CommandObjectParsed {
};

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

// Write memory to the inferior process
Expand Down
7 changes: 2 additions & 5 deletions lldb/source/Commands/CommandObjectRegister.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,8 @@ using namespace lldb_private;
// "register read"

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

class CommandObjectRegisterRead : public CommandObjectParsed {
Expand Down
Loading

0 comments on commit ec67e73

Please sign in to comment.