summaryrefslogtreecommitdiff
path: root/source/API
diff options
context:
space:
mode:
Diffstat (limited to 'source/API')
-rw-r--r--source/API/SBProcess.cpp5
-rw-r--r--source/API/SBStructuredData.cpp44
-rw-r--r--source/API/SBThread.cpp11
-rw-r--r--source/API/SBTrace.cpp28
4 files changed, 65 insertions, 23 deletions
diff --git a/source/API/SBProcess.cpp b/source/API/SBProcess.cpp
index 8b79e521a371..caf07dbe3ce8 100644
--- a/source/API/SBProcess.cpp
+++ b/source/API/SBProcess.cpp
@@ -363,10 +363,9 @@ lldb::SBTrace SBProcess::StartTrace(SBTraceOptions &options,
if (!process_sp) {
error.SetErrorString("invalid process");
} else {
-
- uid = process_sp->StartTrace(options.m_traceoptions_sp, error.ref());
+ uid = process_sp->StartTrace(*(options.m_traceoptions_sp), error.ref());
trace_instance.SetTraceUID(uid);
- LLDB_LOG(log, "SBProcess::returned uid - %" PRIx64, uid);
+ LLDB_LOG(log, "SBProcess::returned uid - {0}", uid);
}
return trace_instance;
}
diff --git a/source/API/SBStructuredData.cpp b/source/API/SBStructuredData.cpp
index 971c4ab2295d..54022390b80f 100644
--- a/source/API/SBStructuredData.cpp
+++ b/source/API/SBStructuredData.cpp
@@ -46,7 +46,7 @@ lldb::SBError SBStructuredData::SetFromJSON(lldb::SBStream &stream) {
StructuredData::ObjectSP json_obj = StructuredData::ParseJSON(json_str);
m_impl_up->SetObjectSP(json_obj);
- if (!json_obj || json_obj->GetType() != StructuredData::Type::eTypeDictionary)
+ if (!json_obj || json_obj->GetType() != eStructuredDataTypeDictionary)
error.SetErrorString("Invalid Syntax");
return error;
}
@@ -67,3 +67,45 @@ lldb::SBError SBStructuredData::GetDescription(lldb::SBStream &stream) const {
sb_error.SetError(error);
return sb_error;
}
+
+StructuredDataType SBStructuredData::GetType() const {
+ return (m_impl_up ? m_impl_up->GetType() : eStructuredDataTypeInvalid);
+}
+
+size_t SBStructuredData::GetSize() const {
+ return (m_impl_up ? m_impl_up->GetSize() : 0);
+}
+
+lldb::SBStructuredData SBStructuredData::GetValueForKey(const char *key) const {
+ if (!m_impl_up)
+ return SBStructuredData();
+
+ SBStructuredData result;
+ result.m_impl_up->SetObjectSP(m_impl_up->GetValueForKey(key));
+ return result;
+}
+
+lldb::SBStructuredData SBStructuredData::GetItemAtIndex(size_t idx) const {
+ if (!m_impl_up)
+ return SBStructuredData();
+
+ SBStructuredData result;
+ result.m_impl_up->SetObjectSP(m_impl_up->GetItemAtIndex(idx));
+ return result;
+}
+
+uint64_t SBStructuredData::GetIntegerValue(uint64_t fail_value) const {
+ return (m_impl_up ? m_impl_up->GetIntegerValue(fail_value) : fail_value);
+}
+
+double SBStructuredData::GetFloatValue(double fail_value) const {
+ return (m_impl_up ? m_impl_up->GetFloatValue(fail_value) : fail_value);
+}
+
+bool SBStructuredData::GetBooleanValue(bool fail_value) const {
+ return (m_impl_up ? m_impl_up->GetBooleanValue(fail_value) : fail_value);
+}
+
+size_t SBStructuredData::GetStringValue(char *dst, size_t dst_len) const {
+ return (m_impl_up ? m_impl_up->GetStringValue(dst, dst_len) : 0);
+}
diff --git a/source/API/SBThread.cpp b/source/API/SBThread.cpp
index 2c82bc3bcdcf..65ccb465c8da 100644
--- a/source/API/SBThread.cpp
+++ b/source/API/SBThread.cpp
@@ -43,6 +43,7 @@
#include "lldb/API/SBThreadCollection.h"
#include "lldb/API/SBThreadPlan.h"
#include "lldb/API/SBValue.h"
+#include "lldb/lldb-enumerations.h"
using namespace lldb;
using namespace lldb_private;
@@ -561,26 +562,26 @@ bool SBThread::GetInfoItemByPathAsString(const char *path, SBStream &strm) {
StructuredData::ObjectSP node =
info_root_sp->GetObjectForDotSeparatedPath(path);
if (node) {
- if (node->GetType() == StructuredData::Type::eTypeString) {
+ if (node->GetType() == eStructuredDataTypeString) {
strm.Printf("%s", node->GetAsString()->GetValue().str().c_str());
success = true;
}
- if (node->GetType() == StructuredData::Type::eTypeInteger) {
+ if (node->GetType() == eStructuredDataTypeInteger) {
strm.Printf("0x%" PRIx64, node->GetAsInteger()->GetValue());
success = true;
}
- if (node->GetType() == StructuredData::Type::eTypeFloat) {
+ if (node->GetType() == eStructuredDataTypeFloat) {
strm.Printf("0x%f", node->GetAsFloat()->GetValue());
success = true;
}
- if (node->GetType() == StructuredData::Type::eTypeBoolean) {
+ if (node->GetType() == eStructuredDataTypeBoolean) {
if (node->GetAsBoolean()->GetValue() == true)
strm.Printf("true");
else
strm.Printf("false");
success = true;
}
- if (node->GetType() == StructuredData::Type::eTypeNull) {
+ if (node->GetType() == eStructuredDataTypeNull) {
strm.Printf("null");
success = true;
}
diff --git a/source/API/SBTrace.cpp b/source/API/SBTrace.cpp
index 18f7d36e7759..9a5fa4ed4f46 100644
--- a/source/API/SBTrace.cpp
+++ b/source/API/SBTrace.cpp
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/Utility/Log.h"
#include "lldb/Target/Process.h"
+#include "lldb/Utility/Log.h"
#include "lldb/API/SBTrace.h"
#include "lldb/API/SBTraceOptions.h"
@@ -25,37 +25,37 @@ lldb::ProcessSP SBTrace::GetSP() const { return m_opaque_wp.lock(); }
size_t SBTrace::GetTraceData(SBError &error, void *buf, size_t size,
size_t offset, lldb::tid_t thread_id) {
- size_t bytes_read = 0;
ProcessSP process_sp(GetSP());
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ llvm::MutableArrayRef<uint8_t> buffer(static_cast<uint8_t *>(buf), size);
error.Clear();
if (!process_sp) {
error.SetErrorString("invalid process");
} else {
- bytes_read = process_sp->GetData(GetTraceUID(), thread_id, error.ref(), buf,
- size, offset);
- LLDB_LOG(log, "SBTrace::bytes_read - %" PRIx64, bytes_read);
+ error.SetError(
+ process_sp->GetData(GetTraceUID(), thread_id, buffer, offset));
+ LLDB_LOG(log, "SBTrace::bytes_read - {0}", buffer.size());
}
- return bytes_read;
+ return buffer.size();
}
size_t SBTrace::GetMetaData(SBError &error, void *buf, size_t size,
size_t offset, lldb::tid_t thread_id) {
- size_t bytes_read = 0;
ProcessSP process_sp(GetSP());
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ llvm::MutableArrayRef<uint8_t> buffer(static_cast<uint8_t *>(buf), size);
error.Clear();
if (!process_sp) {
error.SetErrorString("invalid process");
} else {
- bytes_read = process_sp->GetMetaData(GetTraceUID(), thread_id, error.ref(),
- buf, size, offset);
- LLDB_LOG(log, "SBTrace::bytes_read - %" PRIx64, bytes_read);
+ error.SetError(
+ process_sp->GetMetaData(GetTraceUID(), thread_id, buffer, offset));
+ LLDB_LOG(log, "SBTrace::bytes_read - {0}", buffer.size());
}
- return bytes_read;
+ return buffer.size();
}
void SBTrace::StopTrace(SBError &error, lldb::tid_t thread_id) {
@@ -66,7 +66,7 @@ void SBTrace::StopTrace(SBError &error, lldb::tid_t thread_id) {
error.SetErrorString("invalid process");
return;
}
- process_sp->StopTrace(GetTraceUID(), thread_id, error.ref());
+ error.SetError(process_sp->StopTrace(GetTraceUID(), thread_id));
}
void SBTrace::GetTraceConfig(SBTraceOptions &options, SBError &error) {
@@ -76,8 +76,8 @@ void SBTrace::GetTraceConfig(SBTraceOptions &options, SBError &error) {
if (!process_sp) {
error.SetErrorString("invalid process");
} else {
- process_sp->GetTraceConfig(GetTraceUID(), error.ref(),
- options.m_traceoptions_sp);
+ error.SetError(process_sp->GetTraceConfig(GetTraceUID(),
+ *(options.m_traceoptions_sp)));
}
}