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"
46 #include "lldb/lldb-enumerations.h"
49 using namespace lldb_private;
51 const char *SBThread::GetBroadcasterClassName() {
52 return Thread::GetStaticBroadcasterClass().AsCString();
55 //----------------------------------------------------------------------
57 //----------------------------------------------------------------------
58 SBThread::SBThread() : m_opaque_sp(new ExecutionContextRef()) {}
60 SBThread::SBThread(const ThreadSP &lldb_object_sp)
61 : m_opaque_sp(new ExecutionContextRef(lldb_object_sp)) {}
63 SBThread::SBThread(const SBThread &rhs)
64 : m_opaque_sp(new ExecutionContextRef(*rhs.m_opaque_sp)) {}
66 //----------------------------------------------------------------------
67 // Assignment operator
68 //----------------------------------------------------------------------
70 const lldb::SBThread &SBThread::operator=(const SBThread &rhs) {
72 *m_opaque_sp = *rhs.m_opaque_sp;
76 //----------------------------------------------------------------------
78 //----------------------------------------------------------------------
79 SBThread::~SBThread() {}
81 lldb::SBQueue SBThread::GetQueue() const {
84 std::unique_lock<std::recursive_mutex> lock;
85 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
87 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
88 if (exe_ctx.HasThreadScope()) {
89 Process::StopLocker stop_locker;
90 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
91 queue_sp = exe_ctx.GetThreadPtr()->GetQueue();
93 sb_queue.SetQueue(queue_sp);
97 log->Printf("SBThread(%p)::GetQueue() => error: process is running",
98 static_cast<void *>(exe_ctx.GetThreadPtr()));
103 log->Printf("SBThread(%p)::GetQueue () => SBQueue(%p)",
104 static_cast<void *>(exe_ctx.GetThreadPtr()),
105 static_cast<void *>(queue_sp.get()));
110 bool SBThread::IsValid() const {
111 std::unique_lock<std::recursive_mutex> lock;
112 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
114 Target *target = exe_ctx.GetTargetPtr();
115 Process *process = exe_ctx.GetProcessPtr();
116 if (target && process) {
117 Process::StopLocker stop_locker;
118 if (stop_locker.TryLock(&process->GetRunLock()))
119 return m_opaque_sp->GetThreadSP().get() != NULL;
121 // Without a valid target & process, this thread can't be valid.
125 void SBThread::Clear() { m_opaque_sp->Clear(); }
127 StopReason SBThread::GetStopReason() {
128 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
130 StopReason reason = eStopReasonInvalid;
131 std::unique_lock<std::recursive_mutex> lock;
132 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
134 if (exe_ctx.HasThreadScope()) {
135 Process::StopLocker stop_locker;
136 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
137 return exe_ctx.GetThreadPtr()->GetStopReason();
141 "SBThread(%p)::GetStopReason() => error: process is running",
142 static_cast<void *>(exe_ctx.GetThreadPtr()));
147 log->Printf("SBThread(%p)::GetStopReason () => %s",
148 static_cast<void *>(exe_ctx.GetThreadPtr()),
149 Thread::StopReasonAsCString(reason));
154 size_t SBThread::GetStopReasonDataCount() {
155 std::unique_lock<std::recursive_mutex> lock;
156 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
158 if (exe_ctx.HasThreadScope()) {
159 Process::StopLocker stop_locker;
160 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
161 StopInfoSP stop_info_sp = exe_ctx.GetThreadPtr()->GetStopInfo();
163 StopReason reason = stop_info_sp->GetStopReason();
165 case eStopReasonInvalid:
166 case eStopReasonNone:
167 case eStopReasonTrace:
168 case eStopReasonExec:
169 case eStopReasonPlanComplete:
170 case eStopReasonThreadExiting:
171 case eStopReasonInstrumentation:
172 // There is no data for these stop reasons.
175 case eStopReasonBreakpoint: {
176 break_id_t site_id = stop_info_sp->GetValue();
177 lldb::BreakpointSiteSP bp_site_sp(
178 exe_ctx.GetProcessPtr()->GetBreakpointSiteList().FindByID(
181 return bp_site_sp->GetNumberOfOwners() * 2;
183 return 0; // Breakpoint must have cleared itself...
186 case eStopReasonWatchpoint:
189 case eStopReasonSignal:
192 case eStopReasonException:
197 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
199 log->Printf("SBThread(%p)::GetStopReasonDataCount() => error: process "
201 static_cast<void *>(exe_ctx.GetThreadPtr()));
207 uint64_t SBThread::GetStopReasonDataAtIndex(uint32_t idx) {
208 std::unique_lock<std::recursive_mutex> lock;
209 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
211 if (exe_ctx.HasThreadScope()) {
212 Process::StopLocker stop_locker;
213 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
214 Thread *thread = exe_ctx.GetThreadPtr();
215 StopInfoSP stop_info_sp = thread->GetStopInfo();
217 StopReason reason = stop_info_sp->GetStopReason();
219 case eStopReasonInvalid:
220 case eStopReasonNone:
221 case eStopReasonTrace:
222 case eStopReasonExec:
223 case eStopReasonPlanComplete:
224 case eStopReasonThreadExiting:
225 case eStopReasonInstrumentation:
226 // There is no data for these stop reasons.
229 case eStopReasonBreakpoint: {
230 break_id_t site_id = stop_info_sp->GetValue();
231 lldb::BreakpointSiteSP bp_site_sp(
232 exe_ctx.GetProcessPtr()->GetBreakpointSiteList().FindByID(
235 uint32_t bp_index = idx / 2;
236 BreakpointLocationSP bp_loc_sp(
237 bp_site_sp->GetOwnerAtIndex(bp_index));
240 // Odd idx, return the breakpoint location ID
241 return bp_loc_sp->GetID();
243 // Even idx, return the breakpoint ID
244 return bp_loc_sp->GetBreakpoint().GetID();
248 return LLDB_INVALID_BREAK_ID;
251 case eStopReasonWatchpoint:
252 return stop_info_sp->GetValue();
254 case eStopReasonSignal:
255 return stop_info_sp->GetValue();
257 case eStopReasonException:
258 return stop_info_sp->GetValue();
262 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
264 log->Printf("SBThread(%p)::GetStopReasonDataAtIndex() => error: "
265 "process is running",
266 static_cast<void *>(exe_ctx.GetThreadPtr()));
272 bool SBThread::GetStopReasonExtendedInfoAsJSON(lldb::SBStream &stream) {
273 Stream &strm = stream.ref();
275 std::unique_lock<std::recursive_mutex> lock;
276 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
278 if (!exe_ctx.HasThreadScope())
281 StopInfoSP stop_info = exe_ctx.GetThreadPtr()->GetStopInfo();
282 StructuredData::ObjectSP info = stop_info->GetExtendedInfo();
292 SBThread::GetStopReasonExtendedBacktraces(InstrumentationRuntimeType type) {
293 ThreadCollectionSP threads;
294 threads.reset(new ThreadCollection());
296 // We currently only support ThreadSanitizer.
297 if (type != eInstrumentationRuntimeTypeThreadSanitizer)
300 std::unique_lock<std::recursive_mutex> lock;
301 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
303 if (!exe_ctx.HasThreadScope())
306 ProcessSP process_sp = exe_ctx.GetProcessSP();
308 StopInfoSP stop_info = exe_ctx.GetThreadPtr()->GetStopInfo();
309 StructuredData::ObjectSP info = stop_info->GetExtendedInfo();
313 return process_sp->GetInstrumentationRuntime(type)
314 ->GetBacktracesFromExtendedStopInfo(info);
317 size_t SBThread::GetStopDescription(char *dst, size_t dst_len) {
318 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
320 std::unique_lock<std::recursive_mutex> lock;
321 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
323 if (exe_ctx.HasThreadScope()) {
324 Process::StopLocker stop_locker;
325 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
327 StopInfoSP stop_info_sp = exe_ctx.GetThreadPtr()->GetStopInfo();
329 const char *stop_desc = stop_info_sp->GetDescription();
333 "SBThread(%p)::GetStopDescription (dst, dst_len) => \"%s\"",
334 static_cast<void *>(exe_ctx.GetThreadPtr()), stop_desc);
336 return ::snprintf(dst, dst_len, "%s", stop_desc);
338 // NULL dst passed in, return the length needed to contain the
340 return ::strlen(stop_desc) + 1; // Include the NULL byte for size
343 size_t stop_desc_len = 0;
344 switch (stop_info_sp->GetStopReason()) {
345 case eStopReasonTrace:
346 case eStopReasonPlanComplete: {
347 static char trace_desc[] = "step";
348 stop_desc = trace_desc;
350 sizeof(trace_desc); // Include the NULL byte for size
353 case eStopReasonBreakpoint: {
354 static char bp_desc[] = "breakpoint hit";
356 stop_desc_len = sizeof(bp_desc); // Include the NULL byte for size
359 case eStopReasonWatchpoint: {
360 static char wp_desc[] = "watchpoint hit";
362 stop_desc_len = sizeof(wp_desc); // Include the NULL byte for size
365 case eStopReasonSignal: {
367 exe_ctx.GetProcessPtr()->GetUnixSignals()->GetSignalAsCString(
368 stop_info_sp->GetValue());
369 if (stop_desc == NULL || stop_desc[0] == '\0') {
370 static char signal_desc[] = "signal";
371 stop_desc = signal_desc;
373 sizeof(signal_desc); // Include the NULL byte for size
377 case eStopReasonException: {
378 char exc_desc[] = "exception";
379 stop_desc = exc_desc;
380 stop_desc_len = sizeof(exc_desc); // Include the NULL byte for size
383 case eStopReasonExec: {
384 char exc_desc[] = "exec";
385 stop_desc = exc_desc;
386 stop_desc_len = sizeof(exc_desc); // Include the NULL byte for size
389 case eStopReasonThreadExiting: {
390 char limbo_desc[] = "thread exiting";
391 stop_desc = limbo_desc;
392 stop_desc_len = sizeof(limbo_desc);
398 if (stop_desc && stop_desc[0]) {
401 "SBThread(%p)::GetStopDescription (dst, dst_len) => '%s'",
402 static_cast<void *>(exe_ctx.GetThreadPtr()), stop_desc);
405 return ::snprintf(dst, dst_len, "%s", stop_desc) +
406 1; // Include the NULL byte
408 if (stop_desc_len == 0)
409 stop_desc_len = ::strlen(stop_desc) + 1; // Include the NULL byte
411 return stop_desc_len;
416 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
419 "SBThread(%p)::GetStopDescription() => error: process is running",
420 static_cast<void *>(exe_ctx.GetThreadPtr()));
428 SBValue SBThread::GetStopReturnValue() {
429 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
430 ValueObjectSP return_valobj_sp;
431 std::unique_lock<std::recursive_mutex> lock;
432 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
434 if (exe_ctx.HasThreadScope()) {
435 Process::StopLocker stop_locker;
436 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
437 StopInfoSP stop_info_sp = exe_ctx.GetThreadPtr()->GetStopInfo();
439 return_valobj_sp = StopInfo::GetReturnValueObject(stop_info_sp);
444 "SBThread(%p)::GetStopReturnValue() => error: process is running",
445 static_cast<void *>(exe_ctx.GetThreadPtr()));
450 log->Printf("SBThread(%p)::GetStopReturnValue () => %s",
451 static_cast<void *>(exe_ctx.GetThreadPtr()),
452 return_valobj_sp.get() ? return_valobj_sp->GetValueAsCString()
453 : "<no return value>");
455 return SBValue(return_valobj_sp);
458 void SBThread::SetThread(const ThreadSP &lldb_object_sp) {
459 m_opaque_sp->SetThreadSP(lldb_object_sp);
462 lldb::tid_t SBThread::GetThreadID() const {
463 ThreadSP thread_sp(m_opaque_sp->GetThreadSP());
465 return thread_sp->GetID();
466 return LLDB_INVALID_THREAD_ID;
469 uint32_t SBThread::GetIndexID() const {
470 ThreadSP thread_sp(m_opaque_sp->GetThreadSP());
472 return thread_sp->GetIndexID();
473 return LLDB_INVALID_INDEX32;
476 const char *SBThread::GetName() const {
477 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
478 const char *name = NULL;
479 std::unique_lock<std::recursive_mutex> lock;
480 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
482 if (exe_ctx.HasThreadScope()) {
483 Process::StopLocker stop_locker;
484 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
485 name = exe_ctx.GetThreadPtr()->GetName();
488 log->Printf("SBThread(%p)::GetName() => error: process is running",
489 static_cast<void *>(exe_ctx.GetThreadPtr()));
494 log->Printf("SBThread(%p)::GetName () => %s",
495 static_cast<void *>(exe_ctx.GetThreadPtr()),
496 name ? name : "NULL");
501 const char *SBThread::GetQueueName() const {
502 const char *name = NULL;
503 std::unique_lock<std::recursive_mutex> lock;
504 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
506 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
507 if (exe_ctx.HasThreadScope()) {
508 Process::StopLocker stop_locker;
509 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
510 name = exe_ctx.GetThreadPtr()->GetQueueName();
513 log->Printf("SBThread(%p)::GetQueueName() => error: process is running",
514 static_cast<void *>(exe_ctx.GetThreadPtr()));
519 log->Printf("SBThread(%p)::GetQueueName () => %s",
520 static_cast<void *>(exe_ctx.GetThreadPtr()),
521 name ? name : "NULL");
526 lldb::queue_id_t SBThread::GetQueueID() const {
527 queue_id_t id = LLDB_INVALID_QUEUE_ID;
528 std::unique_lock<std::recursive_mutex> lock;
529 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
531 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
532 if (exe_ctx.HasThreadScope()) {
533 Process::StopLocker stop_locker;
534 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
535 id = exe_ctx.GetThreadPtr()->GetQueueID();
538 log->Printf("SBThread(%p)::GetQueueID() => error: process is running",
539 static_cast<void *>(exe_ctx.GetThreadPtr()));
544 log->Printf("SBThread(%p)::GetQueueID () => 0x%" PRIx64,
545 static_cast<void *>(exe_ctx.GetThreadPtr()), id);
550 bool SBThread::GetInfoItemByPathAsString(const char *path, SBStream &strm) {
551 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
552 bool success = false;
553 std::unique_lock<std::recursive_mutex> lock;
554 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
556 if (exe_ctx.HasThreadScope()) {
557 Process::StopLocker stop_locker;
558 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
559 Thread *thread = exe_ctx.GetThreadPtr();
560 StructuredData::ObjectSP info_root_sp = thread->GetExtendedInfo();
562 StructuredData::ObjectSP node =
563 info_root_sp->GetObjectForDotSeparatedPath(path);
565 if (node->GetType() == eStructuredDataTypeString) {
566 strm.Printf("%s", node->GetAsString()->GetValue().str().c_str());
569 if (node->GetType() == eStructuredDataTypeInteger) {
570 strm.Printf("0x%" PRIx64, node->GetAsInteger()->GetValue());
573 if (node->GetType() == eStructuredDataTypeFloat) {
574 strm.Printf("0x%f", node->GetAsFloat()->GetValue());
577 if (node->GetType() == eStructuredDataTypeBoolean) {
578 if (node->GetAsBoolean()->GetValue() == true)
581 strm.Printf("false");
584 if (node->GetType() == eStructuredDataTypeNull) {
592 log->Printf("SBThread(%p)::GetInfoItemByPathAsString() => error: "
593 "process is running",
594 static_cast<void *>(exe_ctx.GetThreadPtr()));
599 log->Printf("SBThread(%p)::GetInfoItemByPathAsString (\"%s\") => \"%s\"",
600 static_cast<void *>(exe_ctx.GetThreadPtr()), path, strm.GetData());
605 SBError SBThread::ResumeNewPlan(ExecutionContext &exe_ctx,
606 ThreadPlan *new_plan) {
609 Process *process = exe_ctx.GetProcessPtr();
611 sb_error.SetErrorString("No process in SBThread::ResumeNewPlan");
615 Thread *thread = exe_ctx.GetThreadPtr();
617 sb_error.SetErrorString("No thread in SBThread::ResumeNewPlan");
621 // User level plans should be Master Plans so they can be interrupted, other
622 // plans executed, and
623 // then a "continue" will resume the plan.
624 if (new_plan != NULL) {
625 new_plan->SetIsMasterPlan(true);
626 new_plan->SetOkayToDiscard(false);
629 // Why do we need to set the current thread by ID here???
630 process->GetThreadList().SetSelectedThreadByID(thread->GetID());
632 if (process->GetTarget().GetDebugger().GetAsyncExecution())
633 sb_error.ref() = process->Resume();
635 sb_error.ref() = process->ResumeSynchronous(NULL);
640 void SBThread::StepOver(lldb::RunMode stop_other_threads) {
641 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
643 std::unique_lock<std::recursive_mutex> lock;
644 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
647 log->Printf("SBThread(%p)::StepOver (stop_other_threads='%s')",
648 static_cast<void *>(exe_ctx.GetThreadPtr()),
649 Thread::RunModeAsCString(stop_other_threads));
651 if (exe_ctx.HasThreadScope()) {
652 Thread *thread = exe_ctx.GetThreadPtr();
653 bool abort_other_plans = false;
654 StackFrameSP frame_sp(thread->GetStackFrameAtIndex(0));
656 ThreadPlanSP new_plan_sp;
658 if (frame_sp->HasDebugInformation()) {
659 const LazyBool avoid_no_debug = eLazyBoolCalculate;
660 SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
661 new_plan_sp = thread->QueueThreadPlanForStepOverRange(
662 abort_other_plans, sc.line_entry, sc, stop_other_threads,
665 new_plan_sp = thread->QueueThreadPlanForStepSingleInstruction(
666 true, abort_other_plans, stop_other_threads);
670 // This returns an error, we should use it!
671 ResumeNewPlan(exe_ctx, new_plan_sp.get());
675 void SBThread::StepInto(lldb::RunMode stop_other_threads) {
676 StepInto(NULL, stop_other_threads);
679 void SBThread::StepInto(const char *target_name,
680 lldb::RunMode stop_other_threads) {
682 StepInto(target_name, LLDB_INVALID_LINE_NUMBER, error, stop_other_threads);
685 void SBThread::StepInto(const char *target_name, uint32_t end_line,
686 SBError &error, lldb::RunMode stop_other_threads) {
687 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
689 std::unique_lock<std::recursive_mutex> lock;
690 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
694 "SBThread(%p)::StepInto (target_name='%s', stop_other_threads='%s')",
695 static_cast<void *>(exe_ctx.GetThreadPtr()),
696 target_name ? target_name : "<NULL>",
697 Thread::RunModeAsCString(stop_other_threads));
699 if (exe_ctx.HasThreadScope()) {
700 bool abort_other_plans = false;
702 Thread *thread = exe_ctx.GetThreadPtr();
703 StackFrameSP frame_sp(thread->GetStackFrameAtIndex(0));
704 ThreadPlanSP new_plan_sp;
706 if (frame_sp && frame_sp->HasDebugInformation()) {
707 SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
709 if (end_line == LLDB_INVALID_LINE_NUMBER)
710 range = sc.line_entry.range;
712 if (!sc.GetAddressRangeFromHereToEndLine(end_line, range, error.ref()))
716 const LazyBool step_out_avoids_code_without_debug_info =
718 const LazyBool step_in_avoids_code_without_debug_info =
720 new_plan_sp = thread->QueueThreadPlanForStepInRange(
721 abort_other_plans, range, sc, target_name, stop_other_threads,
722 step_in_avoids_code_without_debug_info,
723 step_out_avoids_code_without_debug_info);
725 new_plan_sp = thread->QueueThreadPlanForStepSingleInstruction(
726 false, abort_other_plans, stop_other_threads);
729 error = ResumeNewPlan(exe_ctx, new_plan_sp.get());
733 void SBThread::StepOut() {
734 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
736 std::unique_lock<std::recursive_mutex> lock;
737 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
740 log->Printf("SBThread(%p)::StepOut ()",
741 static_cast<void *>(exe_ctx.GetThreadPtr()));
743 if (exe_ctx.HasThreadScope()) {
744 bool abort_other_plans = false;
745 bool stop_other_threads = false;
747 Thread *thread = exe_ctx.GetThreadPtr();
749 const LazyBool avoid_no_debug = eLazyBoolCalculate;
750 ThreadPlanSP new_plan_sp(thread->QueueThreadPlanForStepOut(
751 abort_other_plans, NULL, false, stop_other_threads, eVoteYes,
752 eVoteNoOpinion, 0, avoid_no_debug));
754 // This returns an error, we should use it!
755 ResumeNewPlan(exe_ctx, new_plan_sp.get());
759 void SBThread::StepOutOfFrame(lldb::SBFrame &sb_frame) {
760 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
762 std::unique_lock<std::recursive_mutex> lock;
763 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
765 if (!sb_frame.IsValid()) {
768 "SBThread(%p)::StepOutOfFrame passed an invalid frame, returning.",
769 static_cast<void *>(exe_ctx.GetThreadPtr()));
773 StackFrameSP frame_sp(sb_frame.GetFrameSP());
775 SBStream frame_desc_strm;
776 sb_frame.GetDescription(frame_desc_strm);
777 log->Printf("SBThread(%p)::StepOutOfFrame (frame = SBFrame(%p): %s)",
778 static_cast<void *>(exe_ctx.GetThreadPtr()),
779 static_cast<void *>(frame_sp.get()), frame_desc_strm.GetData());
782 if (exe_ctx.HasThreadScope()) {
783 bool abort_other_plans = false;
784 bool stop_other_threads = false;
785 Thread *thread = exe_ctx.GetThreadPtr();
786 if (sb_frame.GetThread().GetThreadID() != thread->GetID()) {
787 log->Printf("SBThread(%p)::StepOutOfFrame passed a frame from another "
788 "thread (0x%" PRIx64 " vrs. 0x%" PRIx64 ", returning.",
789 static_cast<void *>(exe_ctx.GetThreadPtr()),
790 sb_frame.GetThread().GetThreadID(), thread->GetID());
793 ThreadPlanSP new_plan_sp(thread->QueueThreadPlanForStepOut(
794 abort_other_plans, NULL, false, stop_other_threads, eVoteYes,
795 eVoteNoOpinion, frame_sp->GetFrameIndex()));
797 // This returns an error, we should use it!
798 ResumeNewPlan(exe_ctx, new_plan_sp.get());
802 void SBThread::StepInstruction(bool step_over) {
803 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
805 std::unique_lock<std::recursive_mutex> lock;
806 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
809 log->Printf("SBThread(%p)::StepInstruction (step_over=%i)",
810 static_cast<void *>(exe_ctx.GetThreadPtr()), step_over);
812 if (exe_ctx.HasThreadScope()) {
813 Thread *thread = exe_ctx.GetThreadPtr();
814 ThreadPlanSP new_plan_sp(
815 thread->QueueThreadPlanForStepSingleInstruction(step_over, true, true));
817 // This returns an error, we should use it!
818 ResumeNewPlan(exe_ctx, new_plan_sp.get());
822 void SBThread::RunToAddress(lldb::addr_t addr) {
823 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
825 std::unique_lock<std::recursive_mutex> lock;
826 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
829 log->Printf("SBThread(%p)::RunToAddress (addr=0x%" PRIx64 ")",
830 static_cast<void *>(exe_ctx.GetThreadPtr()), addr);
832 if (exe_ctx.HasThreadScope()) {
833 bool abort_other_plans = false;
834 bool stop_other_threads = true;
836 Address target_addr(addr);
838 Thread *thread = exe_ctx.GetThreadPtr();
840 ThreadPlanSP new_plan_sp(thread->QueueThreadPlanForRunToAddress(
841 abort_other_plans, target_addr, stop_other_threads));
843 // This returns an error, we should use it!
844 ResumeNewPlan(exe_ctx, new_plan_sp.get());
848 SBError SBThread::StepOverUntil(lldb::SBFrame &sb_frame,
849 lldb::SBFileSpec &sb_file_spec, uint32_t line) {
851 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
854 std::unique_lock<std::recursive_mutex> lock;
855 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
857 StackFrameSP frame_sp(sb_frame.GetFrameSP());
860 SBStream frame_desc_strm;
861 sb_frame.GetDescription(frame_desc_strm);
862 sb_file_spec->GetPath(path, sizeof(path));
863 log->Printf("SBThread(%p)::StepOverUntil (frame = SBFrame(%p): %s, "
864 "file+line = %s:%u)",
865 static_cast<void *>(exe_ctx.GetThreadPtr()),
866 static_cast<void *>(frame_sp.get()), frame_desc_strm.GetData(),
870 if (exe_ctx.HasThreadScope()) {
871 Target *target = exe_ctx.GetTargetPtr();
872 Thread *thread = exe_ctx.GetThreadPtr();
875 sb_error.SetErrorString("invalid line argument");
880 frame_sp = thread->GetSelectedFrame();
882 frame_sp = thread->GetStackFrameAtIndex(0);
885 SymbolContext frame_sc;
887 sb_error.SetErrorString("no valid frames in thread to step");
891 // If we have a frame, get its line
892 frame_sc = frame_sp->GetSymbolContext(
893 eSymbolContextCompUnit | eSymbolContextFunction |
894 eSymbolContextLineEntry | eSymbolContextSymbol);
896 if (frame_sc.comp_unit == NULL) {
897 sb_error.SetErrorStringWithFormat(
898 "frame %u doesn't have debug information", frame_sp->GetFrameIndex());
902 FileSpec step_file_spec;
903 if (sb_file_spec.IsValid()) {
904 // The file spec passed in was valid, so use it
905 step_file_spec = sb_file_spec.ref();
907 if (frame_sc.line_entry.IsValid())
908 step_file_spec = frame_sc.line_entry.file;
910 sb_error.SetErrorString("invalid file argument or no file for frame");
915 // Grab the current function, then we will make sure the "until" address is
916 // within the function. We discard addresses that are out of the current
917 // function, and then if there are no addresses remaining, give an
921 bool all_in_function = true;
922 AddressRange fun_range = frame_sc.function->GetAddressRange();
924 std::vector<addr_t> step_over_until_addrs;
925 const bool abort_other_plans = false;
926 const bool stop_other_threads = false;
927 const bool check_inlines = true;
928 const bool exact = false;
930 SymbolContextList sc_list;
931 const uint32_t num_matches = frame_sc.comp_unit->ResolveSymbolContext(
932 step_file_spec, line, check_inlines, exact, eSymbolContextLineEntry,
934 if (num_matches > 0) {
936 for (uint32_t i = 0; i < num_matches; ++i) {
937 if (sc_list.GetContextAtIndex(i, sc)) {
939 sc.line_entry.range.GetBaseAddress().GetLoadAddress(target);
940 if (step_addr != LLDB_INVALID_ADDRESS) {
941 if (fun_range.ContainsLoadAddress(step_addr, target))
942 step_over_until_addrs.push_back(step_addr);
944 all_in_function = false;
950 if (step_over_until_addrs.empty()) {
951 if (all_in_function) {
952 step_file_spec.GetPath(path, sizeof(path));
953 sb_error.SetErrorStringWithFormat("No line entries for %s:%u", path,
956 sb_error.SetErrorString("step until target not in current function");
958 ThreadPlanSP new_plan_sp(thread->QueueThreadPlanForStepUntil(
959 abort_other_plans, &step_over_until_addrs[0],
960 step_over_until_addrs.size(), stop_other_threads,
961 frame_sp->GetFrameIndex()));
963 sb_error = ResumeNewPlan(exe_ctx, new_plan_sp.get());
966 sb_error.SetErrorString("this SBThread object is invalid");
971 SBError SBThread::StepUsingScriptedThreadPlan(const char *script_class_name) {
972 return StepUsingScriptedThreadPlan(script_class_name, true);
975 SBError SBThread::StepUsingScriptedThreadPlan(const char *script_class_name,
976 bool resume_immediately) {
977 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
980 std::unique_lock<std::recursive_mutex> lock;
981 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
984 log->Printf("SBThread(%p)::StepUsingScriptedThreadPlan: class name: %s",
985 static_cast<void *>(exe_ctx.GetThreadPtr()), script_class_name);
988 if (!exe_ctx.HasThreadScope()) {
989 sb_error.SetErrorString("this SBThread object is invalid");
993 Thread *thread = exe_ctx.GetThreadPtr();
994 ThreadPlanSP thread_plan_sp =
995 thread->QueueThreadPlanForStepScripted(false, script_class_name, false);
997 if (!thread_plan_sp) {
998 sb_error.SetErrorStringWithFormat(
999 "Error queueing thread plan for class: %s", script_class_name);
1003 if (!resume_immediately) {
1008 sb_error = ResumeNewPlan(exe_ctx, thread_plan_sp.get());
1010 sb_error.SetErrorStringWithFormat(
1011 "Error resuming thread plan for class: %s.", script_class_name);
1013 log->Printf("SBThread(%p)::StepUsingScriptedThreadPlan: Error queuing "
1014 "thread plan for class: %s",
1015 static_cast<void *>(exe_ctx.GetThreadPtr()),
1022 SBError SBThread::JumpToLine(lldb::SBFileSpec &file_spec, uint32_t line) {
1023 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1026 std::unique_lock<std::recursive_mutex> lock;
1027 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1030 log->Printf("SBThread(%p)::JumpToLine (file+line = %s:%u)",
1031 static_cast<void *>(exe_ctx.GetThreadPtr()),
1032 file_spec->GetPath().c_str(), line);
1034 if (!exe_ctx.HasThreadScope()) {
1035 sb_error.SetErrorString("this SBThread object is invalid");
1039 Thread *thread = exe_ctx.GetThreadPtr();
1041 Status err = thread->JumpToLine(file_spec.get(), line, true);
1042 sb_error.SetError(err);
1046 SBError SBThread::ReturnFromFrame(SBFrame &frame, SBValue &return_value) {
1049 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1051 std::unique_lock<std::recursive_mutex> lock;
1052 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1055 log->Printf("SBThread(%p)::ReturnFromFrame (frame=%d)",
1056 static_cast<void *>(exe_ctx.GetThreadPtr()),
1057 frame.GetFrameID());
1059 if (exe_ctx.HasThreadScope()) {
1060 Thread *thread = exe_ctx.GetThreadPtr();
1062 thread->ReturnFromFrame(frame.GetFrameSP(), return_value.GetSP()));
1068 SBError SBThread::UnwindInnermostExpression() {
1071 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1073 std::unique_lock<std::recursive_mutex> lock;
1074 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1077 log->Printf("SBThread(%p)::UnwindExpressionEvaluation",
1078 static_cast<void *>(exe_ctx.GetThreadPtr()));
1080 if (exe_ctx.HasThreadScope()) {
1081 Thread *thread = exe_ctx.GetThreadPtr();
1082 sb_error.SetError(thread->UnwindInnermostExpression());
1083 if (sb_error.Success())
1084 thread->SetSelectedFrameByIndex(0, false);
1090 bool SBThread::Suspend() {
1091 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1092 std::unique_lock<std::recursive_mutex> lock;
1093 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1095 bool result = false;
1096 if (exe_ctx.HasThreadScope()) {
1097 Process::StopLocker stop_locker;
1098 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
1099 exe_ctx.GetThreadPtr()->SetResumeState(eStateSuspended);
1103 log->Printf("SBThread(%p)::Suspend() => error: process is running",
1104 static_cast<void *>(exe_ctx.GetThreadPtr()));
1108 log->Printf("SBThread(%p)::Suspend() => %i",
1109 static_cast<void *>(exe_ctx.GetThreadPtr()), result);
1113 bool SBThread::Resume() {
1114 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1115 std::unique_lock<std::recursive_mutex> lock;
1116 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1118 bool result = false;
1119 if (exe_ctx.HasThreadScope()) {
1120 Process::StopLocker stop_locker;
1121 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
1122 const bool override_suspend = true;
1123 exe_ctx.GetThreadPtr()->SetResumeState(eStateRunning, override_suspend);
1127 log->Printf("SBThread(%p)::Resume() => error: process is running",
1128 static_cast<void *>(exe_ctx.GetThreadPtr()));
1132 log->Printf("SBThread(%p)::Resume() => %i",
1133 static_cast<void *>(exe_ctx.GetThreadPtr()), result);
1137 bool SBThread::IsSuspended() {
1138 std::unique_lock<std::recursive_mutex> lock;
1139 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1141 if (exe_ctx.HasThreadScope())
1142 return exe_ctx.GetThreadPtr()->GetResumeState() == eStateSuspended;
1146 bool SBThread::IsStopped() {
1147 std::unique_lock<std::recursive_mutex> lock;
1148 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1150 if (exe_ctx.HasThreadScope())
1151 return StateIsStoppedState(exe_ctx.GetThreadPtr()->GetState(), true);
1155 SBProcess SBThread::GetProcess() {
1156 SBProcess sb_process;
1157 std::unique_lock<std::recursive_mutex> lock;
1158 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1160 if (exe_ctx.HasThreadScope()) {
1161 // Have to go up to the target so we can get a shared pointer to our
1163 sb_process.SetSP(exe_ctx.GetProcessSP());
1166 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1168 SBStream frame_desc_strm;
1169 sb_process.GetDescription(frame_desc_strm);
1170 log->Printf("SBThread(%p)::GetProcess () => SBProcess(%p): %s",
1171 static_cast<void *>(exe_ctx.GetThreadPtr()),
1172 static_cast<void *>(sb_process.GetSP().get()),
1173 frame_desc_strm.GetData());
1179 uint32_t SBThread::GetNumFrames() {
1180 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1182 uint32_t num_frames = 0;
1183 std::unique_lock<std::recursive_mutex> lock;
1184 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1186 if (exe_ctx.HasThreadScope()) {
1187 Process::StopLocker stop_locker;
1188 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
1189 num_frames = exe_ctx.GetThreadPtr()->GetStackFrameCount();
1192 log->Printf("SBThread(%p)::GetNumFrames() => error: process is running",
1193 static_cast<void *>(exe_ctx.GetThreadPtr()));
1198 log->Printf("SBThread(%p)::GetNumFrames () => %u",
1199 static_cast<void *>(exe_ctx.GetThreadPtr()), num_frames);
1204 SBFrame SBThread::GetFrameAtIndex(uint32_t idx) {
1205 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1208 StackFrameSP frame_sp;
1209 std::unique_lock<std::recursive_mutex> lock;
1210 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1212 if (exe_ctx.HasThreadScope()) {
1213 Process::StopLocker stop_locker;
1214 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
1215 frame_sp = exe_ctx.GetThreadPtr()->GetStackFrameAtIndex(idx);
1216 sb_frame.SetFrameSP(frame_sp);
1220 "SBThread(%p)::GetFrameAtIndex() => error: process is running",
1221 static_cast<void *>(exe_ctx.GetThreadPtr()));
1226 SBStream frame_desc_strm;
1227 sb_frame.GetDescription(frame_desc_strm);
1228 log->Printf("SBThread(%p)::GetFrameAtIndex (idx=%d) => SBFrame(%p): %s",
1229 static_cast<void *>(exe_ctx.GetThreadPtr()), idx,
1230 static_cast<void *>(frame_sp.get()), frame_desc_strm.GetData());
1236 lldb::SBFrame SBThread::GetSelectedFrame() {
1237 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1240 StackFrameSP frame_sp;
1241 std::unique_lock<std::recursive_mutex> lock;
1242 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1244 if (exe_ctx.HasThreadScope()) {
1245 Process::StopLocker stop_locker;
1246 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
1247 frame_sp = exe_ctx.GetThreadPtr()->GetSelectedFrame();
1248 sb_frame.SetFrameSP(frame_sp);
1252 "SBThread(%p)::GetSelectedFrame() => error: process is running",
1253 static_cast<void *>(exe_ctx.GetThreadPtr()));
1258 SBStream frame_desc_strm;
1259 sb_frame.GetDescription(frame_desc_strm);
1260 log->Printf("SBThread(%p)::GetSelectedFrame () => SBFrame(%p): %s",
1261 static_cast<void *>(exe_ctx.GetThreadPtr()),
1262 static_cast<void *>(frame_sp.get()), frame_desc_strm.GetData());
1268 lldb::SBFrame SBThread::SetSelectedFrame(uint32_t idx) {
1269 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1272 StackFrameSP frame_sp;
1273 std::unique_lock<std::recursive_mutex> lock;
1274 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1276 if (exe_ctx.HasThreadScope()) {
1277 Process::StopLocker stop_locker;
1278 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
1279 Thread *thread = exe_ctx.GetThreadPtr();
1280 frame_sp = thread->GetStackFrameAtIndex(idx);
1282 thread->SetSelectedFrame(frame_sp.get());
1283 sb_frame.SetFrameSP(frame_sp);
1288 "SBThread(%p)::SetSelectedFrame() => error: process is running",
1289 static_cast<void *>(exe_ctx.GetThreadPtr()));
1294 SBStream frame_desc_strm;
1295 sb_frame.GetDescription(frame_desc_strm);
1296 log->Printf("SBThread(%p)::SetSelectedFrame (idx=%u) => SBFrame(%p): %s",
1297 static_cast<void *>(exe_ctx.GetThreadPtr()), idx,
1298 static_cast<void *>(frame_sp.get()), frame_desc_strm.GetData());
1303 bool SBThread::EventIsThreadEvent(const SBEvent &event) {
1304 return Thread::ThreadEventData::GetEventDataFromEvent(event.get()) != NULL;
1307 SBFrame SBThread::GetStackFrameFromEvent(const SBEvent &event) {
1308 return Thread::ThreadEventData::GetStackFrameFromEvent(event.get());
1311 SBThread SBThread::GetThreadFromEvent(const SBEvent &event) {
1312 return Thread::ThreadEventData::GetThreadFromEvent(event.get());
1315 bool SBThread::operator==(const SBThread &rhs) const {
1316 return m_opaque_sp->GetThreadSP().get() ==
1317 rhs.m_opaque_sp->GetThreadSP().get();
1320 bool SBThread::operator!=(const SBThread &rhs) const {
1321 return m_opaque_sp->GetThreadSP().get() !=
1322 rhs.m_opaque_sp->GetThreadSP().get();
1325 bool SBThread::GetStatus(SBStream &status) const {
1326 Stream &strm = status.ref();
1328 std::unique_lock<std::recursive_mutex> lock;
1329 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1331 if (exe_ctx.HasThreadScope()) {
1332 exe_ctx.GetThreadPtr()->GetStatus(strm, 0, 1, 1, true);
1334 strm.PutCString("No status");
1339 bool SBThread::GetDescription(SBStream &description) const {
1340 return GetDescription(description, false);
1343 bool SBThread::GetDescription(SBStream &description, bool stop_format) const {
1344 Stream &strm = description.ref();
1346 std::unique_lock<std::recursive_mutex> lock;
1347 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1349 if (exe_ctx.HasThreadScope()) {
1350 exe_ctx.GetThreadPtr()->DumpUsingSettingsFormat(strm,
1351 LLDB_INVALID_THREAD_ID,
1353 // strm.Printf("SBThread: tid = 0x%4.4" PRIx64,
1354 // exe_ctx.GetThreadPtr()->GetID());
1356 strm.PutCString("No value");
1361 SBThread SBThread::GetExtendedBacktraceThread(const char *type) {
1362 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1363 std::unique_lock<std::recursive_mutex> lock;
1364 ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1365 SBThread sb_origin_thread;
1367 if (exe_ctx.HasThreadScope()) {
1368 Process::StopLocker stop_locker;
1369 if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
1370 ThreadSP real_thread(exe_ctx.GetThreadSP());
1372 ConstString type_const(type);
1373 Process *process = exe_ctx.GetProcessPtr();
1375 SystemRuntime *runtime = process->GetSystemRuntime();
1377 ThreadSP new_thread_sp(
1378 runtime->GetExtendedBacktraceThread(real_thread, type_const));
1379 if (new_thread_sp) {
1380 // Save this in the Process' ExtendedThreadList so a strong
1381 // pointer retains the
1383 process->GetExtendedThreadList().AddThread(new_thread_sp);
1384 sb_origin_thread.SetThread(new_thread_sp);
1386 const char *queue_name = new_thread_sp->GetQueueName();
1387 if (queue_name == NULL)
1389 log->Printf("SBThread(%p)::GetExtendedBacktraceThread() => new "
1391 "created (%p) with queue_id 0x%" PRIx64
1393 static_cast<void *>(exe_ctx.GetThreadPtr()),
1394 static_cast<void *>(new_thread_sp.get()),
1395 new_thread_sp->GetQueueID(), queue_name);
1403 log->Printf("SBThread(%p)::GetExtendedBacktraceThread() => error: "
1404 "process is running",
1405 static_cast<void *>(exe_ctx.GetThreadPtr()));
1409 if (log && sb_origin_thread.IsValid() == false)
1410 log->Printf("SBThread(%p)::GetExtendedBacktraceThread() is not returning a "
1412 static_cast<void *>(exe_ctx.GetThreadPtr()));
1413 return sb_origin_thread;
1416 uint32_t SBThread::GetExtendedBacktraceOriginatingIndexID() {
1417 ThreadSP thread_sp(m_opaque_sp->GetThreadSP());
1419 return thread_sp->GetExtendedBacktraceOriginatingIndexID();
1420 return LLDB_INVALID_INDEX32;
1423 bool SBThread::SafeToCallFunctions() {
1424 ThreadSP thread_sp(m_opaque_sp->GetThreadSP());
1426 return thread_sp->SafeToCallFunctions();
1430 lldb_private::Thread *SBThread::operator->() {
1431 ThreadSP thread_sp(m_opaque_sp->GetThreadSP());
1433 return thread_sp.get();
1438 lldb_private::Thread *SBThread::get() {
1439 ThreadSP thread_sp(m_opaque_sp->GetThreadSP());
1441 return thread_sp.get();