llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-lldb Author: Jonas Devlieghere (JDevlieghere) <details> <summary>Changes</summary> When connected to a GDB remote platform, we always use "gdb-remote" as the process plugin when attaching. This means that the `--plugin` argument to `process attach` is effectively ignored. This patch makes it so that "gdb-remote" remains the default, while still honoring the process plugin name specified in the attach info. rdar://167845923 --- Full diff: https://github.com/llvm/llvm-project/pull/175195.diff 2 Files Affected: - (modified) lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp (+10-3) - (modified) lldb/test/API/functionalities/gdb_remote_client/TestPlatformAttach.py (+2) ``````````diff diff --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp index 4a77423bac526..a4f9036bf2f0c 100644 --- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp +++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp @@ -505,11 +505,18 @@ lldb::ProcessSP PlatformRemoteGDBServer::Attach( error.Clear(); if (target && error.Success()) { - // The darwin always currently uses the GDB remote debugger plug-in - // so even when debugging locally we are debugging remotely! + // By default, we always use the GDB remote debugger plug-in. + // Even when debugging locally, we are debugging remotely. + llvm::StringRef process_plugin = "gdb-remote"; + + // However, if a process plugin is specified by the attach info, we + // should honor it. + if (!attach_info.GetProcessPluginName().empty()) + process_plugin = attach_info.GetProcessPluginName(); + process_sp = target->CreateProcess(attach_info.GetListenerForProcess(debugger), - "gdb-remote", nullptr, true); + process_plugin, nullptr, true); if (process_sp) { error = process_sp->ConnectRemote(connect_url.c_str()); if (error.Success()) { diff --git a/lldb/test/API/functionalities/gdb_remote_client/TestPlatformAttach.py b/lldb/test/API/functionalities/gdb_remote_client/TestPlatformAttach.py index 3aeb87874bdfa..ea7baecc2e3be 100644 --- a/lldb/test/API/functionalities/gdb_remote_client/TestPlatformAttach.py +++ b/lldb/test/API/functionalities/gdb_remote_client/TestPlatformAttach.py @@ -49,10 +49,12 @@ def vAttach(self, _): attach_info = lldb.SBAttachInfo() attach_info.SetExecutable("foo") + attach_info.SetProcessPluginName("wasm") target = lldb.SBTarget() process = platform.Attach(attach_info, self.dbg, target, error) self.assertSuccess(error) self.assertEqual(process.GetProcessID(), 95117) + self.assertEqual(process.GetPluginName(), "wasm") platform.DisconnectRemote() `````````` </details> https://github.com/llvm/llvm-project/pull/175195 _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
