llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)

<details>
<summary>Changes</summary>

Motivated by https://discourse.llvm.org/t/why-is-wait-for-not-attaching/86636

---
Full diff: https://github.com/llvm/llvm-project/pull/142424.diff


2 Files Affected:

- (added) lldb/test/Shell/Driver/TestWaitFor.test (+2) 
- (modified) lldb/tools/driver/Driver.cpp (+6) 


``````````diff
diff --git a/lldb/test/Shell/Driver/TestWaitFor.test 
b/lldb/test/Shell/Driver/TestWaitFor.test
new file mode 100644
index 0000000000000..3afaef84d0111
--- /dev/null
+++ b/lldb/test/Shell/Driver/TestWaitFor.test
@@ -0,0 +1,2 @@
+# RUN: not %lldb --wait-for 2>&1 | FileCheck %s
+# CHECK: error: --wait-for requires a name (--attach-name) or pid 
(--attach-pid)
diff --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp
index e19fded051941..3de48609d385c 100644
--- a/lldb/tools/driver/Driver.cpp
+++ b/lldb/tools/driver/Driver.cpp
@@ -280,6 +280,12 @@ SBError Driver::ProcessArgs(const opt::InputArgList &args, 
bool &exiting) {
   }
 
   if (args.hasArg(OPT_wait_for)) {
+    if (!args.hasArg(OPT_attach_name) || !args.hasArg(OPT_attach_pid)) {
+      error.SetErrorStringWithFormat(
+          "--wait-for requires a name (--attach-name) or pid (--attach-pid)");
+      return error;
+    }
+
     m_option_data.m_wait_for = true;
   }
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/142424
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to