1 //===-- SBThread.cpp --------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "lldb/API/SBThread.h"
12 #include "lldb/API/SBFileSpec.h"
13 #include "lldb/API/SBStream.h"
14 #include "lldb/API/SBSymbolContext.h"
15 #include "lldb/Breakpoint/BreakpointLocation.h"
16 #include "lldb/Core/Debugger.h"
17 #include "lldb/Core/State.h"
18 #include "lldb/Core/StreamFile.h"
19 #include "lldb/Core/StructuredData.h"
20 #include "lldb/Core/ValueObject.h"
21 #include "lldb/Interpreter/CommandInterpreter.h"
22 #include "lldb/Symbol/CompileUnit.h"
23 #include "lldb/Symbol/SymbolContext.h"
24 #include "lldb/Target/Process.h"
25 #include "lldb/Target/Queue.h"
26 #include "lldb/Target/StopInfo.h"
27 #include "lldb/Target/SystemRuntime.h"
28 #include "lldb/Target/Target.h"
29 #include "lldb/Target/Thread.h"
30 #include "lldb/Target/ThreadPlan.h"
31 #include "lldb/Target/ThreadPlanStepInRange.h"
32 #include "lldb/Target/ThreadPlanStepInstruction.h"
33 #include "lldb/Target/ThreadPlanStepOut.h"
34 #include "lldb/Target/ThreadPlanStepRange.h"
35 #include "lldb/Target/UnixSignals.h"
36 #include "lldb/Utility/Stream.h"
38 #include "lldb/API/SBAddress.h"
39 #include "lldb/API/SBDebugger.h"
40 #include "lldb/API/SBEvent.h"
41 #include "lldb/API/SBFrame.h"
42 #include "lldb/API/SBProcess.h"
43 #include "lldb/API/SBThreadCollection.h"
44 #include "lldb/API/SBThreadPlan.h"
45 #include "lldb/API/SBValue.h"
48 using namespace lldb_private;
50 const char *SBThread::GetBroadcasterClassName() {
51 return Thread::GetStaticBroadcasterClass().AsCString();
54 //----------------------------------------------------------------------
56 //----------------------------------------------------------------------
57 SBThread::SBThread() : m_opaque_sp(new ExecutionContextRef()) {}
59 SBThread::SBThread(const ThreadSP &lldb_object_sp)
60 : m_opaque_sp(new ExecutionContextRef(lldb_object_sp)) {}
62 SBThread::SBThread(const SBThread &rhs)
63 : m_opaque_sp(new ExecutionContextRef(*rhs.m_opaque_sp)) {}
65 //----------------------------------------------------------------------
66 // Assignment operator
67 //----------------------------------------------------------------------
69 const lldb::SBThread &SBThread::operator=(const SBThread &rhs) {
71 *m_opaque_sp = *rhs.m_opaque_sp;
75 //----------------------------------------------------------------------
77 //----------------------------------------------------------------------
78 SBThread::~SBThread() {}
80 lldb::SBQueue SBThread::GetQueue() const {
83 std::unique_lock<std::recursive_mutex> lock;
84 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
86 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
87 if (exe_ctx.HasThreadScope()) {
88 Process::StopLocker stop_locker;
89 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
90 queue_sp = exe_ctx.GetThreadPtr()->GetQueue();
92 sb_queue.SetQueue(queue_sp);
96 log->Printf("SBThread(%p)::GetQueue() => error: process is running",
97 static_cast<void *>(exe_ctx.GetThreadPtr()));
102 log->Printf("SBThread(%p)::GetQueue () => SBQueue(%p)",
103 static_cast<void *>(exe_ctx.GetThreadPtr()),
104 static_cast<void *>(queue_sp.get()));
109 bool SBThread::IsValid() const {
110 std::unique_lock<std::recursive_mutex> lock;
111 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
113 Target *target = exe_ctx.GetTargetPtr();
114 Process *process = exe_ctx.GetProcessPtr();
115 if (target && process) {
116 Process::StopLocker stop_locker;
117 if (stop_locker.TryLock(&process->GetRunLock()))
118 return m_opaque_sp->GetThreadSP().get() != NULL;
120 // Without a valid target & process, this thread can't be valid.
124 void SBThread::Clear() { m_opaque_sp->Clear(); }
126 StopReason SBThread::GetStopReason() {
127 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
129 StopReason reason = eStopReasonInvalid;
130 std::unique_lock<std::recursive_mutex> lock;
131 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
133 if (exe_ctx.HasThreadScope()) {
134 Process::StopLocker stop_locker;
135 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
136 return exe_ctx.GetThreadPtr()->GetStopReason();
140 "SBThread(%p)::GetStopReason() => error: process is running",
141 static_cast<void *>(exe_ctx.GetThreadPtr()));
146 log->Printf("SBThread(%p)::GetStopReason () => %s",
147 static_cast<void *>(exe_ctx.GetThreadPtr()),
148 Thread::StopReasonAsCString(reason));
153 size_t SBThread::GetStopReasonDataCount() {
154 std::unique_lock<std::recursive_mutex> lock;
155 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
157 if (exe_ctx.HasThreadScope()) {
158 Process::StopLocker stop_locker;
159 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
160 StopInfoSP stop_info_sp = exe_ctx.GetThreadPtr()->GetStopInfo();
162 StopReason reason = stop_info_sp->GetStopReason();
164 case eStopReasonInvalid:
165 case eStopReasonNone:
166 case eStopReasonTrace:
167 case eStopReasonExec:
168 case eStopReasonPlanComplete:
169 case eStopReasonThreadExiting:
170 case eStopReasonInstrumentation:
171 // There is no data for these stop reasons.
174 case eStopReasonBreakpoint: {
175 break_id_t site_id = stop_info_sp->GetValue();
176 lldb::BreakpointSiteSP bp_site_sp(
177 exe_ctx.GetProcessPtr()->GetBreakpointSiteList().FindByID(
180 return bp_site_sp->GetNumberOfOwners() * 2;
182 return 0; // Breakpoint must have cleared itself...
185 case eStopReasonWatchpoint:
188 case eStopReasonSignal:
191 case eStopReasonException:
196 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
198 log->Printf("SBThread(%p)::GetStopReasonDataCount() => error: process "
200 static_cast<void *>(exe_ctx.GetThreadPtr()));
206 uint64_t SBThread::GetStopReasonDataAtIndex(uint32_t idx) {
207 std::unique_lock<std::recursive_mutex> lock;
208 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
210 if (exe_ctx.HasThreadScope()) {
211 Process::StopLocker stop_locker;
212 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
213 Thread *thread = exe_ctx.GetThreadPtr();
214 StopInfoSP stop_info_sp = thread->GetStopInfo();
216 StopReason reason = stop_info_sp->GetStopReason();
218 case eStopReasonInvalid:
219 case eStopReasonNone:
220 case eStopReasonTrace:
221 case eStopReasonExec:
222 case eStopReasonPlanComplete:
223 case eStopReasonThreadExiting:
224 case eStopReasonInstrumentation:
225 // There is no data for these stop reasons.
228 case eStopReasonBreakpoint: {
229 break_id_t site_id = stop_info_sp->GetValue();
230 lldb::BreakpointSiteSP bp_site_sp(
231 exe_ctx.GetProcessPtr()->GetBreakpointSiteList().FindByID(
234 uint32_t bp_index = idx / 2;
235 BreakpointLocationSP bp_loc_sp(
236 bp_site_sp->GetOwnerAtIndex(bp_index));
239 // Odd idx, return the breakpoint location ID
240 return bp_loc_sp->GetID();
242 // Even idx, return the breakpoint ID
243 return bp_loc_sp->GetBreakpoint().GetID();
247 return LLDB_INVALID_BREAK_ID;
250 case eStopReasonWatchpoint:
251 return stop_info_sp->GetValue();
253 case eStopReasonSignal:
254 return stop_info_sp->GetValue();
256 case eStopReasonException:
257 return stop_info_sp->GetValue();
261 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
263 log->Printf("SBThread(%p)::GetStopReasonDataAtIndex() => error: "
264 "process is running",
265 static_cast<void *>(exe_ctx.GetThreadPtr()));
271 bool SBThread::GetStopReasonExtendedInfoAsJSON(lldb::SBStream &stream) {
272 Stream &strm = stream.ref();
274 std::unique_lock<std::recursive_mutex> lock;
275 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
277 if (!exe_ctx.HasThreadScope())
280 StopInfoSP stop_info = exe_ctx.GetThreadPtr()->GetStopInfo();
281 StructuredData::ObjectSP info = stop_info->GetExtendedInfo();
291 SBThread::GetStopReasonExtendedBacktraces(InstrumentationRuntimeType type) {
292 ThreadCollectionSP threads;
293 threads.reset(new ThreadCollection());
295 // We currently only support ThreadSanitizer.
296 if (type != eInstrumentationRuntimeTypeThreadSanitizer)
299 std::unique_lock<std::recursive_mutex> lock;
300 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
302 if (!exe_ctx.HasThreadScope())
305 ProcessSP process_sp = exe_ctx.GetProcessSP();
307 StopInfoSP stop_info = exe_ctx.GetThreadPtr()->GetStopInfo();
308 StructuredData::ObjectSP info = stop_info->GetExtendedInfo();
312 return process_sp->GetInstrumentationRuntime(type)
313 ->GetBacktracesFromExtendedStopInfo(info);
316 size_t SBThread::GetStopDescription(char *dst, size_t dst_len) {
317 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
319 std::unique_lock<std::recursive_mutex> lock;
320 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
322 if (exe_ctx.HasThreadScope()) {
323 Process::StopLocker stop_locker;
324 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
326 StopInfoSP stop_info_sp = exe_ctx.GetThreadPtr()->GetStopInfo();
328 const char *stop_desc = stop_info_sp->GetDescription();
332 "SBThread(%p)::GetStopDescription (dst, dst_len) => \"%s\"",
333 static_cast<void *>(exe_ctx.GetThreadPtr()), stop_desc);
335 return ::snprintf(dst, dst_len, "%s", stop_desc);
337 // NULL dst passed in, return the length needed to contain the
339 return ::strlen(stop_desc) + 1; // Include the NULL byte for size
342 size_t stop_desc_len = 0;
343 switch (stop_info_sp->GetStopReason()) {
344 case eStopReasonTrace:
345 case eStopReasonPlanComplete: {
346 static char trace_desc[] = "step";
347 stop_desc = trace_desc;
349 sizeof(trace_desc); // Include the NULL byte for size
352 case eStopReasonBreakpoint: {
353 static char bp_desc[] = "breakpoint hit";
355 stop_desc_len = sizeof(bp_desc); // Include the NULL byte for size
358 case eStopReasonWatchpoint: {
359 static char wp_desc[] = "watchpoint hit";
361 stop_desc_len = sizeof(wp_desc); // Include the NULL byte for size
364 case eStopReasonSignal: {
366 exe_ctx.GetProcessPtr()->GetUnixSignals()->GetSignalAsCString(
367 stop_info_sp->GetValue());
368 if (stop_desc == NULL || stop_desc[0] == '\0') {
369 static char signal_desc[] = "signal";
370 stop_desc = signal_desc;
372 sizeof(signal_desc); // Include the NULL byte for size
376 case eStopReasonException: {
377 char exc_desc[] = "exception";
378 stop_desc = exc_desc;
379 stop_desc_len = sizeof(exc_desc); // Include the NULL byte for size
382 case eStopReasonExec: {
383 char exc_desc[] = "exec";
384 stop_desc = exc_desc;
385 stop_desc_len = sizeof(exc_desc); // Include the NULL byte for size
388 case eStopReasonThreadExiting: {
389 char limbo_desc[] = "thread exiting";
390 stop_desc = limbo_desc;
391 stop_desc_len = sizeof(limbo_desc);
397 if (stop_desc && stop_desc[0]) {
400 "SBThread(%p)::GetStopDescription (dst, dst_len) => '%s'",
401 static_cast<void *>(exe_ctx.GetThreadPtr()), stop_desc);
404 return ::snprintf(dst, dst_len, "%s", stop_desc) +
405 1; // Include the NULL byte
407 if (stop_desc_len == 0)
408 stop_desc_len = ::strlen(stop_desc) + 1; // Include the NULL byte
410 return stop_desc_len;
415 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
418 "SBThread(%p)::GetStopDescription() => error: process is running",
419 static_cast<void *>(exe_ctx.GetThreadPtr()));
427 SBValue SBThread::GetStopReturnValue() {
428 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
429 ValueObjectSP return_valobj_sp;
430 std::unique_lock<std::recursive_mutex> lock;
431 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
433 if (exe_ctx.HasThreadScope()) {
434 Process::StopLocker stop_locker;
435 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
436 StopInfoSP stop_info_sp = exe_ctx.GetThreadPtr()->GetStopInfo();
438 return_valobj_sp = StopInfo::GetReturnValueObject(stop_info_sp);
443 "SBThread(%p)::GetStopReturnValue() => error: process is running",
444 static_cast<void *>(exe_ctx.GetThreadPtr()));
449 log->Printf("SBThread(%p)::GetStopReturnValue () => %s",
450 static_cast<void *>(exe_ctx.GetThreadPtr()),
451 return_valobj_sp.get() ? return_valobj_sp->GetValueAsCString()
452 : "<no return value>");
454 return SBValue(return_valobj_sp);
457 void SBThread::SetThread(const ThreadSP &lldb_object_sp) {
458 m_opaque_sp->SetThreadSP(lldb_object_sp);
461 lldb::tid_t SBThread::GetThreadID() const {
462 ThreadSP thread_sp(m_opaque_sp->GetThreadSP());
464 return thread_sp->GetID();
465 return LLDB_INVALID_THREAD_ID;
468 uint32_t SBThread::GetIndexID() const {
469 ThreadSP thread_sp(m_opaque_sp->GetThreadSP());
471 return thread_sp->GetIndexID();
472 return LLDB_INVALID_INDEX32;
475 const char *SBThread::GetName() const {
476 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
477 const char *name = NULL;
478 std::unique_lock<std::recursive_mutex> lock;
479 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
481 if (exe_ctx.HasThreadScope()) {
482 Process::StopLocker stop_locker;
483 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
484 name = exe_ctx.GetThreadPtr()->GetName();
487 log->Printf("SBThread(%p)::GetName() => error: process is running",
488 static_cast<void *>(exe_ctx.GetThreadPtr()));
493 log->Printf("SBThread(%p)::GetName () => %s",
494 static_cast<void *>(exe_ctx.GetThreadPtr()),
495 name ? name : "NULL");
500 const char *SBThread::GetQueueName() const {
501 const char *name = NULL;
502 std::unique_lock<std::recursive_mutex> lock;
503 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
505 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
506 if (exe_ctx.HasThreadScope()) {
507 Process::StopLocker stop_locker;
508 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
509 name = exe_ctx.GetThreadPtr()->GetQueueName();
512 log->Printf("SBThread(%p)::GetQueueName() => error: process is running",
513 static_cast<void *>(exe_ctx.GetThreadPtr()));
518 log->Printf("SBThread(%p)::GetQueueName () => %s",
519 static_cast<void *>(exe_ctx.GetThreadPtr()),
520 name ? name : "NULL");
525 lldb::queue_id_t SBThread::GetQueueID() const {
526 queue_id_t id = LLDB_INVALID_QUEUE_ID;
527 std::unique_lock<std::recursive_mutex> lock;
528 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
530 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
531 if (exe_ctx.HasThreadScope()) {
532 Process::StopLocker stop_locker;
533 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
534 id = exe_ctx.GetThreadPtr()->GetQueueID();
537 log->Printf("SBThread(%p)::GetQueueID() => error: process is running",
538 static_cast<void *>(exe_ctx.GetThreadPtr()));
543 log->Printf("SBThread(%p)::GetQueueID () => 0x%" PRIx64,
544 static_cast<void *>(exe_ctx.GetThreadPtr()), id);
549 bool SBThread::GetInfoItemByPathAsString(const char *path, SBStream &strm) {
550 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
551 bool success = false;
552 std::unique_lock<std::recursive_mutex> lock;
553 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
555 if (exe_ctx.HasThreadScope()) {
556 Process::StopLocker stop_locker;
557 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
558 Thread *thread = exe_ctx.GetThreadPtr();
559 StructuredData::ObjectSP info_root_sp = thread->GetExtendedInfo();
561 StructuredData::ObjectSP node =
562 info_root_sp->GetObjectForDotSeparatedPath(path);
564 if (node->GetType() == StructuredData::Type::eTypeString) {
565 strm.Printf("%s", node->GetAsString()->GetValue().c_str());
568 if (node->GetType() == StructuredData::Type::eTypeInteger) {
569 strm.Printf("0x%" PRIx64, node->GetAsInteger()->GetValue());
572 if (node->GetType() == StructuredData::Type::eTypeFloat) {
573 strm.Printf("0x%f", node->GetAsFloat()->GetValue());
576 if (node->GetType() == StructuredData::Type::eTypeBoolean) {
577 if (node->GetAsBoolean()->GetValue() == true)
580 strm.Printf("false");
583 if (node->GetType() == StructuredData::Type::eTypeNull) {
591 log->Printf("SBThread(%p)::GetInfoItemByPathAsString() => error: "
592 "process is running",
593 static_cast<void *>(exe_ctx.GetThreadPtr()));
598 log->Printf("SBThread(%p)::GetInfoItemByPathAsString (\"%s\") => \"%s\"",
599 static_cast<void *>(exe_ctx.GetThreadPtr()), path, strm.GetData());
604 SBError SBThread::ResumeNewPlan(ExecutionContext &exe_ctx,
605 ThreadPlan *new_plan) {
608 Process *process = exe_ctx.GetProcessPtr();
610 sb_error.SetErrorString("No process in SBThread::ResumeNewPlan");
614 Thread *thread = exe_ctx.GetThreadPtr();
616 sb_error.SetErrorString("No thread in SBThread::ResumeNewPlan");
620 // User level plans should be Master Plans so they can be interrupted, other
621 // plans executed, and
622 // then a "continue" will resume the plan.
623 if (new_plan != NULL) {
624 new_plan->SetIsMasterPlan(true);
625 new_plan->SetOkayToDiscard(false);
628 // Why do we need to set the current thread by ID here???
629 process->GetThreadList().SetSelectedThreadByID(thread->GetID());
631 if (process->GetTarget().GetDebugger().GetAsyncExecution())
632 sb_error.ref() = process->Resume();
634 sb_error.ref() = process->ResumeSynchronous(NULL);
639 void SBThread::StepOver(lldb::RunMode stop_other_threads) {
640 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
642 std::unique_lock<std::recursive_mutex> lock;
643 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
646 log->Printf("SBThread(%p)::StepOver (stop_other_threads='%s')",
647 static_cast<void *>(exe_ctx.GetThreadPtr()),
648 Thread::RunModeAsCString(stop_other_threads));
650 if (exe_ctx.HasThreadScope()) {
651 Thread *thread = exe_ctx.GetThreadPtr();
652 bool abort_other_plans = false;
653 StackFrameSP frame_sp(thread->GetStackFrameAtIndex(0));
655 ThreadPlanSP new_plan_sp;
657 if (frame_sp->HasDebugInformation()) {
658 const LazyBool avoid_no_debug = eLazyBoolCalculate;
659 SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
660 new_plan_sp = thread->QueueThreadPlanForStepOverRange(
661 abort_other_plans, sc.line_entry, sc, stop_other_threads,
664 new_plan_sp = thread->QueueThreadPlanForStepSingleInstruction(
665 true, abort_other_plans, stop_other_threads);
669 // This returns an error, we should use it!
670 ResumeNewPlan(exe_ctx, new_plan_sp.get());
674 void SBThread::StepInto(lldb::RunMode stop_other_threads) {
675 StepInto(NULL, stop_other_threads);
678 void SBThread::StepInto(const char *target_name,
679 lldb::RunMode stop_other_threads) {
681 StepInto(target_name, LLDB_INVALID_LINE_NUMBER, error, stop_other_threads);
684 void SBThread::StepInto(const char *target_name, uint32_t end_line,
685 SBError &error, lldb::RunMode stop_other_threads) {
686 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
688 std::unique_lock<std::recursive_mutex> lock;
689 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
693 "SBThread(%p)::StepInto (target_name='%s', stop_other_threads='%s')",
694 static_cast<void *>(exe_ctx.GetThreadPtr()),
695 target_name ? target_name : "<NULL>",
696 Thread::RunModeAsCString(stop_other_threads));
698 if (exe_ctx.HasThreadScope()) {
699 bool abort_other_plans = false;
701 Thread *thread = exe_ctx.GetThreadPtr();
702 StackFrameSP frame_sp(thread->GetStackFrameAtIndex(0));
703 ThreadPlanSP new_plan_sp;
705 if (frame_sp && frame_sp->HasDebugInformation()) {
706 SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
708 if (end_line == LLDB_INVALID_LINE_NUMBER)
709 range = sc.line_entry.range;
711 if (!sc.GetAddressRangeFromHereToEndLine(end_line, range, error.ref()))
715 const LazyBool step_out_avoids_code_without_debug_info =
717 const LazyBool step_in_avoids_code_without_debug_info =
719 new_plan_sp = thread->QueueThreadPlanForStepInRange(
720 abort_other_plans, range, sc, target_name, stop_other_threads,
721 step_in_avoids_code_without_debug_info,
722 step_out_avoids_code_without_debug_info);
724 new_plan_sp = thread->QueueThreadPlanForStepSingleInstruction(
725 false, abort_other_plans, stop_other_threads);
728 error = ResumeNewPlan(exe_ctx, new_plan_sp.get());
732 void SBThread::StepOut() {
733 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
735 std::unique_lock<std::recursive_mutex> lock;
736 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
739 log->Printf("SBThread(%p)::StepOut ()",
740 static_cast<void *>(exe_ctx.GetThreadPtr()));
742 if (exe_ctx.HasThreadScope()) {
743 bool abort_other_plans = false;
744 bool stop_other_threads = false;
746 Thread *thread = exe_ctx.GetThreadPtr();
748 const LazyBool avoid_no_debug = eLazyBoolCalculate;
749 ThreadPlanSP new_plan_sp(thread->QueueThreadPlanForStepOut(
750 abort_other_plans, NULL, false, stop_other_threads, eVoteYes,
751 eVoteNoOpinion, 0, avoid_no_debug));
753 // This returns an error, we should use it!
754 ResumeNewPlan(exe_ctx, new_plan_sp.get());
758 void SBThread::StepOutOfFrame(lldb::SBFrame &sb_frame) {
759 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
761 std::unique_lock<std::recursive_mutex> lock;
762 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
764 if (!sb_frame.IsValid()) {
767 "SBThread(%p)::StepOutOfFrame passed an invalid frame, returning.",
768 static_cast<void *>(exe_ctx.GetThreadPtr()));
772 StackFrameSP frame_sp(sb_frame.GetFrameSP());
774 SBStream frame_desc_strm;
775 sb_frame.GetDescription(frame_desc_strm);
776 log->Printf("SBThread(%p)::StepOutOfFrame (frame = SBFrame(%p): %s)",
777 static_cast<void *>(exe_ctx.GetThreadPtr()),
778 static_cast<void *>(frame_sp.get()), frame_desc_strm.GetData());
781 if (exe_ctx.HasThreadScope()) {
782 bool abort_other_plans = false;
783 bool stop_other_threads = false;
784 Thread *thread = exe_ctx.GetThreadPtr();
785 if (sb_frame.GetThread().GetThreadID() != thread->GetID()) {
786 log->Printf("SBThread(%p)::StepOutOfFrame passed a frame from another "
787 "thread (0x%" PRIx64 " vrs. 0x%" PRIx64 ", returning.",
788 static_cast<void *>(exe_ctx.GetThreadPtr()),
789 sb_frame.GetThread().GetThreadID(), thread->GetID());
792 ThreadPlanSP new_plan_sp(thread->QueueThreadPlanForStepOut(
793 abort_other_plans, NULL, false, stop_other_threads, eVoteYes,
794 eVoteNoOpinion, frame_sp->GetFrameIndex()));
796 // This returns an error, we should use it!
797 ResumeNewPlan(exe_ctx, new_plan_sp.get());
801 void SBThread::StepInstruction(bool step_over) {
802 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
804 std::unique_lock<std::recursive_mutex> lock;
805 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
808 log->Printf("SBThread(%p)::StepInstruction (step_over=%i)",
809 static_cast<void *>(exe_ctx.GetThreadPtr()), step_over);
811 if (exe_ctx.HasThreadScope()) {
812 Thread *thread = exe_ctx.GetThreadPtr();
813 ThreadPlanSP new_plan_sp(
814 thread->QueueThreadPlanForStepSingleInstruction(step_over, true, true));
816 // This returns an error, we should use it!
817 ResumeNewPlan(exe_ctx, new_plan_sp.get());
821 void SBThread::RunToAddress(lldb::addr_t addr) {
822 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
824 std::unique_lock<std::recursive_mutex> lock;
825 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
828 log->Printf("SBThread(%p)::RunToAddress (addr=0x%" PRIx64 ")",
829 static_cast<void *>(exe_ctx.GetThreadPtr()), addr);
831 if (exe_ctx.HasThreadScope()) {
832 bool abort_other_plans = false;
833 bool stop_other_threads = true;
835 Address target_addr(addr);
837 Thread *thread = exe_ctx.GetThreadPtr();
839 ThreadPlanSP new_plan_sp(thread->QueueThreadPlanForRunToAddress(
840 abort_other_plans, target_addr, stop_other_threads));
842 // This returns an error, we should use it!
843 ResumeNewPlan(exe_ctx, new_plan_sp.get());
847 SBError SBThread::StepOverUntil(lldb::SBFrame &sb_frame,
848 lldb::SBFileSpec &sb_file_spec, uint32_t line) {
850 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
853 std::unique_lock<std::recursive_mutex> lock;
854 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
856 StackFrameSP frame_sp(sb_frame.GetFrameSP());
859 SBStream frame_desc_strm;
860 sb_frame.GetDescription(frame_desc_strm);
861 sb_file_spec->GetPath(path, sizeof(path));
862 log->Printf("SBThread(%p)::StepOverUntil (frame = SBFrame(%p): %s, "
863 "file+line = %s:%u)",
864 static_cast<void *>(exe_ctx.GetThreadPtr()),
865 static_cast<void *>(frame_sp.get()), frame_desc_strm.GetData(),
869 if (exe_ctx.HasThreadScope()) {
870 Target *target = exe_ctx.GetTargetPtr();
871 Thread *thread = exe_ctx.GetThreadPtr();
874 sb_error.SetErrorString("invalid line argument");
879 frame_sp = thread->GetSelectedFrame();
881 frame_sp = thread->GetStackFrameAtIndex(0);
884 SymbolContext frame_sc;
886 sb_error.SetErrorString("no valid frames in thread to step");
890 // If we have a frame, get its line
891 frame_sc = frame_sp->GetSymbolContext(
892 eSymbolContextCompUnit | eSymbolContextFunction |
893 eSymbolContextLineEntry | eSymbolContextSymbol);
895 if (frame_sc.comp_unit == NULL) {
896 sb_error.SetErrorStringWithFormat(
897 "frame %u doesn't have debug information", frame_sp->GetFrameIndex());
901 FileSpec step_file_spec;
902 if (sb_file_spec.IsValid()) {
903 // The file spec passed in was valid, so use it
904 step_file_spec = sb_file_spec.ref();
906 if (frame_sc.line_entry.IsValid())
907 step_file_spec = frame_sc.line_entry.file;
909 sb_error.SetErrorString("invalid file argument or no file for frame");
914 // Grab the current function, then we will make sure the "until" address is
915 // within the function. We discard addresses that are out of the current
916 // function, and then if there are no addresses remaining, give an
920 bool all_in_function = true;
921 AddressRange fun_range = frame_sc.function->GetAddressRange();
923 std::vector<addr_t> step_over_until_addrs;
924 const bool abort_other_plans = false;
925 const bool stop_other_threads = false;
926 const bool check_inlines = true;
927 const bool exact = false;
929 SymbolContextList sc_list;
930 const uint32_t num_matches = frame_sc.comp_unit->ResolveSymbolContext(
931 step_file_spec, line, check_inlines, exact, eSymbolContextLineEntry,
933 if (num_matches > 0) {
935 for (uint32_t i = 0; i < num_matches; ++i) {
936 if (sc_list.GetContextAtIndex(i, sc)) {
938 sc.line_entry.range.GetBaseAddress().GetLoadAddress(target);
939 if (step_addr != LLDB_INVALID_ADDRESS) {
940 if (fun_range.ContainsLoadAddress(step_addr, target))
941 step_over_until_addrs.push_back(step_addr);
943 all_in_function = false;
949 if (step_over_until_addrs.empty()) {
950 if (all_in_function) {
951 step_file_spec.GetPath(path, sizeof(path));
952 sb_error.SetErrorStringWithFormat("No line entries for %s:%u", path,
955 sb_error.SetErrorString("step until target not in current function");
957 ThreadPlanSP new_plan_sp(thread->QueueThreadPlanForStepUntil(
958 abort_other_plans, &step_over_until_addrs[0],
959 step_over_until_addrs.size(), stop_other_threads,
960 frame_sp->GetFrameIndex()));
962 sb_error = ResumeNewPlan(exe_ctx, new_plan_sp.get());
965 sb_error.SetErrorString("this SBThread object is invalid");
970 SBError SBThread::StepUsingScriptedThreadPlan(const char *script_class_name) {
971 return StepUsingScriptedThreadPlan(script_class_name, true);
974 SBError SBThread::StepUsingScriptedThreadPlan(const char *script_class_name,
975 bool resume_immediately) {
976 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
979 std::unique_lock<std::recursive_mutex> lock;
980 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
983 log->Printf("SBThread(%p)::StepUsingScriptedThreadPlan: class name: %s",
984 static_cast<void *>(exe_ctx.GetThreadPtr()), script_class_name);
987 if (!exe_ctx.HasThreadScope()) {
988 sb_error.SetErrorString("this SBThread object is invalid");
992 Thread *thread = exe_ctx.GetThreadPtr();
993 ThreadPlanSP thread_plan_sp =
994 thread->QueueThreadPlanForStepScripted(false, script_class_name, false);
996 if (!thread_plan_sp) {
997 sb_error.SetErrorStringWithFormat(
998 "Error queueing thread plan for class: %s", script_class_name);
1002 if (!resume_immediately) {
1007 sb_error = ResumeNewPlan(exe_ctx, thread_plan_sp.get());
1009 sb_error.SetErrorStringWithFormat(
1010 "Error resuming thread plan for class: %s.", script_class_name);
1012 log->Printf("SBThread(%p)::StepUsingScriptedThreadPlan: Error queuing "
1013 "thread plan for class: %s",
1014 static_cast<void *>(exe_ctx.GetThreadPtr()),
1021 SBError SBThread::JumpToLine(lldb::SBFileSpec &file_spec, uint32_t line) {
1022 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1025 std::unique_lock<std::recursive_mutex> lock;
1026 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1029 log->Printf("SBThread(%p)::JumpToLine (file+line = %s:%u)",
1030 static_cast<void *>(exe_ctx.GetThreadPtr()),
1031 file_spec->GetPath().c_str(), line);
1033 if (!exe_ctx.HasThreadScope()) {
1034 sb_error.SetErrorString("this SBThread object is invalid");
1038 Thread *thread = exe_ctx.GetThreadPtr();
1040 Error err = thread->JumpToLine(file_spec.get(), line, true);
1041 sb_error.SetError(err);
1045 SBError SBThread::ReturnFromFrame(SBFrame &frame, SBValue &return_value) {
1048 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1050 std::unique_lock<std::recursive_mutex> lock;
1051 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1054 log->Printf("SBThread(%p)::ReturnFromFrame (frame=%d)",
1055 static_cast<void *>(exe_ctx.GetThreadPtr()),
1056 frame.GetFrameID());
1058 if (exe_ctx.HasThreadScope()) {
1059 Thread *thread = exe_ctx.GetThreadPtr();
1061 thread->ReturnFromFrame(frame.GetFrameSP(), return_value.GetSP()));
1067 SBError SBThread::UnwindInnermostExpression() {
1070 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1072 std::unique_lock<std::recursive_mutex> lock;
1073 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1076 log->Printf("SBThread(%p)::UnwindExpressionEvaluation",
1077 static_cast<void *>(exe_ctx.GetThreadPtr()));
1079 if (exe_ctx.HasThreadScope()) {
1080 Thread *thread = exe_ctx.GetThreadPtr();
1081 sb_error.SetError(thread->UnwindInnermostExpression());
1082 if (sb_error.Success())
1083 thread->SetSelectedFrameByIndex(0, false);
1089 bool SBThread::Suspend() {
1090 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1091 std::unique_lock<std::recursive_mutex> lock;
1092 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1094 bool result = false;
1095 if (exe_ctx.HasThreadScope()) {
1096 Process::StopLocker stop_locker;
1097 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
1098 exe_ctx.GetThreadPtr()->SetResumeState(eStateSuspended);
1102 log->Printf("SBThread(%p)::Suspend() => error: process is running",
1103 static_cast<void *>(exe_ctx.GetThreadPtr()));
1107 log->Printf("SBThread(%p)::Suspend() => %i",
1108 static_cast<void *>(exe_ctx.GetThreadPtr()), result);
1112 bool SBThread::Resume() {
1113 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1114 std::unique_lock<std::recursive_mutex> lock;
1115 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1117 bool result = false;
1118 if (exe_ctx.HasThreadScope()) {
1119 Process::StopLocker stop_locker;
1120 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
1121 const bool override_suspend = true;
1122 exe_ctx.GetThreadPtr()->SetResumeState(eStateRunning, override_suspend);
1126 log->Printf("SBThread(%p)::Resume() => error: process is running",
1127 static_cast<void *>(exe_ctx.GetThreadPtr()));
1131 log->Printf("SBThread(%p)::Resume() => %i",
1132 static_cast<void *>(exe_ctx.GetThreadPtr()), result);
1136 bool SBThread::IsSuspended() {
1137 std::unique_lock<std::recursive_mutex> lock;
1138 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1140 if (exe_ctx.HasThreadScope())
1141 return exe_ctx.GetThreadPtr()->GetResumeState() == eStateSuspended;
1145 bool SBThread::IsStopped() {
1146 std::unique_lock<std::recursive_mutex> lock;
1147 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1149 if (exe_ctx.HasThreadScope())
1150 return StateIsStoppedState(exe_ctx.GetThreadPtr()->GetState(), true);
1154 SBProcess SBThread::GetProcess() {
1155 SBProcess sb_process;
1156 std::unique_lock<std::recursive_mutex> lock;
1157 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1159 if (exe_ctx.HasThreadScope()) {
1160 // Have to go up to the target so we can get a shared pointer to our
1162 sb_process.SetSP(exe_ctx.GetProcessSP());
1165 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1167 SBStream frame_desc_strm;
1168 sb_process.GetDescription(frame_desc_strm);
1169 log->Printf("SBThread(%p)::GetProcess () => SBProcess(%p): %s",
1170 static_cast<void *>(exe_ctx.GetThreadPtr()),
1171 static_cast<void *>(sb_process.GetSP().get()),
1172 frame_desc_strm.GetData());
1178 uint32_t SBThread::GetNumFrames() {
1179 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1181 uint32_t num_frames = 0;
1182 std::unique_lock<std::recursive_mutex> lock;
1183 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1185 if (exe_ctx.HasThreadScope()) {
1186 Process::StopLocker stop_locker;
1187 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
1188 num_frames = exe_ctx.GetThreadPtr()->GetStackFrameCount();
1191 log->Printf("SBThread(%p)::GetNumFrames() => error: process is running",
1192 static_cast<void *>(exe_ctx.GetThreadPtr()));
1197 log->Printf("SBThread(%p)::GetNumFrames () => %u",
1198 static_cast<void *>(exe_ctx.GetThreadPtr()), num_frames);
1203 SBFrame SBThread::GetFrameAtIndex(uint32_t idx) {
1204 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1207 StackFrameSP frame_sp;
1208 std::unique_lock<std::recursive_mutex> lock;
1209 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1211 if (exe_ctx.HasThreadScope()) {
1212 Process::StopLocker stop_locker;
1213 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
1214 frame_sp = exe_ctx.GetThreadPtr()->GetStackFrameAtIndex(idx);
1215 sb_frame.SetFrameSP(frame_sp);
1219 "SBThread(%p)::GetFrameAtIndex() => error: process is running",
1220 static_cast<void *>(exe_ctx.GetThreadPtr()));
1225 SBStream frame_desc_strm;
1226 sb_frame.GetDescription(frame_desc_strm);
1227 log->Printf("SBThread(%p)::GetFrameAtIndex (idx=%d) => SBFrame(%p): %s",
1228 static_cast<void *>(exe_ctx.GetThreadPtr()), idx,
1229 static_cast<void *>(frame_sp.get()), frame_desc_strm.GetData());
1235 lldb::SBFrame SBThread::GetSelectedFrame() {
1236 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1239 StackFrameSP frame_sp;
1240 std::unique_lock<std::recursive_mutex> lock;
1241 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1243 if (exe_ctx.HasThreadScope()) {
1244 Process::StopLocker stop_locker;
1245 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
1246 frame_sp = exe_ctx.GetThreadPtr()->GetSelectedFrame();
1247 sb_frame.SetFrameSP(frame_sp);
1251 "SBThread(%p)::GetSelectedFrame() => error: process is running",
1252 static_cast<void *>(exe_ctx.GetThreadPtr()));
1257 SBStream frame_desc_strm;
1258 sb_frame.GetDescription(frame_desc_strm);
1259 log->Printf("SBThread(%p)::GetSelectedFrame () => SBFrame(%p): %s",
1260 static_cast<void *>(exe_ctx.GetThreadPtr()),
1261 static_cast<void *>(frame_sp.get()), frame_desc_strm.GetData());
1267 lldb::SBFrame SBThread::SetSelectedFrame(uint32_t idx) {
1268 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1271 StackFrameSP frame_sp;
1272 std::unique_lock<std::recursive_mutex> lock;
1273 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1275 if (exe_ctx.HasThreadScope()) {
1276 Process::StopLocker stop_locker;
1277 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
1278 Thread *thread = exe_ctx.GetThreadPtr();
1279 frame_sp = thread->GetStackFrameAtIndex(idx);
1281 thread->SetSelectedFrame(frame_sp.get());
1282 sb_frame.SetFrameSP(frame_sp);
1287 "SBThread(%p)::SetSelectedFrame() => error: process is running",
1288 static_cast<void *>(exe_ctx.GetThreadPtr()));
1293 SBStream frame_desc_strm;
1294 sb_frame.GetDescription(frame_desc_strm);
1295 log->Printf("SBThread(%p)::SetSelectedFrame (idx=%u) => SBFrame(%p): %s",
1296 static_cast<void *>(exe_ctx.GetThreadPtr()), idx,
1297 static_cast<void *>(frame_sp.get()), frame_desc_strm.GetData());
1302 bool SBThread::EventIsThreadEvent(const SBEvent &event) {
1303 return Thread::ThreadEventData::GetEventDataFromEvent(event.get()) != NULL;
1306 SBFrame SBThread::GetStackFrameFromEvent(const SBEvent &event) {
1307 return Thread::ThreadEventData::GetStackFrameFromEvent(event.get());
1310 SBThread SBThread::GetThreadFromEvent(const SBEvent &event) {
1311 return Thread::ThreadEventData::GetThreadFromEvent(event.get());
1314 bool SBThread::operator==(const SBThread &rhs) const {
1315 return m_opaque_sp->GetThreadSP().get() ==
1316 rhs.m_opaque_sp->GetThreadSP().get();
1319 bool SBThread::operator!=(const SBThread &rhs) const {
1320 return m_opaque_sp->GetThreadSP().get() !=
1321 rhs.m_opaque_sp->GetThreadSP().get();
1324 bool SBThread::GetStatus(SBStream &status) const {
1325 Stream &strm = status.ref();
1327 std::unique_lock<std::recursive_mutex> lock;
1328 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1330 if (exe_ctx.HasThreadScope()) {
1331 exe_ctx.GetThreadPtr()->GetStatus(strm, 0, 1, 1, true);
1333 strm.PutCString("No status");
1338 bool SBThread::GetDescription(SBStream &description) const {
1339 return GetDescription(description, false);
1342 bool SBThread::GetDescription(SBStream &description, bool stop_format) const {
1343 Stream &strm = description.ref();
1345 std::unique_lock<std::recursive_mutex> lock;
1346 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1348 if (exe_ctx.HasThreadScope()) {
1349 exe_ctx.GetThreadPtr()->DumpUsingSettingsFormat(strm,
1350 LLDB_INVALID_THREAD_ID,
1352 // strm.Printf("SBThread: tid = 0x%4.4" PRIx64,
1353 // exe_ctx.GetThreadPtr()->GetID());
1355 strm.PutCString("No value");
1360 SBThread SBThread::GetExtendedBacktraceThread(const char *type) {
1361 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1362 std::unique_lock<std::recursive_mutex> lock;
1363 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1364 SBThread sb_origin_thread;
1366 if (exe_ctx.HasThreadScope()) {
1367 Process::StopLocker stop_locker;
1368 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
1369 ThreadSP real_thread(exe_ctx.GetThreadSP());
1371 ConstString type_const(type);
1372 Process *process = exe_ctx.GetProcessPtr();
1374 SystemRuntime *runtime = process->GetSystemRuntime();
1376 ThreadSP new_thread_sp(
1377 runtime->GetExtendedBacktraceThread(real_thread, type_const));
1378 if (new_thread_sp) {
1379 // Save this in the Process' ExtendedThreadList so a strong
1380 // pointer retains the
1382 process->GetExtendedThreadList().AddThread(new_thread_sp);
1383 sb_origin_thread.SetThread(new_thread_sp);
1385 const char *queue_name = new_thread_sp->GetQueueName();
1386 if (queue_name == NULL)
1388 log->Printf("SBThread(%p)::GetExtendedBacktraceThread() => new "
1390 "created (%p) with queue_id 0x%" PRIx64
1392 static_cast<void *>(exe_ctx.GetThreadPtr()),
1393 static_cast<void *>(new_thread_sp.get()),
1394 new_thread_sp->GetQueueID(), queue_name);
1402 log->Printf("SBThread(%p)::GetExtendedBacktraceThread() => error: "
1403 "process is running",
1404 static_cast<void *>(exe_ctx.GetThreadPtr()));
1408 if (log && sb_origin_thread.IsValid() == false)
1409 log->Printf("SBThread(%p)::GetExtendedBacktraceThread() is not returning a "
1411 static_cast<void *>(exe_ctx.GetThreadPtr()));
1412 return sb_origin_thread;
1415 uint32_t SBThread::GetExtendedBacktraceOriginatingIndexID() {
1416 ThreadSP thread_sp(m_opaque_sp->GetThreadSP());
1418 return thread_sp->GetExtendedBacktraceOriginatingIndexID();
1419 return LLDB_INVALID_INDEX32;
1422 bool SBThread::SafeToCallFunctions() {
1423 ThreadSP thread_sp(m_opaque_sp->GetThreadSP());
1425 return thread_sp->SafeToCallFunctions();
1429 lldb_private::Thread *SBThread::operator->() {
1430 ThreadSP thread_sp(m_opaque_sp->GetThreadSP());
1432 return thread_sp.get();
1437 lldb_private::Thread *SBThread::get() {
1438 ThreadSP thread_sp(m_opaque_sp->GetThreadSP());
1440 return thread_sp.get();