diff options
Diffstat (limited to 'lldb/source/API/SBLaunchInfo.cpp')
-rw-r--r-- | lldb/source/API/SBLaunchInfo.cpp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/lldb/source/API/SBLaunchInfo.cpp b/lldb/source/API/SBLaunchInfo.cpp index cda8134c9853..70cd1c6ecf74 100644 --- a/lldb/source/API/SBLaunchInfo.cpp +++ b/lldb/source/API/SBLaunchInfo.cpp @@ -10,8 +10,12 @@ #include "SBReproducerPrivate.h" #include "lldb/API/SBEnvironment.h" +#include "lldb/API/SBError.h" #include "lldb/API/SBFileSpec.h" #include "lldb/API/SBListener.h" +#include "lldb/API/SBStream.h" +#include "lldb/API/SBStructuredData.h" +#include "lldb/Core/StructuredDataImpl.h" #include "lldb/Host/ProcessLaunchInfo.h" using namespace lldb; @@ -343,6 +347,53 @@ bool SBLaunchInfo::GetDetachOnError() const { return m_opaque_sp->GetDetachOnError(); } +const char *SBLaunchInfo::GetScriptedProcessClassName() const { + LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBLaunchInfo, + GetScriptedProcessClassName); + + // Constify this string so that it is saved in the string pool. Otherwise it + // would be freed when this function goes out of scope. + ConstString class_name(m_opaque_sp->GetScriptedProcessClassName().c_str()); + return class_name.AsCString(); +} + +void SBLaunchInfo::SetScriptedProcessClassName(const char *class_name) { + LLDB_RECORD_METHOD(void, SBLaunchInfo, SetScriptedProcessClassName, + (const char *), class_name); + + m_opaque_sp->SetScriptedProcessClassName(class_name); +} + +lldb::SBStructuredData SBLaunchInfo::GetScriptedProcessDictionary() const { + LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBStructuredData, SBLaunchInfo, + GetScriptedProcessDictionary); + + lldb_private::StructuredData::DictionarySP dict_sp = + m_opaque_sp->GetScriptedProcessDictionarySP(); + + SBStructuredData data; + data.m_impl_up->SetObjectSP(dict_sp); + + return LLDB_RECORD_RESULT(data); +} + +void SBLaunchInfo::SetScriptedProcessDictionary(lldb::SBStructuredData dict) { + LLDB_RECORD_METHOD(void, SBLaunchInfo, SetScriptedProcessDictionary, + (lldb::SBStructuredData), dict); + + SBStream stream; + SBError error = dict.GetAsJSON(stream); + + if (error.Fail()) + return; + + StructuredData::DictionarySP dict_sp; + llvm::json::OStream s(stream.ref().AsRawOstream()); + dict_sp->Serialize(s); + + m_opaque_sp->SetScriptedProcessDictionarySP(dict_sp); +} + namespace lldb_private { namespace repro { @@ -403,6 +454,14 @@ void RegisterMethods<SBLaunchInfo>(Registry &R) { ()); LLDB_REGISTER_METHOD(void, SBLaunchInfo, SetDetachOnError, (bool)); LLDB_REGISTER_METHOD_CONST(bool, SBLaunchInfo, GetDetachOnError, ()); + LLDB_REGISTER_METHOD_CONST(const char *, SBLaunchInfo, + GetScriptedProcessClassName, ()); + LLDB_REGISTER_METHOD(void, SBLaunchInfo, SetScriptedProcessClassName, + (const char *)); + LLDB_REGISTER_METHOD_CONST(lldb::SBStructuredData, SBLaunchInfo, + GetScriptedProcessDictionary, ()); + LLDB_REGISTER_METHOD(void, SBLaunchInfo, SetScriptedProcessDictionary, + (lldb::SBStructuredData)); LLDB_REGISTER_METHOD(void, SBLaunchInfo, SetEnvironment, (const lldb::SBEnvironment &, bool)); LLDB_REGISTER_METHOD(lldb::SBEnvironment, SBLaunchInfo, GetEnvironment, ()); |