summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/tools/lldb/source/API/SBProcess.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/tools/lldb/source/API/SBProcess.cpp')
-rw-r--r--contrib/llvm/tools/lldb/source/API/SBProcess.cpp49
1 files changed, 41 insertions, 8 deletions
diff --git a/contrib/llvm/tools/lldb/source/API/SBProcess.cpp b/contrib/llvm/tools/lldb/source/API/SBProcess.cpp
index 59dd569..caf07db 100644
--- a/contrib/llvm/tools/lldb/source/API/SBProcess.cpp
+++ b/contrib/llvm/tools/lldb/source/API/SBProcess.cpp
@@ -16,11 +16,9 @@
#include "lldb/lldb-types.h"
#include "lldb/Core/Debugger.h"
-#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/State.h"
-#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Target/MemoryRegionInfo.h"
@@ -29,6 +27,8 @@
#include "lldb/Target/SystemRuntime.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Stream.h"
// Project includes
@@ -44,6 +44,8 @@
#include "lldb/API/SBStructuredData.h"
#include "lldb/API/SBThread.h"
#include "lldb/API/SBThreadCollection.h"
+#include "lldb/API/SBTrace.h"
+#include "lldb/API/SBTraceOptions.h"
#include "lldb/API/SBUnixSignals.h"
using namespace lldb;
@@ -279,7 +281,7 @@ size_t SBProcess::PutSTDIN(const char *src, size_t src_len) {
size_t ret_val = 0;
ProcessSP process_sp(GetSP());
if (process_sp) {
- Error error;
+ Status error;
ret_val = process_sp->PutSTDIN(src, src_len, error);
}
@@ -296,7 +298,7 @@ size_t SBProcess::GetSTDOUT(char *dst, size_t dst_len) const {
size_t bytes_read = 0;
ProcessSP process_sp(GetSP());
if (process_sp) {
- Error error;
+ Status error;
bytes_read = process_sp->GetSTDOUT(dst, dst_len, error);
}
@@ -315,7 +317,7 @@ size_t SBProcess::GetSTDERR(char *dst, size_t dst_len) const {
size_t bytes_read = 0;
ProcessSP process_sp(GetSP());
if (process_sp) {
- Error error;
+ Status error;
bytes_read = process_sp->GetSTDERR(dst, dst_len, error);
}
@@ -334,7 +336,7 @@ size_t SBProcess::GetAsyncProfileData(char *dst, size_t dst_len) const {
size_t bytes_read = 0;
ProcessSP process_sp(GetSP());
if (process_sp) {
- Error error;
+ Status error;
bytes_read = process_sp->GetAsyncProfileData(dst, dst_len, error);
}
@@ -349,6 +351,25 @@ size_t SBProcess::GetAsyncProfileData(char *dst, size_t dst_len) const {
return bytes_read;
}
+lldb::SBTrace SBProcess::StartTrace(SBTraceOptions &options,
+ lldb::SBError &error) {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ ProcessSP process_sp(GetSP());
+ error.Clear();
+ SBTrace trace_instance;
+ trace_instance.SetSP(process_sp);
+ lldb::user_id_t uid = LLDB_INVALID_UID;
+
+ if (!process_sp) {
+ error.SetErrorString("invalid process");
+ } else {
+ uid = process_sp->StartTrace(*(options.m_traceoptions_sp), error.ref());
+ trace_instance.SetTraceUID(uid);
+ LLDB_LOG(log, "SBProcess::returned uid - {0}", uid);
+ }
+ return trace_instance;
+}
+
void SBProcess::ReportEventState(const SBEvent &event, FILE *out) const {
if (out == NULL)
return;
@@ -1135,22 +1156,34 @@ uint32_t SBProcess::LoadImage(lldb::SBFileSpec &sb_remote_image_spec,
uint32_t SBProcess::LoadImage(const lldb::SBFileSpec &sb_local_image_spec,
const lldb::SBFileSpec &sb_remote_image_spec,
lldb::SBError &sb_error) {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
ProcessSP process_sp(GetSP());
if (process_sp) {
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&process_sp->GetRunLock())) {
+ if (log)
+ log->Printf("SBProcess(%p)::LoadImage() => calling Platform::LoadImage"
+ "for: %s",
+ static_cast<void *>(process_sp.get()),
+ sb_local_image_spec.GetFilename());
+
std::lock_guard<std::recursive_mutex> guard(
- process_sp->GetTarget().GetAPIMutex());
+ process_sp->GetTarget().GetAPIMutex());
PlatformSP platform_sp = process_sp->GetTarget().GetPlatform();
return platform_sp->LoadImage(process_sp.get(), *sb_local_image_spec,
*sb_remote_image_spec, sb_error.ref());
} else {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
if (log)
log->Printf("SBProcess(%p)::LoadImage() => error: process is running",
static_cast<void *>(process_sp.get()));
sb_error.SetErrorString("process is running");
}
+ } else {
+ if (log)
+ log->Printf("SBProcess(%p)::LoadImage() => error: called with invalid"
+ " process",
+ static_cast<void *>(process_sp.get()));
+ sb_error.SetErrorString("process is invalid");
}
return LLDB_INVALID_IMAGE_TOKEN;
}
OpenPOWER on IntegriCloud