aboutsummaryrefslogtreecommitdiff
path: root/source/API/SBThread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/API/SBThread.cpp')
-rw-r--r--source/API/SBThread.cpp374
1 files changed, 274 insertions, 100 deletions
diff --git a/source/API/SBThread.cpp b/source/API/SBThread.cpp
index 4170d5b230bb..a0bfa4313535 100644
--- a/source/API/SBThread.cpp
+++ b/source/API/SBThread.cpp
@@ -19,10 +19,12 @@
#include "lldb/Core/State.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
+#include "lldb/Core/StructuredData.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Target/SystemRuntime.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/Process.h"
+#include "lldb/Target/Queue.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Target/StopInfo.h"
@@ -88,6 +90,42 @@ SBThread::~SBThread()
{
}
+lldb::SBQueue
+SBThread::GetQueue () const
+{
+ SBQueue sb_queue;
+ QueueSP queue_sp;
+ Mutex::Locker api_locker;
+ ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (exe_ctx.HasThreadScope())
+ {
+ Process::StopLocker stop_locker;
+ if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock()))
+ {
+ queue_sp = exe_ctx.GetThreadPtr()->GetQueue();
+ if (queue_sp)
+ {
+ sb_queue.SetQueue (queue_sp);
+ }
+ }
+ else
+ {
+ if (log)
+ log->Printf ("SBThread(%p)::GetQueueKind() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
+ }
+ }
+
+ if (log)
+ log->Printf ("SBThread(%p)::GetQueueKind () => SBQueue(%p)",
+ static_cast<void*>(exe_ctx.GetThreadPtr()), static_cast<void*>(queue_sp.get()));
+
+ return sb_queue;
+}
+
+
bool
SBThread::IsValid() const
{
@@ -120,12 +158,14 @@ SBThread::GetStopReason()
else
{
if (log)
- log->Printf ("SBThread(%p)::GetStopReason() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetStopReason() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
if (log)
- log->Printf ("SBThread(%p)::GetStopReason () => %s", exe_ctx.GetThreadPtr(),
+ log->Printf ("SBThread(%p)::GetStopReason () => %s",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
Thread::StopReasonAsCString (reason));
return reason;
@@ -183,7 +223,8 @@ SBThread::GetStopReasonDataCount ()
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBThread(%p)::GetStopReasonDataCount() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetStopReasonDataCount() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
return 0;
@@ -226,7 +267,7 @@ SBThread::GetStopReasonDataAtIndex (uint32_t idx)
BreakpointLocationSP bp_loc_sp (bp_site_sp->GetOwnerAtIndex (bp_index));
if (bp_loc_sp)
{
- if (bp_index & 1)
+ if (idx & 1)
{
// Odd idx, return the breakpoint location ID
return bp_loc_sp->GetID();
@@ -257,7 +298,8 @@ SBThread::GetStopReasonDataAtIndex (uint32_t idx)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBThread(%p)::GetStopReasonDataAtIndex() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetStopReasonDataAtIndex() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
return 0;
@@ -284,8 +326,9 @@ SBThread::GetStopDescription (char *dst, size_t dst_len)
if (stop_desc)
{
if (log)
- log->Printf ("SBThread(%p)::GetStopDescription (dst, dst_len) => \"%s\"",
- exe_ctx.GetThreadPtr(), stop_desc);
+ 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,19 +405,20 @@ SBThread::GetStopDescription (char *dst, size_t dst_len)
default:
break;
}
-
+
if (stop_desc && stop_desc[0])
{
if (log)
- log->Printf ("SBThread(%p)::GetStopDescription (dst, dst_len) => '%s'",
- exe_ctx.GetThreadPtr(), stop_desc);
+ 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
if (stop_desc_len == 0)
stop_desc_len = ::strlen (stop_desc) + 1; // Include the NULL byte
-
+
return stop_desc_len;
}
}
@@ -384,7 +428,8 @@ SBThread::GetStopDescription (char *dst, size_t dst_len)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBThread(%p)::GetStopDescription() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetStopDescription() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
if (dst)
@@ -414,16 +459,18 @@ SBThread::GetStopReturnValue ()
else
{
if (log)
- log->Printf ("SBThread(%p)::GetStopReturnValue() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetStopReturnValue() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
-
+
if (log)
- log->Printf ("SBThread(%p)::GetStopReturnValue () => %s", exe_ctx.GetThreadPtr(),
- return_valobj_sp.get()
- ? return_valobj_sp->GetValueAsCString()
- : "<no return value>");
-
+ 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);
}
@@ -469,12 +516,15 @@ SBThread::GetName () const
else
{
if (log)
- log->Printf ("SBThread(%p)::GetName() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetName() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
-
+
if (log)
- log->Printf ("SBThread(%p)::GetName () => %s", exe_ctx.GetThreadPtr(), name ? name : "NULL");
+ log->Printf ("SBThread(%p)::GetName () => %s",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
+ name ? name : "NULL");
return name;
}
@@ -497,12 +547,15 @@ SBThread::GetQueueName () const
else
{
if (log)
- log->Printf ("SBThread(%p)::GetQueueName() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetQueueName() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
-
+
if (log)
- log->Printf ("SBThread(%p)::GetQueueName () => %s", exe_ctx.GetThreadPtr(), name ? name : "NULL");
+ log->Printf ("SBThread(%p)::GetQueueName () => %s",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
+ name ? name : "NULL");
return name;
}
@@ -525,16 +578,86 @@ SBThread::GetQueueID () const
else
{
if (log)
- log->Printf ("SBThread(%p)::GetQueueID() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetQueueID() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
-
+
if (log)
- log->Printf ("SBThread(%p)::GetQueueID () => 0x%" PRIx64, exe_ctx.GetThreadPtr(), id);
+ 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));
+ bool success = false;
+ Mutex::Locker api_locker;
+ ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+
+ if (exe_ctx.HasThreadScope())
+ {
+ Process::StopLocker stop_locker;
+ if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock()))
+ {
+ Thread *thread = exe_ctx.GetThreadPtr();
+ StructuredData::ObjectSP info_root_sp = thread->GetExtendedInfo();
+ if (info_root_sp)
+ {
+ StructuredData::ObjectSP node = info_root_sp->GetObjectForDotSeparatedPath (path);
+ if (node)
+ {
+ if (node->GetType() == StructuredData::Type::eTypeString)
+ {
+ strm.Printf ("%s", node->GetAsString()->GetValue().c_str());
+ success = true;
+ }
+ if (node->GetType() == StructuredData::Type::eTypeInteger)
+ {
+ strm.Printf ("0x%" PRIx64, node->GetAsInteger()->GetValue());
+ success = true;
+ }
+ if (node->GetType() == StructuredData::Type::eTypeFloat)
+ {
+ strm.Printf ("0x%f", node->GetAsFloat()->GetValue());
+ success = true;
+ }
+ if (node->GetType() == StructuredData::Type::eTypeBoolean)
+ {
+ if (node->GetAsBoolean()->GetValue() == true)
+ strm.Printf ("true");
+ else
+ strm.Printf ("false");
+ success = true;
+ }
+ if (node->GetType() == StructuredData::Type::eTypeNull)
+ {
+ strm.Printf ("null");
+ success = true;
+ }
+ }
+ }
+ }
+ 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",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
+ strm.GetData());
+
+ return success;
+}
+
+
SBError
SBThread::ResumeNewPlan (ExecutionContext &exe_ctx, ThreadPlan *new_plan)
{
@@ -587,9 +710,10 @@ SBThread::StepOver (lldb::RunMode stop_other_threads)
if (log)
- log->Printf ("SBThread(%p)::StepOver (stop_other_threads='%s')", exe_ctx.GetThreadPtr(),
+ log->Printf ("SBThread(%p)::StepOver (stop_other_threads='%s')",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
Thread::RunModeAsCString (stop_other_threads));
-
+
if (exe_ctx.HasThreadScope())
{
Thread *thread = exe_ctx.GetThreadPtr();
@@ -601,17 +725,19 @@ SBThread::StepOver (lldb::RunMode stop_other_threads)
{
if (frame_sp->HasDebugInformation ())
{
+ const LazyBool avoid_no_debug = eLazyBoolCalculate;
SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
new_plan_sp = thread->QueueThreadPlanForStepOverRange (abort_other_plans,
sc.line_entry.range,
sc,
- stop_other_threads);
+ stop_other_threads,
+ avoid_no_debug);
}
else
{
new_plan_sp = thread->QueueThreadPlanForStepSingleInstruction (true,
- abort_other_plans,
- stop_other_threads);
+ abort_other_plans,
+ stop_other_threads);
}
}
@@ -636,10 +762,10 @@ SBThread::StepInto (const char *target_name, lldb::RunMode stop_other_threads)
if (log)
log->Printf ("SBThread(%p)::StepInto (target_name='%s', stop_other_threads='%s')",
- exe_ctx.GetThreadPtr(),
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
target_name? target_name: "<NULL>",
Thread::RunModeAsCString (stop_other_threads));
-
+
if (exe_ctx.HasThreadScope())
{
bool abort_other_plans = false;
@@ -650,22 +776,24 @@ SBThread::StepInto (const char *target_name, lldb::RunMode stop_other_threads)
if (frame_sp && frame_sp->HasDebugInformation ())
{
- bool avoid_code_without_debug_info = true;
+ const LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate;
+ const LazyBool step_in_avoids_code_without_debug_info = eLazyBoolCalculate;
SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
new_plan_sp = thread->QueueThreadPlanForStepInRange (abort_other_plans,
sc.line_entry.range,
sc,
target_name,
stop_other_threads,
- avoid_code_without_debug_info);
+ step_in_avoids_code_without_debug_info,
+ step_out_avoids_code_without_debug_info);
}
else
{
new_plan_sp = thread->QueueThreadPlanForStepSingleInstruction (false,
- abort_other_plans,
- stop_other_threads);
+ abort_other_plans,
+ stop_other_threads);
}
-
+
// This returns an error, we should use it!
ResumeNewPlan (exe_ctx, new_plan_sp.get());
}
@@ -681,8 +809,9 @@ SBThread::StepOut ()
if (log)
- log->Printf ("SBThread(%p)::StepOut ()", exe_ctx.GetThreadPtr());
-
+ log->Printf ("SBThread(%p)::StepOut ()",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
+
if (exe_ctx.HasThreadScope())
{
bool abort_other_plans = false;
@@ -690,14 +819,16 @@ SBThread::StepOut ()
Thread *thread = exe_ctx.GetThreadPtr();
+ const LazyBool avoid_no_debug = eLazyBoolCalculate;
ThreadPlanSP new_plan_sp(thread->QueueThreadPlanForStepOut (abort_other_plans,
- NULL,
- false,
- stop_other_threads,
- eVoteYes,
- eVoteNoOpinion,
- 0));
-
+ NULL,
+ false,
+ stop_other_threads,
+ eVoteYes,
+ eVoteNoOpinion,
+ 0,
+ avoid_no_debug));
+
// This returns an error, we should use it!
ResumeNewPlan (exe_ctx, new_plan_sp.get());
}
@@ -716,7 +847,10 @@ SBThread::StepOutOfFrame (lldb::SBFrame &sb_frame)
{
SBStream frame_desc_strm;
sb_frame.GetDescription (frame_desc_strm);
- log->Printf ("SBThread(%p)::StepOutOfFrame (frame = SBFrame(%p): %s)", exe_ctx.GetThreadPtr(), frame_sp.get(), frame_desc_strm.GetData());
+ 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())
@@ -726,13 +860,13 @@ SBThread::StepOutOfFrame (lldb::SBFrame &sb_frame)
Thread *thread = exe_ctx.GetThreadPtr();
ThreadPlanSP new_plan_sp(thread->QueueThreadPlanForStepOut (abort_other_plans,
- NULL,
- false,
- stop_other_threads,
- eVoteYes,
+ NULL,
+ false,
+ stop_other_threads,
+ eVoteYes,
eVoteNoOpinion,
frame_sp->GetFrameIndex()));
-
+
// This returns an error, we should use it!
ResumeNewPlan (exe_ctx, new_plan_sp.get());
}
@@ -749,13 +883,14 @@ SBThread::StepInstruction (bool step_over)
if (log)
- log->Printf ("SBThread(%p)::StepInstruction (step_over=%i)", exe_ctx.GetThreadPtr(), step_over);
-
+ log->Printf ("SBThread(%p)::StepInstruction (step_over=%i)",
+ static_cast<void*>(exe_ctx.GetThreadPtr()), step_over);
+
if (exe_ctx.HasThreadScope())
{
Thread *thread = exe_ctx.GetThreadPtr();
ThreadPlanSP new_plan_sp(thread->QueueThreadPlanForStepSingleInstruction (step_over, true, true));
-
+
// This returns an error, we should use it!
ResumeNewPlan (exe_ctx, new_plan_sp.get());
}
@@ -771,8 +906,9 @@ SBThread::RunToAddress (lldb::addr_t addr)
if (log)
- log->Printf ("SBThread(%p)::RunToAddress (addr=0x%" PRIx64 ")", exe_ctx.GetThreadPtr(), addr);
-
+ log->Printf ("SBThread(%p)::RunToAddress (addr=0x%" PRIx64 ")",
+ static_cast<void*>(exe_ctx.GetThreadPtr()), addr);
+
if (exe_ctx.HasThreadScope())
{
bool abort_other_plans = false;
@@ -783,7 +919,7 @@ SBThread::RunToAddress (lldb::addr_t addr)
Thread *thread = exe_ctx.GetThreadPtr();
ThreadPlanSP new_plan_sp(thread->QueueThreadPlanForRunToAddress (abort_other_plans, target_addr, stop_other_threads));
-
+
// This returns an error, we should use it!
ResumeNewPlan (exe_ctx, new_plan_sp.get());
}
@@ -797,7 +933,7 @@ SBThread::StepOverUntil (lldb::SBFrame &sb_frame,
SBError sb_error;
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
char path[PATH_MAX];
-
+
Mutex::Locker api_locker;
ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
@@ -808,11 +944,10 @@ SBThread::StepOverUntil (lldb::SBFrame &sb_frame,
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)",
- exe_ctx.GetThreadPtr(),
- frame_sp.get(),
- frame_desc_strm.GetData(),
- path, line);
+ 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())
@@ -825,14 +960,14 @@ SBThread::StepOverUntil (lldb::SBFrame &sb_frame,
sb_error.SetErrorString("invalid line argument");
return sb_error;
}
-
+
if (!frame_sp)
{
frame_sp = thread->GetSelectedFrame ();
if (!frame_sp)
frame_sp = thread->GetStackFrameAtIndex (0);
}
-
+
SymbolContext frame_sc;
if (!frame_sp)
{
@@ -845,13 +980,13 @@ SBThread::StepOverUntil (lldb::SBFrame &sb_frame,
eSymbolContextFunction |
eSymbolContextLineEntry |
eSymbolContextSymbol );
-
+
if (frame_sc.comp_unit == NULL)
{
sb_error.SetErrorStringWithFormat("frame %u doesn't have debug information", frame_sp->GetFrameIndex());
return sb_error;
}
-
+
FileSpec step_file_spec;
if (sb_file_spec.IsValid())
{
@@ -868,15 +1003,15 @@ SBThread::StepOverUntil (lldb::SBFrame &sb_frame,
return sb_error;
}
}
-
+
// Grab the current function, then we will make sure the "until" address is
// within the function. We discard addresses that are out of the current
// function, and then if there are no addresses remaining, give an appropriate
// error message.
-
+
bool all_in_function = true;
AddressRange fun_range = frame_sc.function->GetAddressRange();
-
+
std::vector<addr_t> step_over_until_addrs;
const bool abort_other_plans = false;
const bool stop_other_threads = false;
@@ -908,7 +1043,7 @@ SBThread::StepOverUntil (lldb::SBFrame &sb_frame,
}
}
}
-
+
if (step_over_until_addrs.empty())
{
if (all_in_function)
@@ -947,7 +1082,9 @@ SBThread::JumpToLine (lldb::SBFileSpec &file_spec, uint32_t line)
ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
if (log)
- log->Printf ("SBThread(%p)::JumpToLine (file+line = %s:%u)", exe_ctx.GetThreadPtr(), file_spec->GetPath().c_str(), line);
+ 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())
{
@@ -966,7 +1103,7 @@ SBError
SBThread::ReturnFromFrame (SBFrame &frame, SBValue &return_value)
{
SBError sb_error;
-
+
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Mutex::Locker api_locker;
@@ -974,14 +1111,16 @@ SBThread::ReturnFromFrame (SBFrame &frame, SBValue &return_value)
if (log)
- log->Printf ("SBThread(%p)::ReturnFromFrame (frame=%d)", exe_ctx.GetThreadPtr(), frame.GetFrameID());
-
+ 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;
}
@@ -1003,11 +1142,13 @@ SBThread::Suspend()
else
{
if (log)
- log->Printf ("SBThread(%p)::Suspend() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::Suspend() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
if (log)
- log->Printf ("SBThread(%p)::Suspend() => %i", exe_ctx.GetThreadPtr(), result);
+ log->Printf ("SBThread(%p)::Suspend() => %i",
+ static_cast<void*>(exe_ctx.GetThreadPtr()), result);
return result;
}
@@ -1022,17 +1163,20 @@ SBThread::Resume ()
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock()))
{
- exe_ctx.GetThreadPtr()->SetResumeState (eStateRunning);
+ const bool override_suspend = true;
+ exe_ctx.GetThreadPtr()->SetResumeState (eStateRunning, override_suspend);
result = true;
}
else
{
if (log)
- log->Printf ("SBThread(%p)::Resume() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::Resume() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
if (log)
- log->Printf ("SBThread(%p)::Resume() => %i", exe_ctx.GetThreadPtr(), result);
+ log->Printf ("SBThread(%p)::Resume() => %i",
+ static_cast<void*>(exe_ctx.GetThreadPtr()), result);
return result;
}
@@ -1070,8 +1214,10 @@ SBThread::GetProcess ()
{
SBStream frame_desc_strm;
sb_process.GetDescription (frame_desc_strm);
- log->Printf ("SBThread(%p)::GetProcess () => SBProcess(%p): %s", exe_ctx.GetThreadPtr(),
- sb_process.GetSP().get(), frame_desc_strm.GetData());
+ 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;
@@ -1096,12 +1242,14 @@ SBThread::GetNumFrames ()
else
{
if (log)
- log->Printf ("SBThread(%p)::GetNumFrames() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetNumFrames() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
if (log)
- log->Printf ("SBThread(%p)::GetNumFrames () => %u", exe_ctx.GetThreadPtr(), num_frames);
+ log->Printf ("SBThread(%p)::GetNumFrames () => %u",
+ static_cast<void*>(exe_ctx.GetThreadPtr()), num_frames);
return num_frames;
}
@@ -1127,7 +1275,8 @@ SBThread::GetFrameAtIndex (uint32_t idx)
else
{
if (log)
- log->Printf ("SBThread(%p)::GetFrameAtIndex() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetFrameAtIndex() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
@@ -1135,8 +1284,10 @@ SBThread::GetFrameAtIndex (uint32_t idx)
{
SBStream frame_desc_strm;
sb_frame.GetDescription (frame_desc_strm);
- log->Printf ("SBThread(%p)::GetFrameAtIndex (idx=%d) => SBFrame(%p): %s",
- exe_ctx.GetThreadPtr(), idx, frame_sp.get(), frame_desc_strm.GetData());
+ 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;
@@ -1163,7 +1314,8 @@ SBThread::GetSelectedFrame ()
else
{
if (log)
- log->Printf ("SBThread(%p)::GetSelectedFrame() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetSelectedFrame() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
@@ -1171,8 +1323,10 @@ SBThread::GetSelectedFrame ()
{
SBStream frame_desc_strm;
sb_frame.GetDescription (frame_desc_strm);
- log->Printf ("SBThread(%p)::GetSelectedFrame () => SBFrame(%p): %s",
- exe_ctx.GetThreadPtr(), frame_sp.get(), frame_desc_strm.GetData());
+ 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;
@@ -1204,7 +1358,8 @@ SBThread::SetSelectedFrame (uint32_t idx)
else
{
if (log)
- log->Printf ("SBThread(%p)::SetSelectedFrame() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::SetSelectedFrame() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
@@ -1212,8 +1367,10 @@ SBThread::SetSelectedFrame (uint32_t idx)
{
SBStream frame_desc_strm;
sb_frame.GetDescription (frame_desc_strm);
- log->Printf ("SBThread(%p)::SetSelectedFrame (idx=%u) => SBFrame(%p): %s",
- exe_ctx.GetThreadPtr(), idx, frame_sp.get(), frame_desc_strm.GetData());
+ 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;
}
@@ -1316,7 +1473,11 @@ SBThread::GetExtendedBacktraceThread (const char *type)
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'", exe_ctx.GetThreadPtr(), new_thread_sp.get(), new_thread_sp->GetQueueID(), 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);
}
}
}
@@ -1326,10 +1487,14 @@ SBThread::GetExtendedBacktraceThread (const char *type)
else
{
if (log)
- log->Printf ("SBThread(%p)::GetExtendedBacktraceThread() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetExtendedBacktraceThread() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
+ if (log && sb_origin_thread.IsValid() == false)
+ log->Printf("SBThread(%p)::GetExtendedBacktraceThread() is not returning a Valid thread",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
return sb_origin_thread;
}
@@ -1341,3 +1506,12 @@ SBThread::GetExtendedBacktraceOriginatingIndexID ()
return thread_sp->GetExtendedBacktraceOriginatingIndexID();
return LLDB_INVALID_INDEX32;
}
+
+bool
+SBThread::SafeToCallFunctions ()
+{
+ ThreadSP thread_sp(m_opaque_sp->GetThreadSP());
+ if (thread_sp)
+ return thread_sp->SafeToCallFunctions();
+ return true;
+}