Skip to content

Commit

Permalink
[lldb][NFC] Tablegenify process
Browse files Browse the repository at this point in the history
llvm-svn: 366804
  • Loading branch information
Teemperor committed Jul 23, 2019
1 parent c4c25e1 commit 438dfcf
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 25 deletions.
37 changes: 12 additions & 25 deletions lldb/source/Commands/CommandObjectProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,14 +256,8 @@ class CommandObjectProcessLaunch : public CommandObjectProcessLaunchOrAttach {
};

static constexpr OptionDefinition g_process_attach_options[] = {
// clang-format off
{ LLDB_OPT_SET_ALL, false, "continue", 'c', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Immediately continue the process once attached." },
{ LLDB_OPT_SET_ALL, false, "plugin", 'P', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypePlugin, "Name of the process plugin you want to use." },
{ LLDB_OPT_SET_1, false, "pid", 'p', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypePid, "The process ID of an existing process to attach to." },
{ LLDB_OPT_SET_2, false, "name", 'n', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeProcessName, "The name of the process to attach to." },
{ LLDB_OPT_SET_2, false, "include-existing", 'i', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Include existing processes when doing attach -w." },
{ LLDB_OPT_SET_2, false, "waitfor", 'w', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Wait for the process with <process-name> to launch." },
// clang-format on
#define LLDB_OPTIONS_process_attach
#include "CommandOptions.inc"
};

#pragma mark CommandObjectProcessAttach
Expand Down Expand Up @@ -506,9 +500,8 @@ class CommandObjectProcessAttach : public CommandObjectProcessLaunchOrAttach {
// CommandObjectProcessContinue

static constexpr OptionDefinition g_process_continue_options[] = {
// clang-format off
{ LLDB_OPT_SET_ALL, false, "ignore-count",'i', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeUnsignedInteger, "Ignore <N> crossings of the breakpoint (if it exists) for the currently selected thread." }
// clang-format on
#define LLDB_OPTIONS_process_continue
#include "CommandOptions.inc"
};

#pragma mark CommandObjectProcessContinue
Expand Down Expand Up @@ -667,9 +660,8 @@ class CommandObjectProcessContinue : public CommandObjectParsed {

// CommandObjectProcessDetach
static constexpr OptionDefinition g_process_detach_options[] = {
// clang-format off
{ LLDB_OPT_SET_1, false, "keep-stopped", 's', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "Whether or not the process should be kept stopped on detach (if possible)." },
// clang-format on
#define LLDB_OPTIONS_process_detach
#include "CommandOptions.inc"
};

#pragma mark CommandObjectProcessDetach
Expand Down Expand Up @@ -764,9 +756,8 @@ class CommandObjectProcessDetach : public CommandObjectParsed {
// CommandObjectProcessConnect

static constexpr OptionDefinition g_process_connect_options[] = {
// clang-format off
{ LLDB_OPT_SET_ALL, false, "plugin", 'p', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypePlugin, "Name of the process plugin you want to use." },
// clang-format on
#define LLDB_OPTIONS_process_connect
#include "CommandOptions.inc"
};

#pragma mark CommandObjectProcessConnect
Expand Down Expand Up @@ -889,9 +880,8 @@ class CommandObjectProcessPlugin : public CommandObjectProxy {
// CommandObjectProcessLoad

static constexpr OptionDefinition g_process_load_options[] = {
// clang-format off
{ LLDB_OPT_SET_ALL, false, "install", 'i', OptionParser::eOptionalArgument, nullptr, {}, 0, eArgTypePath, "Install the shared library to the target. If specified without an argument then the library will installed in the current working directory." },
// clang-format on
#define LLDB_OPTIONS_process_load
#include "CommandOptions.inc"
};

#pragma mark CommandObjectProcessLoad
Expand Down Expand Up @@ -1273,11 +1263,8 @@ class CommandObjectProcessStatus : public CommandObjectParsed {
// CommandObjectProcessHandle

static constexpr OptionDefinition g_process_handle_options[] = {
// clang-format off
{ LLDB_OPT_SET_1, false, "stop", 's', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "Whether or not the process should be stopped if the signal is received." },
{ LLDB_OPT_SET_1, false, "notify", 'n', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "Whether or not the debugger should notify the user if the signal is received." },
{ LLDB_OPT_SET_1, false, "pass", 'p', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "Whether or not the signal should be passed to the process." }
// clang-format on
#define LLDB_OPTIONS_process_handle
#include "CommandOptions.inc"
};

#pragma mark CommandObjectProcessHandle
Expand Down
50 changes: 50 additions & 0 deletions lldb/source/Commands/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,56 @@ let Command = "regex" in {
Desc<"A syntax string showing the typical usage syntax.">;
}

let Command = "process attach" in {
def process_attach_continue : Option<"continue", "c">,
Desc<"Immediately continue the process once attached.">;
def process_attach_plugin : Option<"plugin", "P">, Arg<"Plugin">,
Desc<"Name of the process plugin you want to use.">;
def process_attach_pid : Option<"pid", "p">, Group<1>, Arg<"Pid">,
Desc<"The process ID of an existing process to attach to.">;
def process_attach_name : Option<"name", "n">, Group<2>, Arg<"ProcessName">,
Desc<"The name of the process to attach to.">;
def process_attach_include_existing : Option<"include-existing", "i">,
Group<2>, Desc<"Include existing processes when doing attach -w.">;
def process_attach_waitfor : Option<"waitfor", "w">, Group<2>,
Desc<"Wait for the process with <process-name> to launch.">;
}

let Command = "process continue" in {
def process_continue_ignore_count : Option<"ignore-count", "i">,
Arg<"UnsignedInteger">, Desc<"Ignore <N> crossings of the breakpoint (if it"
" exists) for the currently selected thread.">;
}

let Command = "process detach" in {
def process_detach_keep_stopped : Option<"keep-stopped", "s">, Group<1>,
Arg<"Boolean">, Desc<"Whether or not the process should be kept stopped on"
" detach (if possible).">;
}

let Command = "process connect" in {
def process_connect_plugin : Option<"plugin", "p">, Arg<"Plugin">,
Desc<"Name of the process plugin you want to use.">;
}

let Command = "process load" in {
def process_load_install : Option<"install", "i">, OptionalArg<"Path">,
Desc<"Install the shared library to the target. If specified without an "
"argument then the library will installed in the current working "
"directory.">;
}

let Command = "process handle" in {
def process_handle_stop : Option<"stop", "s">, Group<1>, Arg<"Boolean">,
Desc<"Whether or not the process should be stopped if the signal is "
"received.">;
def process_handle_notify : Option<"notify", "n">, Group<1>, Arg<"Boolean">,
Desc<"Whether or not the debugger should notify the user if the signal is "
"received.">;
def process_handle_pass : Option<"pass", "p">, Group<1>, Arg<"Boolean">,
Desc<"Whether or not the signal should be passed to the process.">;
}

let Command = "script import" in {
def script_import_allow_reload : Option<"allow-reload", "r">, Group<1>,
Desc<"Allow the script to be loaded even if it was already loaded before. "
Expand Down

0 comments on commit 438dfcf

Please sign in to comment.