diff options
Diffstat (limited to 'contrib/llvm-project/lldb/source/API/SBPlatform.cpp')
| -rw-r--r-- | contrib/llvm-project/lldb/source/API/SBPlatform.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/contrib/llvm-project/lldb/source/API/SBPlatform.cpp b/contrib/llvm-project/lldb/source/API/SBPlatform.cpp index f8300a5bab30..3623fd35bcdf 100644 --- a/contrib/llvm-project/lldb/source/API/SBPlatform.cpp +++ b/contrib/llvm-project/lldb/source/API/SBPlatform.cpp @@ -7,12 +7,15 @@ //===----------------------------------------------------------------------===// #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/SBProcessInfoList.h" +#include "lldb/API/SBTarget.h" #include "lldb/API/SBUnixSignals.h" #include "lldb/Host/File.h" #include "lldb/Target/Platform.h" @@ -574,6 +577,43 @@ 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 (PlatformSP platform_sp = GetSP()) { + if (platform_sp->IsConnected()) { + ProcessAttachInfo &info = attach_info.ref(); + Status status; + ProcessSP process_sp = platform_sp->Attach(info, debugger.ref(), + target.GetSP().get(), status); + error.SetError(status); + return SBProcess(process_sp); + } + + error.SetErrorString("not connected"); + return {}; + } + + error.SetErrorString("invalid platform"); + return {}; +} + +SBProcessInfoList SBPlatform::GetAllProcesses(SBError &error) { + if (PlatformSP platform_sp = GetSP()) { + if (platform_sp->IsConnected()) { + ProcessInstanceInfoList list = platform_sp->GetAllProcesses(); + return SBProcessInfoList(list); + } + error.SetErrorString("not connected"); + return {}; + } + + error.SetErrorString("invalid platform"); + return {}; +} + SBError SBPlatform::Kill(const lldb::pid_t pid) { LLDB_INSTRUMENT_VA(this, pid); return ExecuteConnected([&](const lldb::PlatformSP &platform_sp) { |
