Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LLDB] Cherrypick tablegen dependencies #15

Merged
merged 13 commits into from
Oct 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lldb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ endif()
if (NOT LLDB_DISABLE_PYTHON)
add_subdirectory(scripts)
endif ()

add_subdirectory(utils/TableGen)
add_subdirectory(source)
add_subdirectory(tools)
add_subdirectory(docs)
Expand Down
35 changes: 34 additions & 1 deletion lldb/cmake/modules/AddLLDB.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,37 @@
function(lldb_tablegen)
# Syntax:
# lldb_tablegen output-file [tablegen-arg ...] SOURCE source-file
# [[TARGET cmake-target-name] [DEPENDS extra-dependency ...]]
#
# Generates a custom command for invoking tblgen as
#
# tblgen source-file -o=output-file tablegen-arg ...
#
# and, if cmake-target-name is provided, creates a custom target for
# executing the custom command depending on output-file. It is
# possible to list more files to depend after DEPENDS.

cmake_parse_arguments(LTG "" "SOURCE;TARGET" "" ${ARGN})

if(NOT LTG_SOURCE)
message(FATAL_ERROR "SOURCE source-file required by lldb_tablegen")
endif()

set(LLVM_TARGET_DEFINITIONS ${LTG_SOURCE})
tablegen(LLDB ${LTG_UNPARSED_ARGUMENTS})

if(LTG_TARGET)
add_public_tablegen_target(${LTG_TARGET})
set_target_properties( ${LTG_TARGET} PROPERTIES FOLDER "LLDB tablegenning")
set_property(GLOBAL APPEND PROPERTY LLDB_TABLEGEN_TARGETS ${LTG_TARGET})
endif()
endfunction(lldb_tablegen)

function(add_lldb_library name)
include_directories(BEFORE
${CMAKE_CURRENT_BINARY_DIR}
)

# only supported parameters to this macro are the optional
# MODULE;SHARED;STATIC library type and source files
cmake_parse_arguments(PARAM
Expand Down Expand Up @@ -236,4 +269,4 @@ function(lldb_setup_rpaths name)
BUILD_RPATH "${LIST_BUILD_RPATH}"
INSTALL_RPATH "${LIST_INSTALL_RPATH}"
)
endfunction()
endfunction()
6 changes: 6 additions & 0 deletions lldb/source/Commands/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
lldb_tablegen(Options.inc -gen-lldb-option-defs
SOURCE Options.td
TARGET LLDBOptionsGen)

add_lldb_library(lldbCommands
CommandCompletions.cpp
CommandObjectApropos.cpp
Expand Down Expand Up @@ -45,3 +49,5 @@ add_lldb_library(lldbCommands
LINK_COMPONENTS
Support
)

add_dependencies(lldbCommands LLDBOptionsGen)
153 changes: 20 additions & 133 deletions lldb/source/Commands/CommandObjectBreakpoint.cpp

Large diffs are not rendered by default.

14 changes: 4 additions & 10 deletions lldb/source/Commands/CommandObjectBreakpointCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,8 @@ static constexpr OptionEnumValues ScriptOptionEnum() {
}

static constexpr OptionDefinition g_breakpoint_add_options[] = {
// clang-format off
{ LLDB_OPT_SET_1, false, "one-liner", 'o', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeOneLiner, "Specify a one-line breakpoint command inline. Be sure to surround it with quotes." },
{ LLDB_OPT_SET_ALL, false, "stop-on-error", 'e', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "Specify whether breakpoint command execution should terminate on error." },
{ LLDB_OPT_SET_ALL, false, "script-type", 's', OptionParser::eRequiredArgument, nullptr, ScriptOptionEnum(), 0, eArgTypeNone, "Specify the language for the commands - if none is specified, the lldb command interpreter will be used." },
{ LLDB_OPT_SET_2, false, "python-function", 'F', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypePythonFunction, "Give the name of a Python function to run as command for this breakpoint. Be sure to give a module name if appropriate." },
{ LLDB_OPT_SET_ALL, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Sets Dummy breakpoints - i.e. breakpoints set before a file is provided, which prime new targets." },
// clang-format on
#define LLDB_OPTIONS_breakpoint_command_add
#include "CommandOptions.inc"
};

class CommandObjectBreakpointCommandAdd : public CommandObjectParsed,
Expand Down Expand Up @@ -470,9 +465,8 @@ const char *CommandObjectBreakpointCommandAdd::g_reader_instructions =
// CommandObjectBreakpointCommandDelete

static constexpr OptionDefinition g_breakpoint_delete_options[] = {
// clang-format off
{ LLDB_OPT_SET_1, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Delete commands from Dummy breakpoints - i.e. breakpoints set before a file is provided, which prime new targets." },
// clang-format on
#define LLDB_OPTIONS_breakpoint_command_delete
#include "CommandOptions.inc"
};

class CommandObjectBreakpointCommandDelete : public CommandObjectParsed {
Expand Down
40 changes: 12 additions & 28 deletions lldb/source/Commands/CommandObjectCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,8 @@ using namespace lldb_private;
// CommandObjectCommandsSource

static constexpr OptionDefinition g_history_options[] = {
// clang-format off
{ LLDB_OPT_SET_1, false, "count", 'c', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeUnsignedInteger, "How many history commands to print." },
{ LLDB_OPT_SET_1, false, "start-index", 's', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeUnsignedInteger, "Index at which to start printing history commands (or end to mean tail mode)." },
{ LLDB_OPT_SET_1, false, "end-index", 'e', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeUnsignedInteger, "Index at which to stop printing history commands." },
{ LLDB_OPT_SET_2, false, "clear", 'C', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeBoolean, "Clears the current command history." },
// clang-format on
#define LLDB_OPTIONS_history
#include "CommandOptions.inc"
};

class CommandObjectCommandsHistory : public CommandObjectParsed {
Expand Down Expand Up @@ -189,11 +185,8 @@ class CommandObjectCommandsHistory : public CommandObjectParsed {
// CommandObjectCommandsSource

static constexpr OptionDefinition g_source_options[] = {
// clang-format off
{ LLDB_OPT_SET_ALL, false, "stop-on-error", 'e', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "If true, stop executing commands on error." },
{ LLDB_OPT_SET_ALL, false, "stop-on-continue", 'c', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "If true, stop executing commands on continue." },
{ LLDB_OPT_SET_ALL, false, "silent-run", 's', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "If true don't echo commands while executing." },
// clang-format on
#define LLDB_OPTIONS_source
#include "CommandOptions.inc"
};

class CommandObjectCommandsSource : public CommandObjectParsed {
Expand Down Expand Up @@ -344,10 +337,8 @@ class CommandObjectCommandsSource : public CommandObjectParsed {
// CommandObjectCommandsAlias

static constexpr OptionDefinition g_alias_options[] = {
// clang-format off
{ LLDB_OPT_SET_ALL, false, "help", 'h', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeHelpText, "Help text for this command" },
{ LLDB_OPT_SET_ALL, false, "long-help", 'H', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeHelpText, "Long help text for this command" },
// clang-format on
#define LLDB_OPTIONS_alias
#include "CommandOptions.inc"
};

static const char *g_python_command_instructions =
Expand Down Expand Up @@ -912,10 +903,8 @@ class CommandObjectCommandsDelete : public CommandObjectParsed {
// CommandObjectCommandsAddRegex

static constexpr OptionDefinition g_regex_options[] = {
// clang-format off
{ LLDB_OPT_SET_1, false, "help" , 'h', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeNone, "The help text to display for this command." },
{ LLDB_OPT_SET_1, false, "syntax", 's', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeNone, "A syntax string showing the typical usage syntax." },
// clang-format on
#define LLDB_OPTIONS_regex
#include "CommandOptions.inc"
};

#pragma mark CommandObjectCommandsAddRegex
Expand Down Expand Up @@ -1387,9 +1376,8 @@ class CommandObjectScriptingObject : public CommandObjectRaw {
// CommandObjectCommandsScriptImport

static constexpr OptionDefinition g_script_import_options[] = {
// clang-format off
{ LLDB_OPT_SET_1, false, "allow-reload", 'r', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Allow the script to be loaded even if it was already loaded before. This argument exists for backwards compatibility, but reloading is always allowed, whether you specify it or not." },
// clang-format on
#define LLDB_OPTIONS_script_import
#include "CommandOptions.inc"
};

class CommandObjectCommandsScriptImport : public CommandObjectParsed {
Expand Down Expand Up @@ -1521,12 +1509,8 @@ static constexpr OptionEnumValues ScriptSynchroType() {
}

static constexpr OptionDefinition g_script_add_options[] = {
// clang-format off
{ LLDB_OPT_SET_1, false, "function", 'f', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypePythonFunction, "Name of the Python function to bind to this command name." },
{ LLDB_OPT_SET_2, false, "class", 'c', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypePythonClass, "Name of the Python class to bind to this command name." },
{ LLDB_OPT_SET_1, false, "help" , 'h', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeHelpText, "The help text to display for this command." },
{ LLDB_OPT_SET_ALL, false, "synchronicity", 's', OptionParser::eRequiredArgument, nullptr, ScriptSynchroType(), 0, eArgTypeScriptedCommandSynchronicity, "Set the synchronicity of this command's executions with regard to LLDB event system." },
// clang-format on
#define LLDB_OPTIONS_script_add
#include "CommandOptions.inc"
};

class CommandObjectCommandsScriptAdd : public CommandObjectParsed,
Expand Down
26 changes: 2 additions & 24 deletions lldb/source/Commands/CommandObjectDisassemble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,8 @@ using namespace lldb;
using namespace lldb_private;

static constexpr OptionDefinition g_disassemble_options[] = {
// clang-format off
{ LLDB_OPT_SET_ALL, false, "bytes", 'b', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Show opcode bytes when disassembling." },
{ LLDB_OPT_SET_ALL, false, "context", 'C', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeNumLines, "Number of context lines of source to show." },
{ LLDB_OPT_SET_ALL, false, "mixed", 'm', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Enable mixed source and assembly display." },
{ LLDB_OPT_SET_ALL, false, "raw", 'r', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Print raw disassembly with no symbol information." },
{ LLDB_OPT_SET_ALL, false, "plugin", 'P', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypePlugin, "Name of the disassembler plugin you want to use." },
{ LLDB_OPT_SET_ALL, false, "flavor", 'F', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeDisassemblyFlavor, "Name of the disassembly flavor you want to use. "
"Currently the only valid options are default, and for Intel "
"architectures, att and intel." },
{ LLDB_OPT_SET_ALL, false, "arch", 'A', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeArchitecture, "Specify the architecture to use from cross disassembly." },
{ LLDB_OPT_SET_1 |
LLDB_OPT_SET_2, true, "start-address", 's', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeAddressOrExpression, "Address at which to start disassembling." },
{ LLDB_OPT_SET_1, false, "end-address", 'e', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeAddressOrExpression, "Address at which to end disassembling." },
{ LLDB_OPT_SET_2 |
LLDB_OPT_SET_3 |
LLDB_OPT_SET_4 |
LLDB_OPT_SET_5, false, "count", 'c', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeNumLines, "Number of instructions to display." },
{ LLDB_OPT_SET_3, false, "name", 'n', OptionParser::eRequiredArgument, nullptr, {}, CommandCompletions::eSymbolCompletion, eArgTypeFunctionName, "Disassemble entire contents of the given function name." },
{ LLDB_OPT_SET_4, false, "frame", 'f', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Disassemble from the start of the current frame's function." },
{ LLDB_OPT_SET_5, false, "pc", 'p', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Disassemble around the current pc." },
{ 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 "
"table information, else disassemble around the pc." },
{ LLDB_OPT_SET_7, false, "address", 'a', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeAddressOrExpression, "Disassemble function containing this address." },
// clang-format on
#define LLDB_OPTIONS_disassemble
#include "CommandOptions.inc"
};

CommandObjectDisassemble::CommandOptions::CommandOptions()
Expand Down
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 @@ -55,11 +55,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 @@ -239,9 +236,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 @@ -745,12 +741,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
Loading