summaryrefslogtreecommitdiff
path: root/source/API/SBThread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/API/SBThread.cpp')
-rw-r--r--source/API/SBThread.cpp708
1 files changed, 346 insertions, 362 deletions
diff --git a/source/API/SBThread.cpp b/source/API/SBThread.cpp
index 2c859d5222d6c..85e9a6b47955a 100644
--- a/source/API/SBThread.cpp
+++ b/source/API/SBThread.cpp
@@ -1,17 +1,25 @@
//===-- SBThread.cpp --------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "lldb/API/SBThread.h"
-
+#include "SBReproducerPrivate.h"
+#include "Utils.h"
+#include "lldb/API/SBAddress.h"
+#include "lldb/API/SBDebugger.h"
+#include "lldb/API/SBEvent.h"
#include "lldb/API/SBFileSpec.h"
+#include "lldb/API/SBFrame.h"
+#include "lldb/API/SBProcess.h"
#include "lldb/API/SBStream.h"
#include "lldb/API/SBSymbolContext.h"
+#include "lldb/API/SBThreadCollection.h"
+#include "lldb/API/SBThreadPlan.h"
+#include "lldb/API/SBValue.h"
#include "lldb/Breakpoint/BreakpointLocation.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/StreamFile.h"
@@ -34,57 +42,58 @@
#include "lldb/Utility/State.h"
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/StructuredData.h"
-
-#include "lldb/API/SBAddress.h"
-#include "lldb/API/SBDebugger.h"
-#include "lldb/API/SBEvent.h"
-#include "lldb/API/SBFrame.h"
-#include "lldb/API/SBProcess.h"
-#include "lldb/API/SBThreadCollection.h"
-#include "lldb/API/SBThreadPlan.h"
-#include "lldb/API/SBValue.h"
#include "lldb/lldb-enumerations.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
const char *SBThread::GetBroadcasterClassName() {
+ LLDB_RECORD_STATIC_METHOD_NO_ARGS(const char *, SBThread,
+ GetBroadcasterClassName);
+
return Thread::GetStaticBroadcasterClass().AsCString();
}
-//----------------------------------------------------------------------
// Constructors
-//----------------------------------------------------------------------
-SBThread::SBThread() : m_opaque_sp(new ExecutionContextRef()) {}
+SBThread::SBThread() : m_opaque_sp(new ExecutionContextRef()) {
+ LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBThread);
+}
SBThread::SBThread(const ThreadSP &lldb_object_sp)
- : m_opaque_sp(new ExecutionContextRef(lldb_object_sp)) {}
+ : m_opaque_sp(new ExecutionContextRef(lldb_object_sp)) {
+ LLDB_RECORD_CONSTRUCTOR(SBThread, (const lldb::ThreadSP &), lldb_object_sp);
+}
-SBThread::SBThread(const SBThread &rhs)
- : m_opaque_sp(new ExecutionContextRef(*rhs.m_opaque_sp)) {}
+SBThread::SBThread(const SBThread &rhs) : m_opaque_sp() {
+ LLDB_RECORD_CONSTRUCTOR(SBThread, (const lldb::SBThread &), rhs);
+
+ m_opaque_sp = clone(rhs.m_opaque_sp);
+}
-//----------------------------------------------------------------------
// Assignment operator
-//----------------------------------------------------------------------
const lldb::SBThread &SBThread::operator=(const SBThread &rhs) {
+ LLDB_RECORD_METHOD(const lldb::SBThread &,
+ SBThread, operator=,(const lldb::SBThread &), rhs);
+
if (this != &rhs)
- *m_opaque_sp = *rhs.m_opaque_sp;
- return *this;
+ m_opaque_sp = clone(rhs.m_opaque_sp);
+ return LLDB_RECORD_RESULT(*this);
}
-//----------------------------------------------------------------------
// Destructor
-//----------------------------------------------------------------------
SBThread::~SBThread() {}
lldb::SBQueue SBThread::GetQueue() const {
+ LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBQueue, SBThread, GetQueue);
+
SBQueue sb_queue;
QueueSP queue_sp;
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
if (exe_ctx.HasThreadScope()) {
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
@@ -92,22 +101,19 @@ lldb::SBQueue SBThread::GetQueue() const {
if (queue_sp) {
sb_queue.SetQueue(queue_sp);
}
- } else {
- if (log)
- log->Printf("SBThread(%p)::GetQueue() => error: process is running",
- static_cast<void *>(exe_ctx.GetThreadPtr()));
}
}
- if (log)
- log->Printf("SBThread(%p)::GetQueue () => SBQueue(%p)",
- static_cast<void *>(exe_ctx.GetThreadPtr()),
- static_cast<void *>(queue_sp.get()));
-
- return sb_queue;
+ return LLDB_RECORD_RESULT(sb_queue);
}
bool SBThread::IsValid() const {
+ LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBThread, IsValid);
+ return this->operator bool();
+}
+SBThread::operator bool() const {
+ LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBThread, operator bool);
+
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
@@ -116,16 +122,20 @@ bool SBThread::IsValid() const {
if (target && process) {
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&process->GetRunLock()))
- return m_opaque_sp->GetThreadSP().get() != NULL;
+ return m_opaque_sp->GetThreadSP().get() != nullptr;
}
// Without a valid target & process, this thread can't be valid.
return false;
}
-void SBThread::Clear() { m_opaque_sp->Clear(); }
+void SBThread::Clear() {
+ LLDB_RECORD_METHOD_NO_ARGS(void, SBThread, Clear);
+
+ m_opaque_sp->Clear();
+}
StopReason SBThread::GetStopReason() {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ LLDB_RECORD_METHOD_NO_ARGS(lldb::StopReason, SBThread, GetStopReason);
StopReason reason = eStopReasonInvalid;
std::unique_lock<std::recursive_mutex> lock;
@@ -135,23 +145,15 @@ StopReason SBThread::GetStopReason() {
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
return exe_ctx.GetThreadPtr()->GetStopReason();
- } else {
- if (log)
- log->Printf(
- "SBThread(%p)::GetStopReason() => error: process is running",
- static_cast<void *>(exe_ctx.GetThreadPtr()));
}
}
- if (log)
- log->Printf("SBThread(%p)::GetStopReason () => %s",
- static_cast<void *>(exe_ctx.GetThreadPtr()),
- Thread::StopReasonAsCString(reason));
-
return reason;
}
size_t SBThread::GetStopReasonDataCount() {
+ LLDB_RECORD_METHOD_NO_ARGS(size_t, SBThread, GetStopReasonDataCount);
+
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
@@ -193,18 +195,15 @@ size_t SBThread::GetStopReasonDataCount() {
return 1;
}
}
- } else {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
- if (log)
- log->Printf("SBThread(%p)::GetStopReasonDataCount() => error: process "
- "is running",
- static_cast<void *>(exe_ctx.GetThreadPtr()));
}
}
return 0;
}
uint64_t SBThread::GetStopReasonDataAtIndex(uint32_t idx) {
+ LLDB_RECORD_METHOD(uint64_t, SBThread, GetStopReasonDataAtIndex, (uint32_t),
+ idx);
+
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
@@ -258,18 +257,15 @@ uint64_t SBThread::GetStopReasonDataAtIndex(uint32_t idx) {
return stop_info_sp->GetValue();
}
}
- } else {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
- if (log)
- log->Printf("SBThread(%p)::GetStopReasonDataAtIndex() => error: "
- "process is running",
- static_cast<void *>(exe_ctx.GetThreadPtr()));
}
}
return 0;
}
bool SBThread::GetStopReasonExtendedInfoAsJSON(lldb::SBStream &stream) {
+ LLDB_RECORD_METHOD(bool, SBThread, GetStopReasonExtendedInfoAsJSON,
+ (lldb::SBStream &), stream);
+
Stream &strm = stream.ref();
std::unique_lock<std::recursive_mutex> lock;
@@ -290,28 +286,33 @@ bool SBThread::GetStopReasonExtendedInfoAsJSON(lldb::SBStream &stream) {
SBThreadCollection
SBThread::GetStopReasonExtendedBacktraces(InstrumentationRuntimeType type) {
+ LLDB_RECORD_METHOD(lldb::SBThreadCollection, SBThread,
+ GetStopReasonExtendedBacktraces,
+ (lldb::InstrumentationRuntimeType), type);
+
ThreadCollectionSP threads;
- threads.reset(new ThreadCollection());
+ threads = std::make_shared<ThreadCollection>();
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
if (!exe_ctx.HasThreadScope())
- return threads;
+ return LLDB_RECORD_RESULT(threads);
ProcessSP process_sp = exe_ctx.GetProcessSP();
StopInfoSP stop_info = exe_ctx.GetThreadPtr()->GetStopInfo();
StructuredData::ObjectSP info = stop_info->GetExtendedInfo();
if (!info)
- return threads;
+ return LLDB_RECORD_RESULT(threads);
- return process_sp->GetInstrumentationRuntime(type)
- ->GetBacktracesFromExtendedStopInfo(info);
+ return LLDB_RECORD_RESULT(process_sp->GetInstrumentationRuntime(type)
+ ->GetBacktracesFromExtendedStopInfo(info));
}
size_t SBThread::GetStopDescription(char *dst, size_t dst_len) {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ LLDB_RECORD_METHOD(size_t, SBThread, GetStopDescription, (char *, size_t),
+ dst, dst_len);
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
@@ -324,10 +325,6 @@ size_t SBThread::GetStopDescription(char *dst, size_t dst_len) {
if (stop_info_sp) {
const char *stop_desc = stop_info_sp->GetDescription();
if (stop_desc) {
- if (log)
- log->Printf(
- "SBThread(%p)::GetStopDescription (dst, dst_len) => \"%s\"",
- static_cast<void *>(exe_ctx.GetThreadPtr()), stop_desc);
if (dst)
return ::snprintf(dst, dst_len, "%s", stop_desc);
else {
@@ -362,7 +359,7 @@ size_t SBThread::GetStopDescription(char *dst, size_t dst_len) {
stop_desc =
exe_ctx.GetProcessPtr()->GetUnixSignals()->GetSignalAsCString(
stop_info_sp->GetValue());
- if (stop_desc == NULL || stop_desc[0] == '\0') {
+ if (stop_desc == nullptr || stop_desc[0] == '\0') {
static char signal_desc[] = "signal";
stop_desc = signal_desc;
stop_desc_len =
@@ -392,11 +389,6 @@ size_t SBThread::GetStopDescription(char *dst, size_t dst_len) {
}
if (stop_desc && stop_desc[0]) {
- if (log)
- log->Printf(
- "SBThread(%p)::GetStopDescription (dst, dst_len) => '%s'",
- static_cast<void *>(exe_ctx.GetThreadPtr()), stop_desc);
-
if (dst)
return ::snprintf(dst, dst_len, "%s", stop_desc) +
1; // Include the NULL byte
@@ -408,12 +400,6 @@ size_t SBThread::GetStopDescription(char *dst, size_t dst_len) {
}
}
}
- } else {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
- if (log)
- log->Printf(
- "SBThread(%p)::GetStopDescription() => error: process is running",
- static_cast<void *>(exe_ctx.GetThreadPtr()));
}
}
if (dst)
@@ -422,7 +408,8 @@ size_t SBThread::GetStopDescription(char *dst, size_t dst_len) {
}
SBValue SBThread::GetStopReturnValue() {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ LLDB_RECORD_METHOD_NO_ARGS(lldb::SBValue, SBThread, GetStopReturnValue);
+
ValueObjectSP return_valobj_sp;
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
@@ -434,21 +421,10 @@ SBValue SBThread::GetStopReturnValue() {
if (stop_info_sp) {
return_valobj_sp = StopInfo::GetReturnValueObject(stop_info_sp);
}
- } else {
- if (log)
- log->Printf(
- "SBThread(%p)::GetStopReturnValue() => error: process is running",
- static_cast<void *>(exe_ctx.GetThreadPtr()));
}
}
- if (log)
- log->Printf("SBThread(%p)::GetStopReturnValue () => %s",
- static_cast<void *>(exe_ctx.GetThreadPtr()),
- return_valobj_sp.get() ? return_valobj_sp->GetValueAsCString()
- : "<no return value>");
-
- return SBValue(return_valobj_sp);
+ return LLDB_RECORD_RESULT(SBValue(return_valobj_sp));
}
void SBThread::SetThread(const ThreadSP &lldb_object_sp) {
@@ -456,6 +432,8 @@ void SBThread::SetThread(const ThreadSP &lldb_object_sp) {
}
lldb::tid_t SBThread::GetThreadID() const {
+ LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::tid_t, SBThread, GetThreadID);
+
ThreadSP thread_sp(m_opaque_sp->GetThreadSP());
if (thread_sp)
return thread_sp->GetID();
@@ -463,6 +441,8 @@ lldb::tid_t SBThread::GetThreadID() const {
}
uint32_t SBThread::GetIndexID() const {
+ LLDB_RECORD_METHOD_CONST_NO_ARGS(uint32_t, SBThread, GetIndexID);
+
ThreadSP thread_sp(m_opaque_sp->GetThreadSP());
if (thread_sp)
return thread_sp->GetIndexID();
@@ -470,8 +450,9 @@ uint32_t SBThread::GetIndexID() const {
}
const char *SBThread::GetName() const {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
- const char *name = NULL;
+ LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBThread, GetName);
+
+ const char *name = nullptr;
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
@@ -479,72 +460,50 @@ const char *SBThread::GetName() const {
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
name = exe_ctx.GetThreadPtr()->GetName();
- } else {
- if (log)
- log->Printf("SBThread(%p)::GetName() => error: process is running",
- static_cast<void *>(exe_ctx.GetThreadPtr()));
}
}
- if (log)
- log->Printf("SBThread(%p)::GetName () => %s",
- static_cast<void *>(exe_ctx.GetThreadPtr()),
- name ? name : "NULL");
-
return name;
}
const char *SBThread::GetQueueName() const {
- const char *name = NULL;
+ LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBThread, GetQueueName);
+
+ const char *name = nullptr;
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
if (exe_ctx.HasThreadScope()) {
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
name = exe_ctx.GetThreadPtr()->GetQueueName();
- } else {
- if (log)
- log->Printf("SBThread(%p)::GetQueueName() => error: process is running",
- static_cast<void *>(exe_ctx.GetThreadPtr()));
}
}
- if (log)
- log->Printf("SBThread(%p)::GetQueueName () => %s",
- static_cast<void *>(exe_ctx.GetThreadPtr()),
- name ? name : "NULL");
-
return name;
}
lldb::queue_id_t SBThread::GetQueueID() const {
+ LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::queue_id_t, SBThread, GetQueueID);
+
queue_id_t id = LLDB_INVALID_QUEUE_ID;
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
if (exe_ctx.HasThreadScope()) {
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
id = exe_ctx.GetThreadPtr()->GetQueueID();
- } else {
- if (log)
- log->Printf("SBThread(%p)::GetQueueID() => error: process is running",
- static_cast<void *>(exe_ctx.GetThreadPtr()));
}
}
- if (log)
- log->Printf("SBThread(%p)::GetQueueID () => 0x%" PRIx64,
- static_cast<void *>(exe_ctx.GetThreadPtr()), id);
-
return id;
}
bool SBThread::GetInfoItemByPathAsString(const char *path, SBStream &strm) {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ LLDB_RECORD_METHOD(bool, SBThread, GetInfoItemByPathAsString,
+ (const char *, lldb::SBStream &), path, strm);
+
bool success = false;
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
@@ -583,18 +542,9 @@ bool SBThread::GetInfoItemByPathAsString(const char *path, SBStream &strm) {
}
}
}
- } else {
- if (log)
- log->Printf("SBThread(%p)::GetInfoItemByPathAsString() => error: "
- "process is running",
- static_cast<void *>(exe_ctx.GetThreadPtr()));
}
}
- if (log)
- log->Printf("SBThread(%p)::GetInfoItemByPathAsString (\"%s\") => \"%s\"",
- static_cast<void *>(exe_ctx.GetThreadPtr()), path, strm.GetData());
-
return success;
}
@@ -616,7 +566,7 @@ SBError SBThread::ResumeNewPlan(ExecutionContext &exe_ctx,
// User level plans should be Master Plans so they can be interrupted, other
// plans executed, and then a "continue" will resume the plan.
- if (new_plan != NULL) {
+ if (new_plan != nullptr) {
new_plan->SetIsMasterPlan(true);
new_plan->SetOkayToDiscard(false);
}
@@ -627,27 +577,26 @@ SBError SBThread::ResumeNewPlan(ExecutionContext &exe_ctx,
if (process->GetTarget().GetDebugger().GetAsyncExecution())
sb_error.ref() = process->Resume();
else
- sb_error.ref() = process->ResumeSynchronous(NULL);
+ sb_error.ref() = process->ResumeSynchronous(nullptr);
return sb_error;
}
void SBThread::StepOver(lldb::RunMode stop_other_threads) {
+ LLDB_RECORD_METHOD(void, SBThread, StepOver, (lldb::RunMode),
+ stop_other_threads);
+
SBError error; // Ignored
StepOver(stop_other_threads, error);
}
void SBThread::StepOver(lldb::RunMode stop_other_threads, SBError &error) {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ LLDB_RECORD_METHOD(void, SBThread, StepOver, (lldb::RunMode, lldb::SBError &),
+ stop_other_threads, error);
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
- if (log)
- log->Printf("SBThread(%p)::StepOver (stop_other_threads='%s')",
- static_cast<void *>(exe_ctx.GetThreadPtr()),
- Thread::RunModeAsCString(stop_other_threads));
-
if (!exe_ctx.HasThreadScope()) {
error.SetErrorString("this SBThread object is invalid");
return;
@@ -675,29 +624,31 @@ void SBThread::StepOver(lldb::RunMode stop_other_threads, SBError &error) {
}
void SBThread::StepInto(lldb::RunMode stop_other_threads) {
- StepInto(NULL, stop_other_threads);
+ LLDB_RECORD_METHOD(void, SBThread, StepInto, (lldb::RunMode),
+ stop_other_threads);
+
+ StepInto(nullptr, stop_other_threads);
}
void SBThread::StepInto(const char *target_name,
lldb::RunMode stop_other_threads) {
+ LLDB_RECORD_METHOD(void, SBThread, StepInto, (const char *, lldb::RunMode),
+ target_name, stop_other_threads);
+
SBError error; // Ignored
StepInto(target_name, LLDB_INVALID_LINE_NUMBER, error, stop_other_threads);
}
void SBThread::StepInto(const char *target_name, uint32_t end_line,
SBError &error, lldb::RunMode stop_other_threads) {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ LLDB_RECORD_METHOD(void, SBThread, StepInto,
+ (const char *, uint32_t, lldb::SBError &, lldb::RunMode),
+ target_name, end_line, error, stop_other_threads);
+
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
- if (log)
- log->Printf(
- "SBThread(%p)::StepInto (target_name='%s', stop_other_threads='%s')",
- static_cast<void *>(exe_ctx.GetThreadPtr()),
- target_name ? target_name : "<NULL>",
- Thread::RunModeAsCString(stop_other_threads));
-
if (!exe_ctx.HasThreadScope()) {
error.SetErrorString("this SBThread object is invalid");
return;
@@ -740,20 +691,18 @@ void SBThread::StepInto(const char *target_name, uint32_t end_line,
}
void SBThread::StepOut() {
+ LLDB_RECORD_METHOD_NO_ARGS(void, SBThread, StepOut);
+
SBError error; // Ignored
StepOut(error);
}
void SBThread::StepOut(SBError &error) {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ LLDB_RECORD_METHOD(void, SBThread, StepOut, (lldb::SBError &), error);
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
- if (log)
- log->Printf("SBThread(%p)::StepOut ()",
- static_cast<void *>(exe_ctx.GetThreadPtr()));
-
if (!exe_ctx.HasThreadScope()) {
error.SetErrorString("this SBThread object is invalid");
return;
@@ -767,7 +716,7 @@ void SBThread::StepOut(SBError &error) {
const LazyBool avoid_no_debug = eLazyBoolCalculate;
Status new_plan_status;
ThreadPlanSP new_plan_sp(thread->QueueThreadPlanForStepOut(
- abort_other_plans, NULL, false, stop_other_threads, eVoteYes,
+ abort_other_plans, nullptr, false, stop_other_threads, eVoteYes,
eVoteNoOpinion, 0, new_plan_status, avoid_no_debug));
if (new_plan_status.Success())
@@ -777,33 +726,27 @@ void SBThread::StepOut(SBError &error) {
}
void SBThread::StepOutOfFrame(SBFrame &sb_frame) {
+ LLDB_RECORD_METHOD(void, SBThread, StepOutOfFrame, (lldb::SBFrame &),
+ sb_frame);
+
SBError error; // Ignored
StepOutOfFrame(sb_frame, error);
}
void SBThread::StepOutOfFrame(SBFrame &sb_frame, SBError &error) {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ LLDB_RECORD_METHOD(void, SBThread, StepOutOfFrame,
+ (lldb::SBFrame &, lldb::SBError &), sb_frame, error);
+
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
if (!sb_frame.IsValid()) {
- if (log)
- log->Printf(
- "SBThread(%p)::StepOutOfFrame passed an invalid frame, returning.",
- static_cast<void *>(exe_ctx.GetThreadPtr()));
error.SetErrorString("passed invalid SBFrame object");
return;
}
StackFrameSP frame_sp(sb_frame.GetFrameSP());
- if (log) {
- SBStream frame_desc_strm;
- sb_frame.GetDescription(frame_desc_strm);
- log->Printf("SBThread(%p)::StepOutOfFrame (frame = SBFrame(%p): %s)",
- static_cast<void *>(exe_ctx.GetThreadPtr()),
- static_cast<void *>(frame_sp.get()), frame_desc_strm.GetData());
- }
if (!exe_ctx.HasThreadScope()) {
error.SetErrorString("this SBThread object is invalid");
@@ -814,17 +757,13 @@ void SBThread::StepOutOfFrame(SBFrame &sb_frame, SBError &error) {
bool stop_other_threads = false;
Thread *thread = exe_ctx.GetThreadPtr();
if (sb_frame.GetThread().GetThreadID() != thread->GetID()) {
- log->Printf("SBThread(%p)::StepOutOfFrame passed a frame from another "
- "thread (0x%" PRIx64 " vrs. 0x%" PRIx64 ", returning.",
- static_cast<void *>(exe_ctx.GetThreadPtr()),
- sb_frame.GetThread().GetThreadID(), thread->GetID());
error.SetErrorString("passed a frame from another thread");
return;
}
Status new_plan_status;
ThreadPlanSP new_plan_sp(thread->QueueThreadPlanForStepOut(
- abort_other_plans, NULL, false, stop_other_threads, eVoteYes,
+ abort_other_plans, nullptr, false, stop_other_threads, eVoteYes,
eVoteNoOpinion, frame_sp->GetFrameIndex(), new_plan_status));
if (new_plan_status.Success())
@@ -834,20 +773,19 @@ void SBThread::StepOutOfFrame(SBFrame &sb_frame, SBError &error) {
}
void SBThread::StepInstruction(bool step_over) {
+ LLDB_RECORD_METHOD(void, SBThread, StepInstruction, (bool), step_over);
+
SBError error; // Ignored
StepInstruction(step_over, error);
}
void SBThread::StepInstruction(bool step_over, SBError &error) {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ LLDB_RECORD_METHOD(void, SBThread, StepInstruction, (bool, lldb::SBError &),
+ step_over, error);
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
- if (log)
- log->Printf("SBThread(%p)::StepInstruction (step_over=%i)",
- static_cast<void *>(exe_ctx.GetThreadPtr()), step_over);
-
if (!exe_ctx.HasThreadScope()) {
error.SetErrorString("this SBThread object is invalid");
return;
@@ -865,20 +803,19 @@ void SBThread::StepInstruction(bool step_over, SBError &error) {
}
void SBThread::RunToAddress(lldb::addr_t addr) {
+ LLDB_RECORD_METHOD(void, SBThread, RunToAddress, (lldb::addr_t), addr);
+
SBError error; // Ignored
RunToAddress(addr, error);
}
void SBThread::RunToAddress(lldb::addr_t addr, SBError &error) {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ LLDB_RECORD_METHOD(void, SBThread, RunToAddress,
+ (lldb::addr_t, lldb::SBError &), addr, error);
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
- if (log)
- log->Printf("SBThread(%p)::RunToAddress (addr=0x%" PRIx64 ")",
- static_cast<void *>(exe_ctx.GetThreadPtr()), addr);
-
if (!exe_ctx.HasThreadScope()) {
error.SetErrorString("this SBThread object is invalid");
return;
@@ -903,8 +840,11 @@ void SBThread::RunToAddress(lldb::addr_t addr, SBError &error) {
SBError SBThread::StepOverUntil(lldb::SBFrame &sb_frame,
lldb::SBFileSpec &sb_file_spec, uint32_t line) {
+ LLDB_RECORD_METHOD(lldb::SBError, SBThread, StepOverUntil,
+ (lldb::SBFrame &, lldb::SBFileSpec &, uint32_t), sb_frame,
+ sb_file_spec, line);
+
SBError sb_error;
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
char path[PATH_MAX];
std::unique_lock<std::recursive_mutex> lock;
@@ -912,24 +852,13 @@ SBError SBThread::StepOverUntil(lldb::SBFrame &sb_frame,
StackFrameSP frame_sp(sb_frame.GetFrameSP());
- if (log) {
- SBStream frame_desc_strm;
- sb_frame.GetDescription(frame_desc_strm);
- sb_file_spec->GetPath(path, sizeof(path));
- log->Printf("SBThread(%p)::StepOverUntil (frame = SBFrame(%p): %s, "
- "file+line = %s:%u)",
- static_cast<void *>(exe_ctx.GetThreadPtr()),
- static_cast<void *>(frame_sp.get()), frame_desc_strm.GetData(),
- path, line);
- }
-
if (exe_ctx.HasThreadScope()) {
Target *target = exe_ctx.GetTargetPtr();
Thread *thread = exe_ctx.GetThreadPtr();
if (line == 0) {
sb_error.SetErrorString("invalid line argument");
- return sb_error;
+ return LLDB_RECORD_RESULT(sb_error);
}
if (!frame_sp) {
@@ -941,7 +870,7 @@ SBError SBThread::StepOverUntil(lldb::SBFrame &sb_frame,
SymbolContext frame_sc;
if (!frame_sp) {
sb_error.SetErrorString("no valid frames in thread to step");
- return sb_error;
+ return LLDB_RECORD_RESULT(sb_error);
}
// If we have a frame, get its line
@@ -949,10 +878,10 @@ SBError SBThread::StepOverUntil(lldb::SBFrame &sb_frame,
eSymbolContextCompUnit | eSymbolContextFunction |
eSymbolContextLineEntry | eSymbolContextSymbol);
- if (frame_sc.comp_unit == NULL) {
+ if (frame_sc.comp_unit == nullptr) {
sb_error.SetErrorStringWithFormat(
"frame %u doesn't have debug information", frame_sp->GetFrameIndex());
- return sb_error;
+ return LLDB_RECORD_RESULT(sb_error);
}
FileSpec step_file_spec;
@@ -964,7 +893,7 @@ SBError SBThread::StepOverUntil(lldb::SBFrame &sb_frame,
step_file_spec = frame_sc.line_entry.file;
else {
sb_error.SetErrorString("invalid file argument or no file for frame");
- return sb_error;
+ return LLDB_RECORD_RESULT(sb_error);
}
}
@@ -1024,29 +953,31 @@ SBError SBThread::StepOverUntil(lldb::SBFrame &sb_frame,
} else {
sb_error.SetErrorString("this SBThread object is invalid");
}
- return sb_error;
+ return LLDB_RECORD_RESULT(sb_error);
}
SBError SBThread::StepUsingScriptedThreadPlan(const char *script_class_name) {
- return StepUsingScriptedThreadPlan(script_class_name, true);
+ LLDB_RECORD_METHOD(lldb::SBError, SBThread, StepUsingScriptedThreadPlan,
+ (const char *), script_class_name);
+
+ return LLDB_RECORD_RESULT(
+ StepUsingScriptedThreadPlan(script_class_name, true));
}
SBError SBThread::StepUsingScriptedThreadPlan(const char *script_class_name,
bool resume_immediately) {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ LLDB_RECORD_METHOD(lldb::SBError, SBThread, StepUsingScriptedThreadPlan,
+ (const char *, bool), script_class_name,
+ resume_immediately);
+
SBError error;
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
- if (log) {
- log->Printf("SBThread(%p)::StepUsingScriptedThreadPlan: class name: %s",
- static_cast<void *>(exe_ctx.GetThreadPtr()), script_class_name);
- }
-
if (!exe_ctx.HasThreadScope()) {
error.SetErrorString("this SBThread object is invalid");
- return error;
+ return LLDB_RECORD_RESULT(error);
}
Thread *thread = exe_ctx.GetThreadPtr();
@@ -1056,78 +987,68 @@ SBError SBThread::StepUsingScriptedThreadPlan(const char *script_class_name,
if (new_plan_status.Fail()) {
error.SetErrorString(new_plan_status.AsCString());
- return error;
+ return LLDB_RECORD_RESULT(error);
}
if (!resume_immediately)
- return error;
+ return LLDB_RECORD_RESULT(error);
if (new_plan_status.Success())
error = ResumeNewPlan(exe_ctx, new_plan_sp.get());
else
error.SetErrorString(new_plan_status.AsCString());
- return error;
+ return LLDB_RECORD_RESULT(error);
}
SBError SBThread::JumpToLine(lldb::SBFileSpec &file_spec, uint32_t line) {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ LLDB_RECORD_METHOD(lldb::SBError, SBThread, JumpToLine,
+ (lldb::SBFileSpec &, uint32_t), file_spec, line);
+
SBError sb_error;
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
- if (log)
- log->Printf("SBThread(%p)::JumpToLine (file+line = %s:%u)",
- static_cast<void *>(exe_ctx.GetThreadPtr()),
- file_spec->GetPath().c_str(), line);
-
if (!exe_ctx.HasThreadScope()) {
sb_error.SetErrorString("this SBThread object is invalid");
- return sb_error;
+ return LLDB_RECORD_RESULT(sb_error);
}
Thread *thread = exe_ctx.GetThreadPtr();
Status err = thread->JumpToLine(file_spec.get(), line, true);
sb_error.SetError(err);
- return sb_error;
+ return LLDB_RECORD_RESULT(sb_error);
}
SBError SBThread::ReturnFromFrame(SBFrame &frame, SBValue &return_value) {
- SBError sb_error;
+ LLDB_RECORD_METHOD(lldb::SBError, SBThread, ReturnFromFrame,
+ (lldb::SBFrame &, lldb::SBValue &), frame, return_value);
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ SBError sb_error;
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
- if (log)
- log->Printf("SBThread(%p)::ReturnFromFrame (frame=%d)",
- static_cast<void *>(exe_ctx.GetThreadPtr()),
- frame.GetFrameID());
-
if (exe_ctx.HasThreadScope()) {
Thread *thread = exe_ctx.GetThreadPtr();
sb_error.SetError(
thread->ReturnFromFrame(frame.GetFrameSP(), return_value.GetSP()));
}
- return sb_error;
+ return LLDB_RECORD_RESULT(sb_error);
}
SBError SBThread::UnwindInnermostExpression() {
- SBError sb_error;
+ LLDB_RECORD_METHOD_NO_ARGS(lldb::SBError, SBThread,
+ UnwindInnermostExpression);
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ SBError sb_error;
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
- if (log)
- log->Printf("SBThread(%p)::UnwindExpressionEvaluation",
- static_cast<void *>(exe_ctx.GetThreadPtr()));
-
if (exe_ctx.HasThreadScope()) {
Thread *thread = exe_ctx.GetThreadPtr();
sb_error.SetError(thread->UnwindInnermostExpression());
@@ -1135,16 +1056,19 @@ SBError SBThread::UnwindInnermostExpression() {
thread->SetSelectedFrameByIndex(0, false);
}
- return sb_error;
+ return LLDB_RECORD_RESULT(sb_error);
}
bool SBThread::Suspend() {
+ LLDB_RECORD_METHOD_NO_ARGS(bool, SBThread, Suspend);
+
SBError error; // Ignored
return Suspend(error);
}
bool SBThread::Suspend(SBError &error) {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ LLDB_RECORD_METHOD(bool, SBThread, Suspend, (lldb::SBError &), error);
+
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
@@ -1156,25 +1080,22 @@ bool SBThread::Suspend(SBError &error) {
result = true;
} else {
error.SetErrorString("process is running");
- if (log)
- log->Printf("SBThread(%p)::Suspend() => error: process is running",
- static_cast<void *>(exe_ctx.GetThreadPtr()));
}
} else
error.SetErrorString("this SBThread object is invalid");
- if (log)
- log->Printf("SBThread(%p)::Suspend() => %i",
- static_cast<void *>(exe_ctx.GetThreadPtr()), result);
return result;
}
bool SBThread::Resume() {
+ LLDB_RECORD_METHOD_NO_ARGS(bool, SBThread, Resume);
+
SBError error; // Ignored
return Resume(error);
}
bool SBThread::Resume(SBError &error) {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ LLDB_RECORD_METHOD(bool, SBThread, Resume, (lldb::SBError &), error);
+
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
@@ -1187,19 +1108,15 @@ bool SBThread::Resume(SBError &error) {
result = true;
} else {
error.SetErrorString("process is running");
- if (log)
- log->Printf("SBThread(%p)::Resume() => error: process is running",
- static_cast<void *>(exe_ctx.GetThreadPtr()));
}
} else
error.SetErrorString("this SBThread object is invalid");
- if (log)
- log->Printf("SBThread(%p)::Resume() => %i",
- static_cast<void *>(exe_ctx.GetThreadPtr()), result);
return result;
}
bool SBThread::IsSuspended() {
+ LLDB_RECORD_METHOD_NO_ARGS(bool, SBThread, IsSuspended);
+
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
@@ -1209,6 +1126,8 @@ bool SBThread::IsSuspended() {
}
bool SBThread::IsStopped() {
+ LLDB_RECORD_METHOD_NO_ARGS(bool, SBThread, IsStopped);
+
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
@@ -1218,6 +1137,8 @@ bool SBThread::IsStopped() {
}
SBProcess SBThread::GetProcess() {
+ LLDB_RECORD_METHOD_NO_ARGS(lldb::SBProcess, SBThread, GetProcess);
+
SBProcess sb_process;
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
@@ -1228,21 +1149,11 @@ SBProcess SBThread::GetProcess() {
sb_process.SetSP(exe_ctx.GetProcessSP());
}
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
- if (log) {
- SBStream frame_desc_strm;
- sb_process.GetDescription(frame_desc_strm);
- log->Printf("SBThread(%p)::GetProcess () => SBProcess(%p): %s",
- static_cast<void *>(exe_ctx.GetThreadPtr()),
- static_cast<void *>(sb_process.GetSP().get()),
- frame_desc_strm.GetData());
- }
-
- return sb_process;
+ return LLDB_RECORD_RESULT(sb_process);
}
uint32_t SBThread::GetNumFrames() {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBThread, GetNumFrames);
uint32_t num_frames = 0;
std::unique_lock<std::recursive_mutex> lock;
@@ -1252,22 +1163,14 @@ uint32_t SBThread::GetNumFrames() {
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
num_frames = exe_ctx.GetThreadPtr()->GetStackFrameCount();
- } else {
- if (log)
- log->Printf("SBThread(%p)::GetNumFrames() => error: process is running",
- static_cast<void *>(exe_ctx.GetThreadPtr()));
}
}
- if (log)
- log->Printf("SBThread(%p)::GetNumFrames () => %u",
- static_cast<void *>(exe_ctx.GetThreadPtr()), num_frames);
-
return num_frames;
}
SBFrame SBThread::GetFrameAtIndex(uint32_t idx) {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ LLDB_RECORD_METHOD(lldb::SBFrame, SBThread, GetFrameAtIndex, (uint32_t), idx);
SBFrame sb_frame;
StackFrameSP frame_sp;
@@ -1279,27 +1182,14 @@ SBFrame SBThread::GetFrameAtIndex(uint32_t idx) {
if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
frame_sp = exe_ctx.GetThreadPtr()->GetStackFrameAtIndex(idx);
sb_frame.SetFrameSP(frame_sp);
- } else {
- if (log)
- log->Printf(
- "SBThread(%p)::GetFrameAtIndex() => error: process is running",
- static_cast<void *>(exe_ctx.GetThreadPtr()));
}
}
- if (log) {
- SBStream frame_desc_strm;
- sb_frame.GetDescription(frame_desc_strm);
- log->Printf("SBThread(%p)::GetFrameAtIndex (idx=%d) => SBFrame(%p): %s",
- static_cast<void *>(exe_ctx.GetThreadPtr()), idx,
- static_cast<void *>(frame_sp.get()), frame_desc_strm.GetData());
- }
-
- return sb_frame;
+ return LLDB_RECORD_RESULT(sb_frame);
}
lldb::SBFrame SBThread::GetSelectedFrame() {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ LLDB_RECORD_METHOD_NO_ARGS(lldb::SBFrame, SBThread, GetSelectedFrame);
SBFrame sb_frame;
StackFrameSP frame_sp;
@@ -1311,27 +1201,15 @@ lldb::SBFrame SBThread::GetSelectedFrame() {
if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
frame_sp = exe_ctx.GetThreadPtr()->GetSelectedFrame();
sb_frame.SetFrameSP(frame_sp);
- } else {
- if (log)
- log->Printf(
- "SBThread(%p)::GetSelectedFrame() => error: process is running",
- static_cast<void *>(exe_ctx.GetThreadPtr()));
}
}
- if (log) {
- SBStream frame_desc_strm;
- sb_frame.GetDescription(frame_desc_strm);
- log->Printf("SBThread(%p)::GetSelectedFrame () => SBFrame(%p): %s",
- static_cast<void *>(exe_ctx.GetThreadPtr()),
- static_cast<void *>(frame_sp.get()), frame_desc_strm.GetData());
- }
-
- return sb_frame;
+ return LLDB_RECORD_RESULT(sb_frame);
}
lldb::SBFrame SBThread::SetSelectedFrame(uint32_t idx) {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ LLDB_RECORD_METHOD(lldb::SBFrame, SBThread, SetSelectedFrame, (uint32_t),
+ idx);
SBFrame sb_frame;
StackFrameSP frame_sp;
@@ -1347,47 +1225,55 @@ lldb::SBFrame SBThread::SetSelectedFrame(uint32_t idx) {
thread->SetSelectedFrame(frame_sp.get());
sb_frame.SetFrameSP(frame_sp);
}
- } else {
- if (log)
- log->Printf(
- "SBThread(%p)::SetSelectedFrame() => error: process is running",
- static_cast<void *>(exe_ctx.GetThreadPtr()));
}
}
- if (log) {
- SBStream frame_desc_strm;
- sb_frame.GetDescription(frame_desc_strm);
- log->Printf("SBThread(%p)::SetSelectedFrame (idx=%u) => SBFrame(%p): %s",
- static_cast<void *>(exe_ctx.GetThreadPtr()), idx,
- static_cast<void *>(frame_sp.get()), frame_desc_strm.GetData());
- }
- return sb_frame;
+ return LLDB_RECORD_RESULT(sb_frame);
}
bool SBThread::EventIsThreadEvent(const SBEvent &event) {
- return Thread::ThreadEventData::GetEventDataFromEvent(event.get()) != NULL;
+ LLDB_RECORD_STATIC_METHOD(bool, SBThread, EventIsThreadEvent,
+ (const lldb::SBEvent &), event);
+
+ return Thread::ThreadEventData::GetEventDataFromEvent(event.get()) != nullptr;
}
SBFrame SBThread::GetStackFrameFromEvent(const SBEvent &event) {
- return Thread::ThreadEventData::GetStackFrameFromEvent(event.get());
+ LLDB_RECORD_STATIC_METHOD(lldb::SBFrame, SBThread, GetStackFrameFromEvent,
+ (const lldb::SBEvent &), event);
+
+ return LLDB_RECORD_RESULT(
+ Thread::ThreadEventData::GetStackFrameFromEvent(event.get()));
}
SBThread SBThread::GetThreadFromEvent(const SBEvent &event) {
- return Thread::ThreadEventData::GetThreadFromEvent(event.get());
+ LLDB_RECORD_STATIC_METHOD(lldb::SBThread, SBThread, GetThreadFromEvent,
+ (const lldb::SBEvent &), event);
+
+ return LLDB_RECORD_RESULT(
+ Thread::ThreadEventData::GetThreadFromEvent(event.get()));
}
bool SBThread::operator==(const SBThread &rhs) const {
+ LLDB_RECORD_METHOD_CONST(bool, SBThread, operator==,(const lldb::SBThread &),
+ rhs);
+
return m_opaque_sp->GetThreadSP().get() ==
rhs.m_opaque_sp->GetThreadSP().get();
}
bool SBThread::operator!=(const SBThread &rhs) const {
+ LLDB_RECORD_METHOD_CONST(bool, SBThread, operator!=,(const lldb::SBThread &),
+ rhs);
+
return m_opaque_sp->GetThreadSP().get() !=
rhs.m_opaque_sp->GetThreadSP().get();
}
bool SBThread::GetStatus(SBStream &status) const {
+ LLDB_RECORD_METHOD_CONST(bool, SBThread, GetStatus, (lldb::SBStream &),
+ status);
+
Stream &strm = status.ref();
std::unique_lock<std::recursive_mutex> lock;
@@ -1402,10 +1288,16 @@ bool SBThread::GetStatus(SBStream &status) const {
}
bool SBThread::GetDescription(SBStream &description) const {
- return GetDescription(description, false);
+ LLDB_RECORD_METHOD_CONST(bool, SBThread, GetDescription, (lldb::SBStream &),
+ description);
+
+ return GetDescription(description, false);
}
bool SBThread::GetDescription(SBStream &description, bool stop_format) const {
+ LLDB_RECORD_METHOD_CONST(bool, SBThread, GetDescription,
+ (lldb::SBStream &, bool), description, stop_format);
+
Stream &strm = description.ref();
std::unique_lock<std::recursive_mutex> lock;
@@ -1424,14 +1316,16 @@ bool SBThread::GetDescription(SBStream &description, bool stop_format) const {
}
SBThread SBThread::GetExtendedBacktraceThread(const char *type) {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ LLDB_RECORD_METHOD(lldb::SBThread, SBThread, GetExtendedBacktraceThread,
+ (const char *), type);
+
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
SBThread sb_origin_thread;
- if (exe_ctx.HasThreadScope()) {
- Process::StopLocker stop_locker;
- if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
+ Process::StopLocker stop_locker;
+ if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
+ if (exe_ctx.HasThreadScope()) {
ThreadSP real_thread(exe_ctx.GetThreadSP());
if (real_thread) {
ConstString type_const(type);
@@ -1446,38 +1340,20 @@ SBThread SBThread::GetExtendedBacktraceThread(const char *type) {
// pointer retains the object.
process->GetExtendedThreadList().AddThread(new_thread_sp);
sb_origin_thread.SetThread(new_thread_sp);
- if (log) {
- const char *queue_name = new_thread_sp->GetQueueName();
- if (queue_name == NULL)
- queue_name = "";
- log->Printf("SBThread(%p)::GetExtendedBacktraceThread() => new "
- "extended Thread "
- "created (%p) with queue_id 0x%" PRIx64
- " queue name '%s'",
- static_cast<void *>(exe_ctx.GetThreadPtr()),
- static_cast<void *>(new_thread_sp.get()),
- new_thread_sp->GetQueueID(), queue_name);
- }
}
}
}
}
- } else {
- if (log)
- log->Printf("SBThread(%p)::GetExtendedBacktraceThread() => error: "
- "process is running",
- static_cast<void *>(exe_ctx.GetThreadPtr()));
}
}
- if (log && !sb_origin_thread.IsValid())
- log->Printf("SBThread(%p)::GetExtendedBacktraceThread() is not returning a "
- "Valid thread",
- static_cast<void *>(exe_ctx.GetThreadPtr()));
- return sb_origin_thread;
+ return LLDB_RECORD_RESULT(sb_origin_thread);
}
uint32_t SBThread::GetExtendedBacktraceOriginatingIndexID() {
+ LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBThread,
+ GetExtendedBacktraceOriginatingIndexID);
+
ThreadSP thread_sp(m_opaque_sp->GetThreadSP());
if (thread_sp)
return thread_sp->GetExtendedBacktraceOriginatingIndexID();
@@ -1485,20 +1361,30 @@ uint32_t SBThread::GetExtendedBacktraceOriginatingIndexID() {
}
SBValue SBThread::GetCurrentException() {
+ LLDB_RECORD_METHOD_NO_ARGS(lldb::SBValue, SBThread, GetCurrentException);
+
ThreadSP thread_sp(m_opaque_sp->GetThreadSP());
- if (!thread_sp) return SBValue();
+ if (!thread_sp)
+ return LLDB_RECORD_RESULT(SBValue());
- return SBValue(thread_sp->GetCurrentException());
+ return LLDB_RECORD_RESULT(SBValue(thread_sp->GetCurrentException()));
}
SBThread SBThread::GetCurrentExceptionBacktrace() {
+ LLDB_RECORD_METHOD_NO_ARGS(lldb::SBThread, SBThread,
+ GetCurrentExceptionBacktrace);
+
ThreadSP thread_sp(m_opaque_sp->GetThreadSP());
- if (!thread_sp) return SBThread();
+ if (!thread_sp)
+ return LLDB_RECORD_RESULT(SBThread());
- return SBThread(thread_sp->GetCurrentExceptionBacktrace());
+ return LLDB_RECORD_RESULT(
+ SBThread(thread_sp->GetCurrentExceptionBacktrace()));
}
bool SBThread::SafeToCallFunctions() {
+ LLDB_RECORD_METHOD_NO_ARGS(bool, SBThread, SafeToCallFunctions);
+
ThreadSP thread_sp(m_opaque_sp->GetThreadSP());
if (thread_sp)
return thread_sp->SafeToCallFunctions();
@@ -1506,17 +1392,115 @@ bool SBThread::SafeToCallFunctions() {
}
lldb_private::Thread *SBThread::operator->() {
- ThreadSP thread_sp(m_opaque_sp->GetThreadSP());
- if (thread_sp)
- return thread_sp.get();
- else
- return NULL;
+ return get();
}
lldb_private::Thread *SBThread::get() {
- ThreadSP thread_sp(m_opaque_sp->GetThreadSP());
- if (thread_sp)
- return thread_sp.get();
- else
- return NULL;
+ return m_opaque_sp->GetThreadSP().get();
+}
+
+namespace lldb_private {
+namespace repro {
+
+template <>
+void RegisterMethods<SBThread>(Registry &R) {
+ LLDB_REGISTER_STATIC_METHOD(const char *, SBThread, GetBroadcasterClassName,
+ ());
+ LLDB_REGISTER_CONSTRUCTOR(SBThread, ());
+ LLDB_REGISTER_CONSTRUCTOR(SBThread, (const lldb::ThreadSP &));
+ LLDB_REGISTER_CONSTRUCTOR(SBThread, (const lldb::SBThread &));
+ LLDB_REGISTER_METHOD(const lldb::SBThread &,
+ SBThread, operator=,(const lldb::SBThread &));
+ LLDB_REGISTER_METHOD_CONST(lldb::SBQueue, SBThread, GetQueue, ());
+ LLDB_REGISTER_METHOD_CONST(bool, SBThread, IsValid, ());
+ LLDB_REGISTER_METHOD_CONST(bool, SBThread, operator bool, ());
+ LLDB_REGISTER_METHOD(void, SBThread, Clear, ());
+ LLDB_REGISTER_METHOD(lldb::StopReason, SBThread, GetStopReason, ());
+ LLDB_REGISTER_METHOD(size_t, SBThread, GetStopReasonDataCount, ());
+ LLDB_REGISTER_METHOD(uint64_t, SBThread, GetStopReasonDataAtIndex,
+ (uint32_t));
+ LLDB_REGISTER_METHOD(bool, SBThread, GetStopReasonExtendedInfoAsJSON,
+ (lldb::SBStream &));
+ LLDB_REGISTER_METHOD(lldb::SBThreadCollection, SBThread,
+ GetStopReasonExtendedBacktraces,
+ (lldb::InstrumentationRuntimeType));
+ LLDB_REGISTER_METHOD(size_t, SBThread, GetStopDescription,
+ (char *, size_t));
+ LLDB_REGISTER_METHOD(lldb::SBValue, SBThread, GetStopReturnValue, ());
+ LLDB_REGISTER_METHOD_CONST(lldb::tid_t, SBThread, GetThreadID, ());
+ LLDB_REGISTER_METHOD_CONST(uint32_t, SBThread, GetIndexID, ());
+ LLDB_REGISTER_METHOD_CONST(const char *, SBThread, GetName, ());
+ LLDB_REGISTER_METHOD_CONST(const char *, SBThread, GetQueueName, ());
+ LLDB_REGISTER_METHOD_CONST(lldb::queue_id_t, SBThread, GetQueueID, ());
+ LLDB_REGISTER_METHOD(bool, SBThread, GetInfoItemByPathAsString,
+ (const char *, lldb::SBStream &));
+ LLDB_REGISTER_METHOD(void, SBThread, StepOver, (lldb::RunMode));
+ LLDB_REGISTER_METHOD(void, SBThread, StepOver,
+ (lldb::RunMode, lldb::SBError &));
+ LLDB_REGISTER_METHOD(void, SBThread, StepInto, (lldb::RunMode));
+ LLDB_REGISTER_METHOD(void, SBThread, StepInto,
+ (const char *, lldb::RunMode));
+ LLDB_REGISTER_METHOD(
+ void, SBThread, StepInto,
+ (const char *, uint32_t, lldb::SBError &, lldb::RunMode));
+ LLDB_REGISTER_METHOD(void, SBThread, StepOut, ());
+ LLDB_REGISTER_METHOD(void, SBThread, StepOut, (lldb::SBError &));
+ LLDB_REGISTER_METHOD(void, SBThread, StepOutOfFrame, (lldb::SBFrame &));
+ LLDB_REGISTER_METHOD(void, SBThread, StepOutOfFrame,
+ (lldb::SBFrame &, lldb::SBError &));
+ LLDB_REGISTER_METHOD(void, SBThread, StepInstruction, (bool));
+ LLDB_REGISTER_METHOD(void, SBThread, StepInstruction,
+ (bool, lldb::SBError &));
+ LLDB_REGISTER_METHOD(void, SBThread, RunToAddress, (lldb::addr_t));
+ LLDB_REGISTER_METHOD(void, SBThread, RunToAddress,
+ (lldb::addr_t, lldb::SBError &));
+ LLDB_REGISTER_METHOD(lldb::SBError, SBThread, StepOverUntil,
+ (lldb::SBFrame &, lldb::SBFileSpec &, uint32_t));
+ LLDB_REGISTER_METHOD(lldb::SBError, SBThread, StepUsingScriptedThreadPlan,
+ (const char *));
+ LLDB_REGISTER_METHOD(lldb::SBError, SBThread, StepUsingScriptedThreadPlan,
+ (const char *, bool));
+ LLDB_REGISTER_METHOD(lldb::SBError, SBThread, JumpToLine,
+ (lldb::SBFileSpec &, uint32_t));
+ LLDB_REGISTER_METHOD(lldb::SBError, SBThread, ReturnFromFrame,
+ (lldb::SBFrame &, lldb::SBValue &));
+ LLDB_REGISTER_METHOD(lldb::SBError, SBThread, UnwindInnermostExpression,
+ ());
+ LLDB_REGISTER_METHOD(bool, SBThread, Suspend, ());
+ LLDB_REGISTER_METHOD(bool, SBThread, Suspend, (lldb::SBError &));
+ LLDB_REGISTER_METHOD(bool, SBThread, Resume, ());
+ LLDB_REGISTER_METHOD(bool, SBThread, Resume, (lldb::SBError &));
+ LLDB_REGISTER_METHOD(bool, SBThread, IsSuspended, ());
+ LLDB_REGISTER_METHOD(bool, SBThread, IsStopped, ());
+ LLDB_REGISTER_METHOD(lldb::SBProcess, SBThread, GetProcess, ());
+ LLDB_REGISTER_METHOD(uint32_t, SBThread, GetNumFrames, ());
+ LLDB_REGISTER_METHOD(lldb::SBFrame, SBThread, GetFrameAtIndex, (uint32_t));
+ LLDB_REGISTER_METHOD(lldb::SBFrame, SBThread, GetSelectedFrame, ());
+ LLDB_REGISTER_METHOD(lldb::SBFrame, SBThread, SetSelectedFrame, (uint32_t));
+ LLDB_REGISTER_STATIC_METHOD(bool, SBThread, EventIsThreadEvent,
+ (const lldb::SBEvent &));
+ LLDB_REGISTER_STATIC_METHOD(lldb::SBFrame, SBThread, GetStackFrameFromEvent,
+ (const lldb::SBEvent &));
+ LLDB_REGISTER_STATIC_METHOD(lldb::SBThread, SBThread, GetThreadFromEvent,
+ (const lldb::SBEvent &));
+ LLDB_REGISTER_METHOD_CONST(bool,
+ SBThread, operator==,(const lldb::SBThread &));
+ LLDB_REGISTER_METHOD_CONST(bool,
+ SBThread, operator!=,(const lldb::SBThread &));
+ LLDB_REGISTER_METHOD_CONST(bool, SBThread, GetStatus, (lldb::SBStream &));
+ LLDB_REGISTER_METHOD_CONST(bool, SBThread, GetDescription,
+ (lldb::SBStream &));
+ LLDB_REGISTER_METHOD_CONST(bool, SBThread, GetDescription,
+ (lldb::SBStream &, bool));
+ LLDB_REGISTER_METHOD(lldb::SBThread, SBThread, GetExtendedBacktraceThread,
+ (const char *));
+ LLDB_REGISTER_METHOD(uint32_t, SBThread,
+ GetExtendedBacktraceOriginatingIndexID, ());
+ LLDB_REGISTER_METHOD(lldb::SBValue, SBThread, GetCurrentException, ());
+ LLDB_REGISTER_METHOD(lldb::SBThread, SBThread, GetCurrentExceptionBacktrace,
+ ());
+ LLDB_REGISTER_METHOD(bool, SBThread, SafeToCallFunctions, ());
+}
+
+}
}