[Lldb-commits] [lldb] [lldb] Expose Platform::Attach through the SB API (PR #68050)
JDevlieghere wrote: Thank you @antmox and @DavidSpickett for following up on this. https://github.com/llvm/llvm-project/pull/68050 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Expose Platform::Attach through the SB API (PR #68050)
antmox wrote: Yes, thanks @DavidSpickett https://github.com/llvm/llvm-project/pull/68050 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Expose Platform::Attach through the SB API (PR #68050)
DavidSpickett wrote: I've skipped it entirely in https://github.com/llvm/llvm-project/commit/ceec9a7874af2eea8b00b5616fad388ccfa2b4f3. https://github.com/llvm/llvm-project/pull/68050 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Expose Platform::Attach through the SB API (PR #68050)
DavidSpickett wrote: @antmox You could remove the expected failure marker and see what the result is then. It will be less confusing. It may be that it does pass, but occasionally times out for another reason. Though that is weird given that all the server parts involved are mocks. https://github.com/llvm/llvm-project/pull/68050 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Expose Platform::Attach through the SB API (PR #68050)
antmox wrote: Hi! Could this commit cause the lldb-aarch64-windows bot failure ? https://lab.llvm.org/buildbot/#/builders/219/builds/6086 https://lab.llvm.org/buildbot/#/builders/219/builds/6076 Not sure if it's an unexpected pass or a timeout. Could you please take a look ? https://github.com/llvm/llvm-project/pull/68050 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Expose Platform::Attach through the SB API (PR #68050)
https://github.com/JDevlieghere closed https://github.com/llvm/llvm-project/pull/68050 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Expose Platform::Attach through the SB API (PR #68050)
https://github.com/bulbazord approved this pull request. Lgtm https://github.com/llvm/llvm-project/pull/68050 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Expose Platform::Attach through the SB API (PR #68050)
https://github.com/JDevlieghere updated https://github.com/llvm/llvm-project/pull/68050 >From c83435474699ba6ca5ff57bcb1dacaef0987f4b4 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Tue, 3 Oct 2023 08:41:01 -0700 Subject: [PATCH] [lldb] Expose Platform::Attach through the SB API Expose Platform::Attach through the SB API. rdar://116188959 --- lldb/include/lldb/API/SBAttachInfo.h | 1 + lldb/include/lldb/API/SBDebugger.h| 1 + lldb/include/lldb/API/SBPlatform.h| 5 ++ lldb/include/lldb/API/SBProcess.h | 1 + .../Python/lldbsuite/test/gdbclientutils.py | 6 ++ lldb/source/API/SBPlatform.cpp| 25 .../gdb_remote_client/TestPlatformAttach.py | 58 +++ 7 files changed, 97 insertions(+) create mode 100644 lldb/test/API/functionalities/gdb_remote_client/TestPlatformAttach.py diff --git a/lldb/include/lldb/API/SBAttachInfo.h b/lldb/include/lldb/API/SBAttachInfo.h index ea1145e625856f0..c18655fee77e0ac 100644 --- a/lldb/include/lldb/API/SBAttachInfo.h +++ b/lldb/include/lldb/API/SBAttachInfo.h @@ -197,6 +197,7 @@ class LLDB_API SBAttachInfo { protected: friend class SBTarget; + friend class SBPlatform; friend class lldb_private::ScriptInterpreter; diff --git a/lldb/include/lldb/API/SBDebugger.h b/lldb/include/lldb/API/SBDebugger.h index 29cf2c16fad4bd7..218113a7a391f35 100644 --- a/lldb/include/lldb/API/SBDebugger.h +++ b/lldb/include/lldb/API/SBDebugger.h @@ -487,6 +487,7 @@ class LLDB_API SBDebugger { friend class SBProcess; friend class SBSourceManager; friend class SBStructuredData; + friend class SBPlatform; friend class SBTarget; friend class SBTrace; diff --git a/lldb/include/lldb/API/SBPlatform.h b/lldb/include/lldb/API/SBPlatform.h index 6567277a5d161e7..e0acc7003a54bc3 100644 --- a/lldb/include/lldb/API/SBPlatform.h +++ b/lldb/include/lldb/API/SBPlatform.h @@ -10,6 +10,7 @@ #define LLDB_API_SBPLATFORM_H #include "lldb/API/SBDefines.h" +#include "lldb/API/SBProcess.h" #include @@ -18,6 +19,7 @@ struct PlatformShellCommand; namespace lldb { +class SBAttachInfo; class SBLaunchInfo; class LLDB_API SBPlatformConnectOptions { @@ -149,6 +151,9 @@ class LLDB_API SBPlatform { SBError Launch(SBLaunchInfo &launch_info); + SBProcess Attach(SBAttachInfo &attach_info, const SBDebugger &debugger, + SBTarget &target, SBError &error); + SBError Kill(const lldb::pid_t pid); SBError diff --git a/lldb/include/lldb/API/SBProcess.h b/lldb/include/lldb/API/SBProcess.h index 16527bb0291fcb4..8c1c81418f83d12 100644 --- a/lldb/include/lldb/API/SBProcess.h +++ b/lldb/include/lldb/API/SBProcess.h @@ -449,6 +449,7 @@ class LLDB_API SBProcess { friend class SBExecutionContext; friend class SBFunction; friend class SBModule; + friend class SBPlatform; friend class SBTarget; friend class SBThread; friend class SBValue; diff --git a/lldb/packages/Python/lldbsuite/test/gdbclientutils.py b/lldb/packages/Python/lldbsuite/test/gdbclientutils.py index a0104d36df8d903..1784487323ad6be 100644 --- a/lldb/packages/Python/lldbsuite/test/gdbclientutils.py +++ b/lldb/packages/Python/lldbsuite/test/gdbclientutils.py @@ -196,6 +196,9 @@ def respond(self, packet): return self.vFile(packet) if packet.startswith("vRun;"): return self.vRun(packet) +if packet.startswith("qLaunchGDBServer;"): +_, host = packet.partition(";")[2].split(":") +return self.qLaunchGDBServer(host) if packet.startswith("qLaunchSuccess"): return self.qLaunchSuccess() if packet.startswith("QEnvironment:"): @@ -329,6 +332,9 @@ def vFile(self, packet): def vRun(self, packet): return "" +def qLaunchGDBServer(self, host): +raise self.UnexpectedPacketException() + def qLaunchSuccess(self): return "" diff --git a/lldb/source/API/SBPlatform.cpp b/lldb/source/API/SBPlatform.cpp index f8300a5bab30e41..c31848fe04ea72c 100644 --- a/lldb/source/API/SBPlatform.cpp +++ b/lldb/source/API/SBPlatform.cpp @@ -7,12 +7,14 @@ //===--===// #include "lldb/API/SBPlatform.h" +#include "lldb/API/SBDebugger.h" #include "lldb/API/SBEnvironment.h" #include "lldb/API/SBError.h" #include "lldb/API/SBFileSpec.h" #include "lldb/API/SBLaunchInfo.h" #include "lldb/API/SBModuleSpec.h" #include "lldb/API/SBPlatform.h" +#include "lldb/API/SBTarget.h" #include "lldb/API/SBUnixSignals.h" #include "lldb/Host/File.h" #include "lldb/Target/Platform.h" @@ -574,6 +576,29 @@ SBError SBPlatform::Launch(SBLaunchInfo &launch_info) { }); } +SBProcess SBPlatform::Attach(SBAttachInfo &attach_info, + const SBDebugger &debugger, SBTarget &target, + SBError &error) { + LLDB_INSTRUMENT_VA(this, attach_info, debugger, target, error); + + if
[Lldb-commits] [lldb] [lldb] Expose Platform::Attach through the SB API (PR #68050)
@@ -574,6 +576,29 @@ SBError SBPlatform::Launch(SBLaunchInfo &launch_info) { }); } +SBProcess SBPlatform::Attach(SBAttachInfo &attach_info, + const SBDebugger &debugger, SBTarget &target, JDevlieghere wrote: - `attach_info` cannot be const because `Platform::Attach` also takes a non-cost `AttachInfo`. There's at least one place (`PlatformPOSIX::Attach`) that modifies the `attach_info`. - `target` is an out parameter so making that const would be confusing. https://github.com/llvm/llvm-project/pull/68050 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Expose Platform::Attach through the SB API (PR #68050)
https://github.com/medismailben approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/68050 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Expose Platform::Attach through the SB API (PR #68050)
https://github.com/bulbazord commented: Looks fine to me, but I want to really make sure we get this interface right. Left some comments inline. https://github.com/llvm/llvm-project/pull/68050 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Expose Platform::Attach through the SB API (PR #68050)
@@ -574,6 +576,29 @@ SBError SBPlatform::Launch(SBLaunchInfo &launch_info) { }); } +SBProcess SBPlatform::Attach(SBAttachInfo &attach_info, + const SBDebugger &debugger, SBTarget &target, + SBError &error) { + LLDB_INSTRUMENT_VA(this, attach_info); bulbazord wrote: This needs to instrument more things than just attach_info, right? https://github.com/llvm/llvm-project/pull/68050 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Expose Platform::Attach through the SB API (PR #68050)
@@ -574,6 +576,29 @@ SBError SBPlatform::Launch(SBLaunchInfo &launch_info) { }); } +SBProcess SBPlatform::Attach(SBAttachInfo &attach_info, + const SBDebugger &debugger, SBTarget &target, bulbazord wrote: I'd like to see the `attach_info` parameter marked const if possible, but it looks like `SBAttachInfo::ref` is not const. Maybe we can add an overload? I think that you can do `const SBTarget &target` without any further changes because `SBTarget::GetSP` is marked `const`. https://github.com/llvm/llvm-project/pull/68050 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Expose Platform::Attach through the SB API (PR #68050)
https://github.com/bulbazord edited https://github.com/llvm/llvm-project/pull/68050 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Expose Platform::Attach through the SB API (PR #68050)
@@ -19,6 +20,7 @@ struct PlatformShellCommand; namespace lldb { class SBLaunchInfo; +class SBAttachInfo; bulbazord wrote: sort https://github.com/llvm/llvm-project/pull/68050 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Expose Platform::Attach through the SB API (PR #68050)
llvmbot wrote: @llvm/pr-subscribers-lldb Changes Expose Platform::Attach through the SB API. rdar://116188959 --- Full diff: https://github.com/llvm/llvm-project/pull/68050.diff 7 Files Affected: - (modified) lldb/include/lldb/API/SBAttachInfo.h (+1) - (modified) lldb/include/lldb/API/SBDebugger.h (+1) - (modified) lldb/include/lldb/API/SBPlatform.h (+5) - (modified) lldb/include/lldb/API/SBProcess.h (+1) - (modified) lldb/packages/Python/lldbsuite/test/gdbclientutils.py (+6) - (modified) lldb/source/API/SBPlatform.cpp (+25) - (added) lldb/test/API/functionalities/gdb_remote_client/TestPlatformAttach.py (+58) ``diff diff --git a/lldb/include/lldb/API/SBAttachInfo.h b/lldb/include/lldb/API/SBAttachInfo.h index ea1145e625856f0..c18655fee77e0ac 100644 --- a/lldb/include/lldb/API/SBAttachInfo.h +++ b/lldb/include/lldb/API/SBAttachInfo.h @@ -197,6 +197,7 @@ class LLDB_API SBAttachInfo { protected: friend class SBTarget; + friend class SBPlatform; friend class lldb_private::ScriptInterpreter; diff --git a/lldb/include/lldb/API/SBDebugger.h b/lldb/include/lldb/API/SBDebugger.h index 29cf2c16fad4bd7..218113a7a391f35 100644 --- a/lldb/include/lldb/API/SBDebugger.h +++ b/lldb/include/lldb/API/SBDebugger.h @@ -487,6 +487,7 @@ class LLDB_API SBDebugger { friend class SBProcess; friend class SBSourceManager; friend class SBStructuredData; + friend class SBPlatform; friend class SBTarget; friend class SBTrace; diff --git a/lldb/include/lldb/API/SBPlatform.h b/lldb/include/lldb/API/SBPlatform.h index 6567277a5d161e7..614ee3202def5bc 100644 --- a/lldb/include/lldb/API/SBPlatform.h +++ b/lldb/include/lldb/API/SBPlatform.h @@ -10,6 +10,7 @@ #define LLDB_API_SBPLATFORM_H #include "lldb/API/SBDefines.h" +#include "lldb/API/SBProcess.h" #include @@ -19,6 +20,7 @@ struct PlatformShellCommand; namespace lldb { class SBLaunchInfo; +class SBAttachInfo; class LLDB_API SBPlatformConnectOptions { public: @@ -149,6 +151,9 @@ class LLDB_API SBPlatform { SBError Launch(SBLaunchInfo &launch_info); + SBProcess Attach(SBAttachInfo &attach_info, const SBDebugger &debugger, + SBTarget &target, SBError &error); + SBError Kill(const lldb::pid_t pid); SBError diff --git a/lldb/include/lldb/API/SBProcess.h b/lldb/include/lldb/API/SBProcess.h index 16527bb0291fcb4..8c1c81418f83d12 100644 --- a/lldb/include/lldb/API/SBProcess.h +++ b/lldb/include/lldb/API/SBProcess.h @@ -449,6 +449,7 @@ class LLDB_API SBProcess { friend class SBExecutionContext; friend class SBFunction; friend class SBModule; + friend class SBPlatform; friend class SBTarget; friend class SBThread; friend class SBValue; diff --git a/lldb/packages/Python/lldbsuite/test/gdbclientutils.py b/lldb/packages/Python/lldbsuite/test/gdbclientutils.py index a0104d36df8d903..1784487323ad6be 100644 --- a/lldb/packages/Python/lldbsuite/test/gdbclientutils.py +++ b/lldb/packages/Python/lldbsuite/test/gdbclientutils.py @@ -196,6 +196,9 @@ def respond(self, packet): return self.vFile(packet) if packet.startswith("vRun;"): return self.vRun(packet) +if packet.startswith("qLaunchGDBServer;"): +_, host = packet.partition(";")[2].split(":") +return self.qLaunchGDBServer(host) if packet.startswith("qLaunchSuccess"): return self.qLaunchSuccess() if packet.startswith("QEnvironment:"): @@ -329,6 +332,9 @@ def vFile(self, packet): def vRun(self, packet): return "" +def qLaunchGDBServer(self, host): +raise self.UnexpectedPacketException() + def qLaunchSuccess(self): return "" diff --git a/lldb/source/API/SBPlatform.cpp b/lldb/source/API/SBPlatform.cpp index f8300a5bab30e41..7dfbb1373989c02 100644 --- a/lldb/source/API/SBPlatform.cpp +++ b/lldb/source/API/SBPlatform.cpp @@ -7,12 +7,14 @@ //===--===// #include "lldb/API/SBPlatform.h" +#include "lldb/API/SBDebugger.h" #include "lldb/API/SBEnvironment.h" #include "lldb/API/SBError.h" #include "lldb/API/SBFileSpec.h" #include "lldb/API/SBLaunchInfo.h" #include "lldb/API/SBModuleSpec.h" #include "lldb/API/SBPlatform.h" +#include "lldb/API/SBTarget.h" #include "lldb/API/SBUnixSignals.h" #include "lldb/Host/File.h" #include "lldb/Target/Platform.h" @@ -574,6 +576,29 @@ SBError SBPlatform::Launch(SBLaunchInfo &launch_info) { }); } +SBProcess SBPlatform::Attach(SBAttachInfo &attach_info, + const SBDebugger &debugger, SBTarget &target, + SBError &error) { + LLDB_INSTRUMENT_VA(this, attach_info); + + if (PlatformSP platform_sp = GetSP()) { +if (platform_sp->IsConnected()) { + ProcessAttachInfo &info = attach_info.ref(); + Status status; + ProcessSP process_sp = platform_sp->Attach(info, debugger.ref(), +
[Lldb-commits] [lldb] [lldb] Expose Platform::Attach through the SB API (PR #68050)
https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/68050 Expose Platform::Attach through the SB API. rdar://116188959 >From 6cf631f5acf3eb18e7cf12a2b996c9f974a360e2 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Sun, 1 Oct 2023 20:48:50 -0700 Subject: [PATCH] [lldb] Expose Platform::Attach through the SB API Expose Platform::Attach through the SB API. rdar://116188959 --- lldb/include/lldb/API/SBAttachInfo.h | 1 + lldb/include/lldb/API/SBDebugger.h| 1 + lldb/include/lldb/API/SBPlatform.h| 5 ++ lldb/include/lldb/API/SBProcess.h | 1 + .../Python/lldbsuite/test/gdbclientutils.py | 6 ++ lldb/source/API/SBPlatform.cpp| 25 .../gdb_remote_client/TestPlatformAttach.py | 58 +++ 7 files changed, 97 insertions(+) create mode 100644 lldb/test/API/functionalities/gdb_remote_client/TestPlatformAttach.py diff --git a/lldb/include/lldb/API/SBAttachInfo.h b/lldb/include/lldb/API/SBAttachInfo.h index ea1145e625856f0..c18655fee77e0ac 100644 --- a/lldb/include/lldb/API/SBAttachInfo.h +++ b/lldb/include/lldb/API/SBAttachInfo.h @@ -197,6 +197,7 @@ class LLDB_API SBAttachInfo { protected: friend class SBTarget; + friend class SBPlatform; friend class lldb_private::ScriptInterpreter; diff --git a/lldb/include/lldb/API/SBDebugger.h b/lldb/include/lldb/API/SBDebugger.h index 29cf2c16fad4bd7..218113a7a391f35 100644 --- a/lldb/include/lldb/API/SBDebugger.h +++ b/lldb/include/lldb/API/SBDebugger.h @@ -487,6 +487,7 @@ class LLDB_API SBDebugger { friend class SBProcess; friend class SBSourceManager; friend class SBStructuredData; + friend class SBPlatform; friend class SBTarget; friend class SBTrace; diff --git a/lldb/include/lldb/API/SBPlatform.h b/lldb/include/lldb/API/SBPlatform.h index 6567277a5d161e7..614ee3202def5bc 100644 --- a/lldb/include/lldb/API/SBPlatform.h +++ b/lldb/include/lldb/API/SBPlatform.h @@ -10,6 +10,7 @@ #define LLDB_API_SBPLATFORM_H #include "lldb/API/SBDefines.h" +#include "lldb/API/SBProcess.h" #include @@ -19,6 +20,7 @@ struct PlatformShellCommand; namespace lldb { class SBLaunchInfo; +class SBAttachInfo; class LLDB_API SBPlatformConnectOptions { public: @@ -149,6 +151,9 @@ class LLDB_API SBPlatform { SBError Launch(SBLaunchInfo &launch_info); + SBProcess Attach(SBAttachInfo &attach_info, const SBDebugger &debugger, + SBTarget &target, SBError &error); + SBError Kill(const lldb::pid_t pid); SBError diff --git a/lldb/include/lldb/API/SBProcess.h b/lldb/include/lldb/API/SBProcess.h index 16527bb0291fcb4..8c1c81418f83d12 100644 --- a/lldb/include/lldb/API/SBProcess.h +++ b/lldb/include/lldb/API/SBProcess.h @@ -449,6 +449,7 @@ class LLDB_API SBProcess { friend class SBExecutionContext; friend class SBFunction; friend class SBModule; + friend class SBPlatform; friend class SBTarget; friend class SBThread; friend class SBValue; diff --git a/lldb/packages/Python/lldbsuite/test/gdbclientutils.py b/lldb/packages/Python/lldbsuite/test/gdbclientutils.py index a0104d36df8d903..1784487323ad6be 100644 --- a/lldb/packages/Python/lldbsuite/test/gdbclientutils.py +++ b/lldb/packages/Python/lldbsuite/test/gdbclientutils.py @@ -196,6 +196,9 @@ def respond(self, packet): return self.vFile(packet) if packet.startswith("vRun;"): return self.vRun(packet) +if packet.startswith("qLaunchGDBServer;"): +_, host = packet.partition(";")[2].split(":") +return self.qLaunchGDBServer(host) if packet.startswith("qLaunchSuccess"): return self.qLaunchSuccess() if packet.startswith("QEnvironment:"): @@ -329,6 +332,9 @@ def vFile(self, packet): def vRun(self, packet): return "" +def qLaunchGDBServer(self, host): +raise self.UnexpectedPacketException() + def qLaunchSuccess(self): return "" diff --git a/lldb/source/API/SBPlatform.cpp b/lldb/source/API/SBPlatform.cpp index f8300a5bab30e41..7dfbb1373989c02 100644 --- a/lldb/source/API/SBPlatform.cpp +++ b/lldb/source/API/SBPlatform.cpp @@ -7,12 +7,14 @@ //===--===// #include "lldb/API/SBPlatform.h" +#include "lldb/API/SBDebugger.h" #include "lldb/API/SBEnvironment.h" #include "lldb/API/SBError.h" #include "lldb/API/SBFileSpec.h" #include "lldb/API/SBLaunchInfo.h" #include "lldb/API/SBModuleSpec.h" #include "lldb/API/SBPlatform.h" +#include "lldb/API/SBTarget.h" #include "lldb/API/SBUnixSignals.h" #include "lldb/Host/File.h" #include "lldb/Target/Platform.h" @@ -574,6 +576,29 @@ SBError SBPlatform::Launch(SBLaunchInfo &launch_info) { }); } +SBProcess SBPlatform::Attach(SBAttachInfo &attach_info, + const SBDebugger &debugger, SBTarget &target, + SBError &error) { + L