[Lldb-commits] [PATCH] D128775: [trace] Fix errors when handling command arguments

Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 28 17:54:46 PDT 2022


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6564ca188a12: [trace] Fix errors when handling command arguments (authored by Walter Erquinigo <wallace at fb.com>).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128775/new/

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.440818.patch
Type: text/x-patch
Size: 2374 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220629/03db204b/attachment.bin>


More information about the lldb-commits mailing list