wallace created this revision. wallace added reviewers: jj10306, persona0220. Herald added a project: All. wallace requested review of this revision. Herald added a project: LLDB. Herald added a subscriber: lldb-commits.
https://reviews.llvm.org/D128453 recently added some safety checks for command arguments. Unfortunately, some few commands started failing due to that, and this diff fixes it. But fortunately, the fix is trivial, which is simply declaring the argument that these commands will receive. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D128775 Files: lldb/source/Commands/CommandObjectThread.cpp lldb/source/Commands/CommandObjectThreadUtil.cpp lldb/source/Commands/CommandObjectThreadUtil.h Index: lldb/source/Commands/CommandObjectThreadUtil.h =================================================================== --- lldb/source/Commands/CommandObjectThreadUtil.h +++ lldb/source/Commands/CommandObjectThreadUtil.h @@ -80,7 +80,9 @@ /// an action on multiple threads at once instead of iterating over each thread. class CommandObjectMultipleThreads : public CommandObjectParsed { public: - using CommandObjectParsed::CommandObjectParsed; + CommandObjectMultipleThreads(CommandInterpreter &interpreter, + const char *name, const char *help, + const char *syntax, uint32_t flags); bool DoExecute(Args &command, CommandReturnObject &result) override; Index: lldb/source/Commands/CommandObjectThreadUtil.cpp =================================================================== --- lldb/source/Commands/CommandObjectThreadUtil.cpp +++ lldb/source/Commands/CommandObjectThreadUtil.cpp @@ -25,6 +25,15 @@ m_arguments.push_back({thread_arg}); } +CommandObjectMultipleThreads::CommandObjectMultipleThreads( + CommandInterpreter &interpreter, const char *name, const char *help, + const char *syntax, uint32_t flags) + : CommandObjectParsed(interpreter, name, help, syntax, flags) { + // These commands all take thread ID's as arguments. + CommandArgumentData thread_arg{eArgTypeThreadIndex, eArgRepeatStar}; + m_arguments.push_back({thread_arg}); +} + bool CommandObjectIterateOverThreads::DoExecute(Args &command, CommandReturnObject &result) { result.SetStatus(m_success_return); Index: lldb/source/Commands/CommandObjectThread.cpp =================================================================== --- lldb/source/Commands/CommandObjectThread.cpp +++ lldb/source/Commands/CommandObjectThread.cpp @@ -2219,7 +2219,10 @@ nullptr, eCommandRequiresProcess | eCommandRequiresThread | eCommandTryTargetAPILock | eCommandProcessMustBeLaunched | - eCommandProcessMustBePaused | eCommandProcessMustBeTraced) {} + eCommandProcessMustBePaused | eCommandProcessMustBeTraced) { + CommandArgumentData thread_arg{eArgTypeThreadIndex, eArgRepeatOptional}; + m_arguments.push_back({thread_arg}); + } ~CommandObjectTraceDumpInstructions() override = default;
Index: lldb/source/Commands/CommandObjectThreadUtil.h =================================================================== --- lldb/source/Commands/CommandObjectThreadUtil.h +++ lldb/source/Commands/CommandObjectThreadUtil.h @@ -80,7 +80,9 @@ /// an action on multiple threads at once instead of iterating over each thread. class CommandObjectMultipleThreads : public CommandObjectParsed { public: - using CommandObjectParsed::CommandObjectParsed; + CommandObjectMultipleThreads(CommandInterpreter &interpreter, + const char *name, const char *help, + const char *syntax, uint32_t flags); bool DoExecute(Args &command, CommandReturnObject &result) override; Index: lldb/source/Commands/CommandObjectThreadUtil.cpp =================================================================== --- lldb/source/Commands/CommandObjectThreadUtil.cpp +++ lldb/source/Commands/CommandObjectThreadUtil.cpp @@ -25,6 +25,15 @@ m_arguments.push_back({thread_arg}); } +CommandObjectMultipleThreads::CommandObjectMultipleThreads( + CommandInterpreter &interpreter, const char *name, const char *help, + const char *syntax, uint32_t flags) + : CommandObjectParsed(interpreter, name, help, syntax, flags) { + // These commands all take thread ID's as arguments. + CommandArgumentData thread_arg{eArgTypeThreadIndex, eArgRepeatStar}; + m_arguments.push_back({thread_arg}); +} + bool CommandObjectIterateOverThreads::DoExecute(Args &command, CommandReturnObject &result) { result.SetStatus(m_success_return); Index: lldb/source/Commands/CommandObjectThread.cpp =================================================================== --- lldb/source/Commands/CommandObjectThread.cpp +++ lldb/source/Commands/CommandObjectThread.cpp @@ -2219,7 +2219,10 @@ nullptr, eCommandRequiresProcess | eCommandRequiresThread | eCommandTryTargetAPILock | eCommandProcessMustBeLaunched | - eCommandProcessMustBePaused | eCommandProcessMustBeTraced) {} + eCommandProcessMustBePaused | eCommandProcessMustBeTraced) { + CommandArgumentData thread_arg{eArgTypeThreadIndex, eArgRepeatOptional}; + m_arguments.push_back({thread_arg}); + } ~CommandObjectTraceDumpInstructions() override = default;
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits