================
@@ -762,9 +765,31 @@ void request_attach(const llvm::json::Object &request) {
     // Disable async events so the attach will be successful when we return 
from
     // the launch call and the launch will happen synchronously
     g_dap.debugger.SetAsync(false);
-    if (core_file.empty())
-      g_dap.target.Attach(attach_info, error);
-    else
+    if (core_file.empty()) {
+      if ((pid != LLDB_INVALID_PROCESS_ID) &&
+          (port != LLDB_INVALID_PORT_NUMBER)) {
+        // If both pid and port numbers are specified.
+        error.SetErrorString("The user can't specify both pid and port");
+      } else if ((port != LLDB_INVALID_PORT_NUMBER) && (port < UINT16_MAX)) {
----------------
walter-erquinigo wrote:

Remove `(port < UINT16_MAX)` so that we get a meaningful error from the 
connection logic. 

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

Reply via email to