[Lldb-commits] [PATCH] D128775: [trace] Fix errors when handling command arguments
walter erquinigo via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Jun 28 17:40:14 PDT 2022
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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128775.440817.patch
Type: text/x-patch
Size: 2374 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220629/90c77ca3/attachment.bin>
More information about the lldb-commits
mailing list