2015-02-16 08:04:19 +08:00
|
|
|
//===-- SBAttachInfo.cpp ----------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "lldb/API/SBAttachInfo.h"
|
|
|
|
|
|
|
|
#include "lldb/API/SBFileSpec.h"
|
|
|
|
#include "lldb/API/SBListener.h"
|
|
|
|
#include "lldb/Target/Process.h"
|
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
SBAttachInfo::SBAttachInfo() : m_opaque_sp(new ProcessAttachInfo()) {}
|
2015-02-16 08:04:19 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
SBAttachInfo::SBAttachInfo(lldb::pid_t pid)
|
|
|
|
: m_opaque_sp(new ProcessAttachInfo()) {
|
|
|
|
m_opaque_sp->SetProcessID(pid);
|
2015-02-16 08:04:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
SBAttachInfo::SBAttachInfo(const char *path, bool wait_for)
|
|
|
|
: m_opaque_sp(new ProcessAttachInfo()) {
|
|
|
|
if (path && path[0])
|
2018-11-02 05:05:36 +08:00
|
|
|
m_opaque_sp->GetExecutableFile().SetFile(path, FileSpec::Style::native);
|
2016-09-07 04:57:50 +08:00
|
|
|
m_opaque_sp->SetWaitForLaunch(wait_for);
|
2015-02-16 08:04:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
SBAttachInfo::SBAttachInfo(const char *path, bool wait_for, bool async)
|
|
|
|
: m_opaque_sp(new ProcessAttachInfo()) {
|
|
|
|
if (path && path[0])
|
2018-11-02 05:05:36 +08:00
|
|
|
m_opaque_sp->GetExecutableFile().SetFile(path, FileSpec::Style::native);
|
2016-09-07 04:57:50 +08:00
|
|
|
m_opaque_sp->SetWaitForLaunch(wait_for);
|
|
|
|
m_opaque_sp->SetAsync(async);
|
2015-02-16 08:04:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
SBAttachInfo::SBAttachInfo(const SBAttachInfo &rhs)
|
|
|
|
: m_opaque_sp(new ProcessAttachInfo()) {
|
|
|
|
*m_opaque_sp = *rhs.m_opaque_sp;
|
2015-10-06 06:58:37 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
SBAttachInfo::~SBAttachInfo() {}
|
2015-02-16 08:04:19 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb_private::ProcessAttachInfo &SBAttachInfo::ref() { return *m_opaque_sp; }
|
2015-02-16 08:04:19 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
SBAttachInfo &SBAttachInfo::operator=(const SBAttachInfo &rhs) {
|
|
|
|
if (this != &rhs)
|
|
|
|
*m_opaque_sp = *rhs.m_opaque_sp;
|
|
|
|
return *this;
|
2015-02-16 08:04:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb::pid_t SBAttachInfo::GetProcessID() { return m_opaque_sp->GetProcessID(); }
|
2015-02-16 08:04:19 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void SBAttachInfo::SetProcessID(lldb::pid_t pid) {
|
|
|
|
m_opaque_sp->SetProcessID(pid);
|
2015-02-16 08:04:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
uint32_t SBAttachInfo::GetResumeCount() {
|
|
|
|
return m_opaque_sp->GetResumeCount();
|
2015-02-16 08:04:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void SBAttachInfo::SetResumeCount(uint32_t c) {
|
|
|
|
m_opaque_sp->SetResumeCount(c);
|
2015-02-16 08:04:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
const char *SBAttachInfo::GetProcessPluginName() {
|
|
|
|
return m_opaque_sp->GetProcessPluginName();
|
2015-02-16 08:04:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void SBAttachInfo::SetProcessPluginName(const char *plugin_name) {
|
|
|
|
return m_opaque_sp->SetProcessPluginName(plugin_name);
|
2015-02-16 08:04:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void SBAttachInfo::SetExecutable(const char *path) {
|
|
|
|
if (path && path[0])
|
2018-11-02 05:05:36 +08:00
|
|
|
m_opaque_sp->GetExecutableFile().SetFile(path, FileSpec::Style::native);
|
2016-09-07 04:57:50 +08:00
|
|
|
else
|
|
|
|
m_opaque_sp->GetExecutableFile().Clear();
|
2015-02-16 08:04:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void SBAttachInfo::SetExecutable(SBFileSpec exe_file) {
|
|
|
|
if (exe_file.IsValid())
|
|
|
|
m_opaque_sp->GetExecutableFile() = exe_file.ref();
|
|
|
|
else
|
|
|
|
m_opaque_sp->GetExecutableFile().Clear();
|
2015-02-16 08:04:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
bool SBAttachInfo::GetWaitForLaunch() {
|
|
|
|
return m_opaque_sp->GetWaitForLaunch();
|
2015-02-16 08:04:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void SBAttachInfo::SetWaitForLaunch(bool b) {
|
|
|
|
m_opaque_sp->SetWaitForLaunch(b);
|
2015-02-16 08:04:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void SBAttachInfo::SetWaitForLaunch(bool b, bool async) {
|
|
|
|
m_opaque_sp->SetWaitForLaunch(b);
|
|
|
|
m_opaque_sp->SetAsync(async);
|
2015-10-06 06:58:37 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
bool SBAttachInfo::GetIgnoreExisting() {
|
|
|
|
return m_opaque_sp->GetIgnoreExisting();
|
2015-02-16 08:04:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void SBAttachInfo::SetIgnoreExisting(bool b) {
|
|
|
|
m_opaque_sp->SetIgnoreExisting(b);
|
2015-02-16 08:04:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
uint32_t SBAttachInfo::GetUserID() { return m_opaque_sp->GetUserID(); }
|
2015-02-16 08:04:19 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
uint32_t SBAttachInfo::GetGroupID() { return m_opaque_sp->GetGroupID(); }
|
2015-02-16 08:04:19 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
bool SBAttachInfo::UserIDIsValid() { return m_opaque_sp->UserIDIsValid(); }
|
2015-02-16 08:04:19 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
bool SBAttachInfo::GroupIDIsValid() { return m_opaque_sp->GroupIDIsValid(); }
|
2015-02-16 08:04:19 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void SBAttachInfo::SetUserID(uint32_t uid) { m_opaque_sp->SetUserID(uid); }
|
2015-02-16 08:04:19 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void SBAttachInfo::SetGroupID(uint32_t gid) { m_opaque_sp->SetGroupID(gid); }
|
2015-02-16 08:04:19 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
uint32_t SBAttachInfo::GetEffectiveUserID() {
|
|
|
|
return m_opaque_sp->GetEffectiveUserID();
|
2015-02-16 08:04:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
uint32_t SBAttachInfo::GetEffectiveGroupID() {
|
|
|
|
return m_opaque_sp->GetEffectiveGroupID();
|
2015-02-16 08:04:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
bool SBAttachInfo::EffectiveUserIDIsValid() {
|
|
|
|
return m_opaque_sp->EffectiveUserIDIsValid();
|
2015-02-16 08:04:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
bool SBAttachInfo::EffectiveGroupIDIsValid() {
|
|
|
|
return m_opaque_sp->EffectiveGroupIDIsValid();
|
2015-02-16 08:04:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void SBAttachInfo::SetEffectiveUserID(uint32_t uid) {
|
|
|
|
m_opaque_sp->SetEffectiveUserID(uid);
|
2015-02-16 08:04:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void SBAttachInfo::SetEffectiveGroupID(uint32_t gid) {
|
|
|
|
m_opaque_sp->SetEffectiveGroupID(gid);
|
2015-02-16 08:04:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb::pid_t SBAttachInfo::GetParentProcessID() {
|
|
|
|
return m_opaque_sp->GetParentProcessID();
|
2015-02-16 08:04:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void SBAttachInfo::SetParentProcessID(lldb::pid_t pid) {
|
|
|
|
m_opaque_sp->SetParentProcessID(pid);
|
2015-02-16 08:04:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
bool SBAttachInfo::ParentProcessIDIsValid() {
|
|
|
|
return m_opaque_sp->ParentProcessIDIsValid();
|
2015-02-16 08:04:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
SBListener SBAttachInfo::GetListener() {
|
|
|
|
return SBListener(m_opaque_sp->GetListener());
|
2015-02-16 08:04:19 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void SBAttachInfo::SetListener(SBListener &listener) {
|
|
|
|
m_opaque_sp->SetListener(listener.GetSP());
|
2015-02-16 08:04:19 +08:00
|
|
|
}
|