Skip to content

Commit f188363

Browse files
committed
[lldb][NFC] Tablegenify disassemble
llvm-svn: 366783
1 parent 32f220c commit f188363

File tree

2 files changed

+41
-24
lines changed

2 files changed

+41
-24
lines changed

lldb/source/Commands/CommandObjectDisassemble.cpp

+2-24
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,8 @@ using namespace lldb;
3131
using namespace lldb_private;
3232

3333
static constexpr OptionDefinition g_disassemble_options[] = {
34-
// clang-format off
35-
{ LLDB_OPT_SET_ALL, false, "bytes", 'b', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Show opcode bytes when disassembling." },
36-
{ LLDB_OPT_SET_ALL, false, "context", 'C', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeNumLines, "Number of context lines of source to show." },
37-
{ LLDB_OPT_SET_ALL, false, "mixed", 'm', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Enable mixed source and assembly display." },
38-
{ LLDB_OPT_SET_ALL, false, "raw", 'r', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Print raw disassembly with no symbol information." },
39-
{ LLDB_OPT_SET_ALL, false, "plugin", 'P', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypePlugin, "Name of the disassembler plugin you want to use." },
40-
{ LLDB_OPT_SET_ALL, false, "flavor", 'F', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeDisassemblyFlavor, "Name of the disassembly flavor you want to use. "
41-
"Currently the only valid options are default, and for Intel "
42-
"architectures, att and intel." },
43-
{ LLDB_OPT_SET_ALL, false, "arch", 'A', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeArchitecture, "Specify the architecture to use from cross disassembly." },
44-
{ LLDB_OPT_SET_1 |
45-
LLDB_OPT_SET_2, true, "start-address", 's', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeAddressOrExpression, "Address at which to start disassembling." },
46-
{ LLDB_OPT_SET_1, false, "end-address", 'e', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeAddressOrExpression, "Address at which to end disassembling." },
47-
{ LLDB_OPT_SET_2 |
48-
LLDB_OPT_SET_3 |
49-
LLDB_OPT_SET_4 |
50-
LLDB_OPT_SET_5, false, "count", 'c', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeNumLines, "Number of instructions to display." },
51-
{ LLDB_OPT_SET_3, false, "name", 'n', OptionParser::eRequiredArgument, nullptr, {}, CommandCompletions::eSymbolCompletion, eArgTypeFunctionName, "Disassemble entire contents of the given function name." },
52-
{ LLDB_OPT_SET_4, false, "frame", 'f', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Disassemble from the start of the current frame's function." },
53-
{ LLDB_OPT_SET_5, false, "pc", 'p', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Disassemble around the current pc." },
54-
{ LLDB_OPT_SET_6, false, "line", 'l', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Disassemble the current frame's current source line instructions if there is debug line "
55-
"table information, else disassemble around the pc." },
56-
{ LLDB_OPT_SET_7, false, "address", 'a', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeAddressOrExpression, "Disassemble function containing this address." },
57-
// clang-format on
34+
#define LLDB_OPTIONS_disassemble
35+
#include "CommandOptions.inc"
5836
};
5937

6038
CommandObjectDisassemble::CommandOptions::CommandOptions()

lldb/source/Commands/Options.td

+39
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,45 @@ let Command = "breakpoint command delete" in {
295295
"a file is provided, which prime new targets.">;
296296
}
297297

298+
let Command = "disassemble" in {
299+
def disassemble_options_bytes : Option<"bytes", "b">,
300+
Desc<"Show opcode bytes when disassembling.">;
301+
def disassemble_options_context : Option<"context", "C">, Arg<"NumLines">,
302+
Desc<"Number of context lines of source to show.">;
303+
def disassemble_options_mixed : Option<"mixed", "m">,
304+
Desc<"Enable mixed source and assembly display.">;
305+
def disassemble_options_raw : Option<"raw", "r">,
306+
Desc<"Print raw disassembly with no symbol information.">;
307+
def disassemble_options_plugin : Option<"plugin", "P">, Arg<"Plugin">,
308+
Desc<"Name of the disassembler plugin you want to use.">;
309+
def disassemble_options_flavor : Option<"flavor", "F">,
310+
Arg<"DisassemblyFlavor">, Desc<"Name of the disassembly flavor you want to "
311+
"use. Currently the only valid options are default, and for Intel "
312+
"architectures, att and intel.">;
313+
def disassemble_options_arch : Option<"arch", "A">, Arg<"Architecture">,
314+
Desc<"Specify the architecture to use from cross disassembly.">;
315+
def disassemble_options_start_address : Option<"start-address", "s">,
316+
Groups<[1,2]>, Arg<"AddressOrExpression">, Required,
317+
Desc<"Address at which to start disassembling.">;
318+
def disassemble_options_end_address : Option<"end-address", "e">, Group<1>,
319+
Arg<"AddressOrExpression">, Desc<"Address at which to end disassembling.">;
320+
def disassemble_options_count : Option<"count", "c">, Groups<[2,3,4,5]>,
321+
Arg<"NumLines">, Desc<"Number of instructions to display.">;
322+
def disassemble_options_name : Option<"name", "n">, Group<3>,
323+
Arg<"FunctionName">, Completion<"Symbol">,
324+
Desc<"Disassemble entire contents of the given function name.">;
325+
def disassemble_options_frame : Option<"frame", "f">, Group<4>,
326+
Desc<"Disassemble from the start of the current frame's function.">;
327+
def disassemble_options_pc : Option<"pc", "p">, Group<5>,
328+
Desc<"Disassemble around the current pc.">;
329+
def disassemble_options_line : Option<"line", "l">, Group<6>,
330+
Desc<"Disassemble the current frame's current source line instructions if"
331+
"there is debug line table information, else disassemble around the pc.">;
332+
def disassemble_options_address : Option<"address", "a">, Group<7>,
333+
Arg<"AddressOrExpression">,
334+
Desc<"Disassemble function containing this address.">;
335+
}
336+
298337
let Command = "history" in {
299338
def history_count : Option<"count", "c">, Group<1>, Arg<"UnsignedInteger">,
300339
Desc<"How many history commands to print.">;

0 commit comments

Comments
 (0)