aboutsummaryrefslogtreecommitdiffstats
path: root/source/API/SBProcess.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/API/SBProcess.cpp')
-rw-r--r--source/API/SBProcess.cpp34
1 files changed, 26 insertions, 8 deletions
diff --git a/source/API/SBProcess.cpp b/source/API/SBProcess.cpp
index 4226ff77ecdc..45aaa0bd2d8a 100644
--- a/source/API/SBProcess.cpp
+++ b/source/API/SBProcess.cpp
@@ -29,11 +29,11 @@
#include "lldb/Utility/State.h"
#include "lldb/Utility/Stream.h"
-
#include "lldb/API/SBBroadcaster.h"
#include "lldb/API/SBCommandReturnObject.h"
#include "lldb/API/SBDebugger.h"
#include "lldb/API/SBEvent.h"
+#include "lldb/API/SBFile.h"
#include "lldb/API/SBFileSpec.h"
#include "lldb/API/SBMemoryRegionInfo.h"
#include "lldb/API/SBMemoryRegionInfoList.h"
@@ -331,23 +331,34 @@ lldb::SBTrace SBProcess::StartTrace(SBTraceOptions &options,
return LLDB_RECORD_RESULT(trace_instance);
}
+void SBProcess::ReportEventState(const SBEvent &event, SBFile out) const {
+ LLDB_RECORD_METHOD_CONST(void, SBProcess, ReportEventState,
+ (const SBEvent &, SBFile), event, out);
+
+ return ReportEventState(event, out.m_opaque_sp);
+}
+
void SBProcess::ReportEventState(const SBEvent &event, FILE *out) const {
LLDB_RECORD_METHOD_CONST(void, SBProcess, ReportEventState,
(const lldb::SBEvent &, FILE *), event, out);
+ FileSP outfile = std::make_shared<NativeFile>(out, false);
+ return ReportEventState(event, outfile);
+}
+
+void SBProcess::ReportEventState(const SBEvent &event, FileSP out) const {
+
+ LLDB_RECORD_METHOD_CONST(void, SBProcess, ReportEventState,
+ (const SBEvent &, FileSP), event, out);
- if (out == nullptr)
+ if (!out || !out->IsValid())
return;
ProcessSP process_sp(GetSP());
if (process_sp) {
+ StreamFile stream(out);
const StateType event_state = SBProcess::GetStateFromEvent(event);
- char message[1024];
- int message_len = ::snprintf(
- message, sizeof(message), "Process %" PRIu64 " %s\n",
+ stream.Printf("Process %" PRIu64 " %s\n",
process_sp->GetID(), SBDebugger::StateAsCString(event_state));
-
- if (message_len > 0)
- ::fwrite(message, 1, message_len, out);
}
}
@@ -1180,6 +1191,9 @@ bool SBProcess::IsInstrumentationRuntimePresent(
if (!process_sp)
return false;
+ std::lock_guard<std::recursive_mutex> guard(
+ process_sp->GetTarget().GetAPIMutex());
+
InstrumentationRuntimeSP runtime_sp =
process_sp->GetInstrumentationRuntime(type);
@@ -1307,6 +1321,10 @@ void RegisterMethods<SBProcess>(Registry &R) {
(lldb::SBTraceOptions &, lldb::SBError &));
LLDB_REGISTER_METHOD_CONST(void, SBProcess, ReportEventState,
(const lldb::SBEvent &, FILE *));
+ LLDB_REGISTER_METHOD_CONST(void, SBProcess, ReportEventState,
+ (const lldb::SBEvent &, FileSP));
+ LLDB_REGISTER_METHOD_CONST(void, SBProcess, ReportEventState,
+ (const lldb::SBEvent &, SBFile));
LLDB_REGISTER_METHOD(
void, SBProcess, AppendEventStateReport,
(const lldb::SBEvent &, lldb::SBCommandReturnObject &));