Skip to content

Commit 438dfcf

Browse files
committed
[lldb][NFC] Tablegenify process
llvm-svn: 366804
1 parent c4c25e1 commit 438dfcf

File tree

2 files changed

+62
-25
lines changed

2 files changed

+62
-25
lines changed

lldb/source/Commands/CommandObjectProcess.cpp

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -256,14 +256,8 @@ class CommandObjectProcessLaunch : public CommandObjectProcessLaunchOrAttach {
256256
};
257257

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

269263
#pragma mark CommandObjectProcessAttach
@@ -506,9 +500,8 @@ class CommandObjectProcessAttach : public CommandObjectProcessLaunchOrAttach {
506500
// CommandObjectProcessContinue
507501

508502
static constexpr OptionDefinition g_process_continue_options[] = {
509-
// clang-format off
510-
{ 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." }
511-
// clang-format on
503+
#define LLDB_OPTIONS_process_continue
504+
#include "CommandOptions.inc"
512505
};
513506

514507
#pragma mark CommandObjectProcessContinue
@@ -667,9 +660,8 @@ class CommandObjectProcessContinue : public CommandObjectParsed {
667660

668661
// CommandObjectProcessDetach
669662
static constexpr OptionDefinition g_process_detach_options[] = {
670-
// clang-format off
671-
{ 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)." },
672-
// clang-format on
663+
#define LLDB_OPTIONS_process_detach
664+
#include "CommandOptions.inc"
673665
};
674666

675667
#pragma mark CommandObjectProcessDetach
@@ -764,9 +756,8 @@ class CommandObjectProcessDetach : public CommandObjectParsed {
764756
// CommandObjectProcessConnect
765757

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

772763
#pragma mark CommandObjectProcessConnect
@@ -889,9 +880,8 @@ class CommandObjectProcessPlugin : public CommandObjectProxy {
889880
// CommandObjectProcessLoad
890881

891882
static constexpr OptionDefinition g_process_load_options[] = {
892-
// clang-format off
893-
{ 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." },
894-
// clang-format on
883+
#define LLDB_OPTIONS_process_load
884+
#include "CommandOptions.inc"
895885
};
896886

897887
#pragma mark CommandObjectProcessLoad
@@ -1273,11 +1263,8 @@ class CommandObjectProcessStatus : public CommandObjectParsed {
12731263
// CommandObjectProcessHandle
12741264

12751265
static constexpr OptionDefinition g_process_handle_options[] = {
1276-
// clang-format off
1277-
{ 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." },
1278-
{ 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." },
1279-
{ LLDB_OPT_SET_1, false, "pass", 'p', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "Whether or not the signal should be passed to the process." }
1280-
// clang-format on
1266+
#define LLDB_OPTIONS_process_handle
1267+
#include "CommandOptions.inc"
12811268
};
12821269

12831270
#pragma mark CommandObjectProcessHandle

lldb/source/Commands/Options.td

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,56 @@ let Command = "regex" in {
370370
Desc<"A syntax string showing the typical usage syntax.">;
371371
}
372372

373+
let Command = "process attach" in {
374+
def process_attach_continue : Option<"continue", "c">,
375+
Desc<"Immediately continue the process once attached.">;
376+
def process_attach_plugin : Option<"plugin", "P">, Arg<"Plugin">,
377+
Desc<"Name of the process plugin you want to use.">;
378+
def process_attach_pid : Option<"pid", "p">, Group<1>, Arg<"Pid">,
379+
Desc<"The process ID of an existing process to attach to.">;
380+
def process_attach_name : Option<"name", "n">, Group<2>, Arg<"ProcessName">,
381+
Desc<"The name of the process to attach to.">;
382+
def process_attach_include_existing : Option<"include-existing", "i">,
383+
Group<2>, Desc<"Include existing processes when doing attach -w.">;
384+
def process_attach_waitfor : Option<"waitfor", "w">, Group<2>,
385+
Desc<"Wait for the process with <process-name> to launch.">;
386+
}
387+
388+
let Command = "process continue" in {
389+
def process_continue_ignore_count : Option<"ignore-count", "i">,
390+
Arg<"UnsignedInteger">, Desc<"Ignore <N> crossings of the breakpoint (if it"
391+
" exists) for the currently selected thread.">;
392+
}
393+
394+
let Command = "process detach" in {
395+
def process_detach_keep_stopped : Option<"keep-stopped", "s">, Group<1>,
396+
Arg<"Boolean">, Desc<"Whether or not the process should be kept stopped on"
397+
" detach (if possible).">;
398+
}
399+
400+
let Command = "process connect" in {
401+
def process_connect_plugin : Option<"plugin", "p">, Arg<"Plugin">,
402+
Desc<"Name of the process plugin you want to use.">;
403+
}
404+
405+
let Command = "process load" in {
406+
def process_load_install : Option<"install", "i">, OptionalArg<"Path">,
407+
Desc<"Install the shared library to the target. If specified without an "
408+
"argument then the library will installed in the current working "
409+
"directory.">;
410+
}
411+
412+
let Command = "process handle" in {
413+
def process_handle_stop : Option<"stop", "s">, Group<1>, Arg<"Boolean">,
414+
Desc<"Whether or not the process should be stopped if the signal is "
415+
"received.">;
416+
def process_handle_notify : Option<"notify", "n">, Group<1>, Arg<"Boolean">,
417+
Desc<"Whether or not the debugger should notify the user if the signal is "
418+
"received.">;
419+
def process_handle_pass : Option<"pass", "p">, Group<1>, Arg<"Boolean">,
420+
Desc<"Whether or not the signal should be passed to the process.">;
421+
}
422+
373423
let Command = "script import" in {
374424
def script_import_allow_reload : Option<"allow-reload", "r">, Group<1>,
375425
Desc<"Allow the script to be loaded even if it was already loaded before. "

0 commit comments

Comments
 (0)