[Lldb-commits] [lldb] [lldb] Emit an error when using --wait-for without a name or pid (PR #142424)

via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 2 15:12:08 PDT 2025


================
@@ -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)) {
----------------
jimingham wrote:

Process::Attach does:

```
  lldb::pid_t attach_pid = attach_info.GetProcessID();
  Status error;
  if (attach_pid == LLDB_INVALID_PROCESS_ID) {
    char process_name[PATH_MAX];

    if (attach_info.GetExecutableFile().GetPath(process_name,
                                                sizeof(process_name))) {
      const bool wait_for_launch = attach_info.GetWaitForLaunch();

```

and then:

```
  if (attach_pid != LLDB_INVALID_PROCESS_ID) {
    error = WillAttachToProcessWithID(attach_pid);
    if (error.Success()) {
      m_public_run_lock.SetRunning();

      // Now attach using these arguments.
      m_should_detach = true;
      const bool restarted = false;
      SetPublicState(eStateAttaching, restarted);
      error = DoAttachToProcessWithID(attach_pid, attach_info);

```

so the help is wrong...

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


More information about the lldb-commits mailing list