[Lldb-commits] [lldb] r367009 - [lldb] Tablegenify expr/frame/log/register/memory
Raphael Isemann via lldb-commits
lldb-commits at lists.llvm.org
Thu Jul 25 04:22:46 PDT 2019
Author: teemperor
Date: Thu Jul 25 04:22:46 2019
New Revision: 367009
URL: http://llvm.org/viewvc/llvm-project?rev=367009&view=rev
Log:
[lldb] Tablegenify expr/frame/log/register/memory
Modified:
lldb/trunk/source/Commands/CommandObjectExpression.cpp
lldb/trunk/source/Commands/CommandObjectFrame.cpp
lldb/trunk/source/Commands/CommandObjectLog.cpp
lldb/trunk/source/Commands/CommandObjectMemory.cpp
lldb/trunk/source/Commands/CommandObjectRegister.cpp
lldb/trunk/source/Commands/Options.td
Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=367009&r1=367008&r2=367009&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Thu Jul 25 04:22:46 2019
@@ -48,23 +48,8 @@ static constexpr OptionEnumValues Descri
}
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(
Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=367009&r1=367008&r2=367009&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Thu Jul 25 04:22:46 2019
@@ -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 {
@@ -238,9 +235,8 @@ protected:
// 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 {
@@ -744,12 +740,8 @@ protected:
#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 {
Modified: lldb/trunk/source/Commands/CommandObjectLog.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectLog.cpp?rev=367009&r1=367008&r2=367009&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectLog.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectLog.cpp Thu Jul 25 04:22:46 2019
@@ -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 {
Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=367009&r1=367008&r2=367009&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Thu Jul 25 04:22:46 2019
@@ -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 {
@@ -907,12 +897,8 @@ protected:
};
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
@@ -1204,10 +1190,8 @@ protected:
};
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
Modified: lldb/trunk/source/Commands/CommandObjectRegister.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectRegister.cpp?rev=367009&r1=367008&r2=367009&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectRegister.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectRegister.cpp Thu Jul 25 04:22:46 2019
@@ -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 {
Modified: lldb/trunk/source/Commands/Options.td
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/Options.td?rev=367009&r1=367008&r2=367009&view=diff
==============================================================================
--- lldb/trunk/source/Commands/Options.td (original)
+++ lldb/trunk/source/Commands/Options.td Thu Jul 25 04:22:46 2019
@@ -334,6 +334,75 @@ let Command = "disassemble" in {
Desc<"Disassemble function containing this address.">;
}
+let Command = "expression" in {
+ def expression_options_all_threads : Option<"all-threads", "a">,
+ Groups<[1,2]>, Arg<"Boolean">, Desc<"Should we run all threads if the "
+ "execution doesn't complete on one thread.">;
+ def expression_options_ignore_breakpoints : Option<"ignore-breakpoints", "i">,
+ Groups<[1,2]>, Arg<"Boolean">,
+ Desc<"Ignore breakpoint hits while running expressions">;
+ def expression_options_timeout : Option<"timeout", "t">, Groups<[1,2]>,
+ Arg<"UnsignedInteger">,
+ Desc<"Timeout value (in microseconds) for running the expression.">;
+ def expression_options_unwind_on_error : Option<"unwind-on-error", "u">,
+ Groups<[1,2]>, Arg<"Boolean">,
+ Desc<"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).">;
+ def expression_options_debug : Option<"debug", "g">, Groups<[1,2]>,
+ Desc<"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).">;
+ def expression_options_language : Option<"language", "l">, Groups<[1,2]>,
+ Arg<"Language">, Desc<"Specifies the Language to use when parsing the "
+ "expression. If not set the target.language setting is used.">;
+ def expression_options_apply_fixits : Option<"apply-fixits", "X">,
+ Groups<[1,2]>, Arg<"Language">, Desc<"If true, simple fix-it hints will be "
+ "automatically applied to the expression.">;
+ def expression_options_description_verbosity :
+ Option<"description-verbosity", "v">, Group<1>,
+ OptionalEnumArg<"DescriptionVerbosity", "DescriptionVerbosityTypes()">,
+ Desc<"How verbose should the output of this expression be, if the object "
+ "description is asked for.">;
+ def expression_options_top_level : Option<"top-level", "p">, Groups<[1,2]>,
+ Desc<"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.">;
+ def expression_options_allow_jit : Option<"allow-jit", "j">, Groups<[1,2]>,
+ Arg<"Boolean">,
+ Desc<"Controls whether the expression can fall back to being JITted if it's"
+ "not supported by the interpreter (defaults to true).">;
+}
+
+let Command = "frame diag" in {
+ def frame_diag_register : Option<"register", "r">, Group<1>,
+ Arg<"RegisterName">, Desc<"A register to diagnose.">;
+ def frame_diag_address : Option<"address", "a">, Group<1>, Arg<"Address">,
+ Desc<"An address to diagnose.">;
+ def frame_diag_offset : Option<"offset", "o">, Group<1>, Arg<"Offset">,
+ Desc<"An optional offset. Requires --register.">;
+}
+
+let Command = "frame select" in {
+ def frame_select_relative : Option<"relative", "r">, Group<1>, Arg<"Offset">,
+ Desc<"A relative frame index offset from the current frame index.">;
+}
+
+let Command = "frame recognizer add" in {
+ def frame_recognizer_shlib : Option<"shlib", "s">, Arg<"ShlibName">,
+ Completion<"Module">,
+ Desc<"Name of the module or shared library that this recognizer applies "
+ "to.">;
+ def frame_recognizer_function : Option<"function", "n">, Arg<"Name">,
+ Completion<"Symbol">,
+ Desc<"Name of the function that this recognizer applies to.">;
+ def frame_recognizer_python_class : Option<"python-class", "l">, Group<2>,
+ Arg<"PythonClass">,
+ Desc<"Give the name of a Python class to use for this frame recognizer.">;
+ def frame_recognizer_regex : Option<"regex", "x">,
+ Desc<"Function name and module name are actually regular expressions.">;
+}
+
let Command = "history" in {
def history_count : Option<"count", "c">, Group<1>, Arg<"UnsignedInteger">,
Desc<"How many history commands to print.">;
@@ -347,6 +416,80 @@ let Command = "history" in {
Desc<"Clears the current command history.">;
}
+let Command = "log" in {
+ def log_file : Option<"file", "f">, Group<1>, Arg<"Filename">,
+ Desc<"Set the destination file to log to.">;
+ def log_threadsafe : Option<"threadsafe", "t">, Group<1>,
+ Desc<"Enable thread safe logging to avoid interweaved log lines.">;
+ def log_verbose : Option<"verbose", "v">, Group<1>,
+ Desc<"Enable verbose logging.">;
+ def log_sequence : Option<"sequence", "s">, Group<1>,
+ Desc<"Prepend all log lines with an increasing integer sequence id.">;
+ def log_timestamp : Option<"timestamp", "T">, Group<1>,
+ Desc<"Prepend all log lines with a timestamp.">;
+ def log_pid_tid : Option<"pid-tid", "p">, Group<1>,
+ Desc<"Prepend all log lines with the process and thread ID that generates "
+ "the log line.">;
+ def log_thread_name : Option<"thread-name", "n">, Group<1>,
+ Desc<"Prepend all log lines with the thread name for the thread that "
+ "generates the log line.">;
+
+ def log_stack : Option<"stack", "S">, Group<1>,
+ Desc<"Append a stack backtrace to each log line.">;
+ def log_append : Option<"append", "a">, Group<1>,
+ Desc<"Append to the log file instead of overwriting.">;
+ def log_file_function : Option<"file-function", "F">, Group<1>,
+ Desc<"Prepend the names of files and function that generate the logs.">;
+}
+
+let Command = "memory read" in {
+ def memory_read_num_per_line : Option<"num-per-line", "l">, Group<1>,
+ Arg<"NumberPerLine">, Desc<"The number of items per line to display.">;
+ def memory_read_binary : Option<"binary", "b">, Group<2>,
+ Desc<"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.">;
+ def memory_read_type : Option<"type", "t">, Groups<[3,4]>, Arg<"Name">,
+ Required, Desc<"The name of a type to view memory as.">;
+ def memory_read_language : Option<"language", "x">, Group<4>, Arg<"Language">,
+ Desc<"The language of the type to view memory as.">;
+ def memory_read_offset : Option<"offset", "E">, Group<3>, Arg<"Count">,
+ Desc<"How many elements of the specified type to skip before starting to "
+ "display data.">;
+ def memory_read_force : Option<"force", "r">, Groups<[1,2,3]>,
+ Desc<"Necessary if reading over target.max-memory-read-size bytes.">;
+}
+
+let Command = "memory find" in {
+ def memory_find_expression : Option<"expression", "e">, Group<1>,
+ Arg<"Expression">, Required,
+ Desc<"Evaluate an expression to obtain a byte pattern.">;
+ def memory_find_string : Option<"string", "s">, Group<2>, Arg<"Name">,
+ Required, Desc<"Use text to find a byte pattern.">;
+ def memory_find_count : Option<"count", "c">, Arg<"Count">,
+ Desc<"How many times to perform the search.">;
+ def memory_find_dump_offset : Option<"dump-offset", "o">, Arg<"Offset">,
+ Desc<"When dumping memory for a match, an offset from the match location to"
+ " start dumping from.">;
+}
+
+let Command = "memory write" in {
+ def memory_write_infile : Option<"infile", "i">, Group<1>, Arg<"Filename">,
+ Required, Desc<"Write memory using the contents of a file.">;
+ def memory_write_offset : Option<"offset", "o">, Group<1>, Arg<"Offset">,
+ Desc<"Start writing bytes from an offset within the input file.">;
+}
+
+let Command = "register read" in {
+ def register_read_alternate : Option<"alternate", "A">,
+ Desc<"Display register names using the alternate register name if there "
+ "is one.">;
+ def register_read_set : Option<"set", "s">, Group<1>, Arg<"Index">,
+ Desc<"Specify which register sets to dump by index.">;
+ def register_read_all : Option<"all", "a">, Group<2>,
+ Desc<"Show all register sets.">;
+}
+
let Command = "source" in {
def source_stop_on_error : Option<"stop-on-error", "e">, Arg<"Boolean">,
Desc<"If true, stop executing commands on error.">;
More information about the lldb-commits
mailing list