LLDB  mainline
Thread.cpp
Go to the documentation of this file.
1 //===-- Thread.cpp --------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "lldb/Target/Thread.h"
11 #include "lldb/Core/Debugger.h"
12 #include "lldb/Core/FormatEntity.h"
13 #include "lldb/Core/Module.h"
15 #include "lldb/Core/ValueObject.h"
17 #include "lldb/Host/Host.h"
21 #include "lldb/Symbol/Function.h"
22 #include "lldb/Target/ABI.h"
26 #include "lldb/Target/Process.h"
29 #include "lldb/Target/StopInfo.h"
31 #include "lldb/Target/Target.h"
32 #include "lldb/Target/ThreadPlan.h"
45 #include "lldb/Target/ThreadSpec.h"
46 #include "lldb/Target/UnwindLLDB.h"
47 #include "lldb/Utility/LLDBLog.h"
48 #include "lldb/Utility/Log.h"
50 #include "lldb/Utility/State.h"
51 #include "lldb/Utility/Stream.h"
53 #include "lldb/lldb-enumerations.h"
54 
55 #include <memory>
56 
57 using namespace lldb;
58 using namespace lldb_private;
59 
61  // NOTE: intentional leak so we don't crash if global destructor chain gets
62  // called as other threads still use the result of this function
63  static ThreadProperties *g_settings_ptr = new ThreadProperties(true);
64  return *g_settings_ptr;
65 }
66 
67 #define LLDB_PROPERTIES_thread
68 #include "TargetProperties.inc"
69 
70 enum {
71 #define LLDB_PROPERTIES_thread
72 #include "TargetPropertiesEnum.inc"
73 };
74 
76  : public Cloneable<ThreadOptionValueProperties, OptionValueProperties> {
77 public:
79 
81  bool will_modify,
82  uint32_t idx) const override {
83  // When getting the value for a key from the thread options, we will always
84  // try and grab the setting from the current thread if there is one. Else
85  // we just use the one from this instance.
86  if (exe_ctx) {
87  Thread *thread = exe_ctx->GetThreadPtr();
88  if (thread) {
89  ThreadOptionValueProperties *instance_properties =
90  static_cast<ThreadOptionValueProperties *>(
91  thread->GetValueProperties().get());
92  if (this != instance_properties)
93  return instance_properties->ProtectedGetPropertyAtIndex(idx);
94  }
95  }
96  return ProtectedGetPropertyAtIndex(idx);
97  }
98 };
99 
100 ThreadProperties::ThreadProperties(bool is_global) : Properties() {
101  if (is_global) {
103  std::make_shared<ThreadOptionValueProperties>(ConstString("thread"));
104  m_collection_sp->Initialize(g_thread_properties);
105  } else
108 }
109 
111 
113  const uint32_t idx = ePropertyStepAvoidRegex;
114  return m_collection_sp->GetPropertyAtIndexAsOptionValueRegex(nullptr, idx);
115 }
116 
118  const uint32_t idx = ePropertyStepAvoidLibraries;
119  const OptionValueFileSpecList *option_value =
120  m_collection_sp->GetPropertyAtIndexAsOptionValueFileSpecList(nullptr,
121  false, idx);
122  assert(option_value);
123  return option_value->GetCurrentValue();
124 }
125 
127  const uint32_t idx = ePropertyEnableThreadTrace;
128  return m_collection_sp->GetPropertyAtIndexAsBoolean(
129  nullptr, idx, g_thread_properties[idx].default_uint_value != 0);
130 }
131 
133  const uint32_t idx = ePropertyStepInAvoidsNoDebug;
134  return m_collection_sp->GetPropertyAtIndexAsBoolean(
135  nullptr, idx, g_thread_properties[idx].default_uint_value != 0);
136 }
137 
139  const uint32_t idx = ePropertyStepOutAvoidsNoDebug;
140  return m_collection_sp->GetPropertyAtIndexAsBoolean(
141  nullptr, idx, g_thread_properties[idx].default_uint_value != 0);
142 }
143 
145  const uint32_t idx = ePropertyMaxBacktraceDepth;
146  return m_collection_sp->GetPropertyAtIndexAsUInt64(
147  nullptr, idx, g_thread_properties[idx].default_uint_value != 0);
148 }
149 
150 // Thread Event Data
151 
153  static ConstString g_flavor("Thread::ThreadEventData");
154  return g_flavor;
155 }
156 
157 Thread::ThreadEventData::ThreadEventData(const lldb::ThreadSP thread_sp)
158  : m_thread_sp(thread_sp), m_stack_id() {}
159 
160 Thread::ThreadEventData::ThreadEventData(const lldb::ThreadSP thread_sp,
161  const StackID &stack_id)
162  : m_thread_sp(thread_sp), m_stack_id(stack_id) {}
163 
164 Thread::ThreadEventData::ThreadEventData() : m_thread_sp(), m_stack_id() {}
165 
167 
169 
172  if (event_ptr) {
173  const EventData *event_data = event_ptr->GetData();
174  if (event_data &&
175  event_data->GetFlavor() == ThreadEventData::GetFlavorString())
176  return static_cast<const ThreadEventData *>(event_ptr->GetData());
177  }
178  return nullptr;
179 }
180 
182  ThreadSP thread_sp;
183  const ThreadEventData *event_data = GetEventDataFromEvent(event_ptr);
184  if (event_data)
185  thread_sp = event_data->GetThread();
186  return thread_sp;
187 }
188 
190  StackID stack_id;
191  const ThreadEventData *event_data = GetEventDataFromEvent(event_ptr);
192  if (event_data)
193  stack_id = event_data->GetStackID();
194  return stack_id;
195 }
196 
197 StackFrameSP
199  const ThreadEventData *event_data = GetEventDataFromEvent(event_ptr);
200  StackFrameSP frame_sp;
201  if (event_data) {
202  ThreadSP thread_sp = event_data->GetThread();
203  if (thread_sp) {
204  frame_sp = thread_sp->GetStackFrameList()->GetFrameWithStackID(
205  event_data->GetStackID());
206  }
207  }
208  return frame_sp;
209 }
210 
211 // Thread class
212 
214  static ConstString class_name("lldb.thread");
215  return class_name;
216 }
217 
218 Thread::Thread(Process &process, lldb::tid_t tid, bool use_invalid_index_id)
219  : ThreadProperties(false), UserID(tid),
220  Broadcaster(process.GetTarget().GetDebugger().GetBroadcasterManager(),
221  Thread::GetStaticBroadcasterClass().AsCString()),
222  m_process_wp(process.shared_from_this()), m_stop_info_sp(),
225  m_index_id(use_invalid_index_id ? LLDB_INVALID_INDEX32
226  : process.GetNextThreadIndexID(tid)),
234  Log *log = GetLog(LLDBLog::Object);
235  LLDB_LOGF(log, "%p Thread::Thread(tid = 0x%4.4" PRIx64 ")",
236  static_cast<void *>(this), GetID());
237 
239 }
240 
242  Log *log = GetLog(LLDBLog::Object);
243  LLDB_LOGF(log, "%p Thread::~Thread(tid = 0x%4.4" PRIx64 ")",
244  static_cast<void *>(this), GetID());
245  /// If you hit this assert, it means your derived class forgot to call
246  /// DoDestroy in its destructor.
247  assert(m_destroy_called);
248 }
249 
251  m_destroy_called = true;
252  m_stop_info_sp.reset();
253  m_reg_context_sp.reset();
254  m_unwinder_up.reset();
255  std::lock_guard<std::recursive_mutex> guard(m_frame_mutex);
256  m_curr_frames_sp.reset();
257  m_prev_frames_sp.reset();
258 }
259 
263  new ThreadEventData(this->shared_from_this(), new_frame_id));
264 }
265 
266 lldb::StackFrameSP Thread::GetSelectedFrame() {
267  StackFrameListSP stack_frame_list_sp(GetStackFrameList());
268  StackFrameSP frame_sp = stack_frame_list_sp->GetFrameAtIndex(
269  stack_frame_list_sp->GetSelectedFrameIndex());
270  FrameSelectedCallback(frame_sp.get());
271  return frame_sp;
272 }
273 
275  bool broadcast) {
276  uint32_t ret_value = GetStackFrameList()->SetSelectedFrame(frame);
277  if (broadcast)
279  FrameSelectedCallback(frame);
280  return ret_value;
281 }
282 
283 bool Thread::SetSelectedFrameByIndex(uint32_t frame_idx, bool broadcast) {
284  StackFrameSP frame_sp(GetStackFrameList()->GetFrameAtIndex(frame_idx));
285  if (frame_sp) {
286  GetStackFrameList()->SetSelectedFrame(frame_sp.get());
287  if (broadcast)
288  BroadcastSelectedFrameChange(frame_sp->GetStackID());
289  FrameSelectedCallback(frame_sp.get());
290  return true;
291  } else
292  return false;
293 }
294 
296  Stream &output_stream) {
297  const bool broadcast = true;
298  bool success = SetSelectedFrameByIndex(frame_idx, broadcast);
299  if (success) {
300  StackFrameSP frame_sp = GetSelectedFrame();
301  if (frame_sp) {
302  bool already_shown = false;
303  SymbolContext frame_sc(
304  frame_sp->GetSymbolContext(eSymbolContextLineEntry));
305  if (GetProcess()->GetTarget().GetDebugger().GetUseExternalEditor() &&
306  frame_sc.line_entry.file && frame_sc.line_entry.line != 0) {
307  already_shown = Host::OpenFileInExternalEditor(
308  frame_sc.line_entry.file, frame_sc.line_entry.line);
309  }
310 
311  bool show_frame_info = true;
312  bool show_source = !already_shown;
313  FrameSelectedCallback(frame_sp.get());
314  return frame_sp->GetStatus(output_stream, show_frame_info, show_source);
315  }
316  return false;
317  } else
318  return false;
319 }
320 
322  if (!frame)
323  return;
324 
325  if (frame->HasDebugInformation() &&
326  (GetProcess()->GetWarningsOptimization() ||
327  GetProcess()->GetWarningsUnsupportedLanguage())) {
328  SymbolContext sc =
329  frame->GetSymbolContext(eSymbolContextFunction | eSymbolContextModule);
330  GetProcess()->PrintWarningOptimization(sc);
331  GetProcess()->PrintWarningUnsupportedLanguage(sc);
332  }
333 }
334 
335 lldb::StopInfoSP Thread::GetStopInfo() {
336  if (m_destroy_called)
337  return m_stop_info_sp;
338 
339  ThreadPlanSP completed_plan_sp(GetCompletedPlan());
340  ProcessSP process_sp(GetProcess());
341  const uint32_t stop_id = process_sp ? process_sp->GetStopID() : UINT32_MAX;
342 
343  // Here we select the stop info according to priorirty: - m_stop_info_sp (if
344  // not trace) - preset value - completed plan stop info - new value with plan
345  // from completed plan stack - m_stop_info_sp (trace stop reason is OK now) -
346  // ask GetPrivateStopInfo to set stop info
347 
348  bool have_valid_stop_info = m_stop_info_sp &&
349  m_stop_info_sp ->IsValid() &&
350  m_stop_info_stop_id == stop_id;
351  bool have_valid_completed_plan = completed_plan_sp && completed_plan_sp->PlanSucceeded();
352  bool plan_failed = completed_plan_sp && !completed_plan_sp->PlanSucceeded();
353  bool plan_overrides_trace =
354  have_valid_stop_info && have_valid_completed_plan
355  && (m_stop_info_sp->GetStopReason() == eStopReasonTrace);
356 
357  if (have_valid_stop_info && !plan_overrides_trace && !plan_failed) {
358  return m_stop_info_sp;
359  } else if (completed_plan_sp) {
361  completed_plan_sp, GetReturnValueObject(), GetExpressionVariable());
362  } else {
364  return m_stop_info_sp;
365  }
366 }
367 
369  ResetStopInfo();
371 }
372 
373 lldb::StopInfoSP Thread::GetPrivateStopInfo(bool calculate) {
374  if (!calculate)
375  return m_stop_info_sp;
376 
377  if (m_destroy_called)
378  return m_stop_info_sp;
379 
380  ProcessSP process_sp(GetProcess());
381  if (process_sp) {
382  const uint32_t process_stop_id = process_sp->GetStopID();
383  if (m_stop_info_stop_id != process_stop_id) {
384  // We preserve the old stop info for a variety of reasons:
385  // 1) Someone has already updated it by the time we get here
386  // 2) We didn't get to execute the breakpoint instruction we stopped at
387  // 3) This is a virtual step so we didn't actually run
388  // 4) If this thread wasn't allowed to run the last time round.
389  if (m_stop_info_sp) {
390  if (m_stop_info_sp->IsValid() || IsStillAtLastBreakpointHit() ||
391  GetCurrentPlan()->IsVirtualStep()
394  else
395  m_stop_info_sp.reset();
396  }
397 
398  if (!m_stop_info_sp) {
399  if (!CalculateStopInfo())
400  SetStopInfo(StopInfoSP());
401  }
402  }
403 
404  // The stop info can be manually set by calling Thread::SetStopInfo() prior
405  // to this function ever getting called, so we can't rely on
406  // "m_stop_info_stop_id != process_stop_id" as the condition for the if
407  // statement below, we must also check the stop info to see if we need to
408  // override it. See the header documentation in
409  // Architecture::OverrideStopInfo() for more information on the stop
410  // info override callback.
411  if (m_stop_info_override_stop_id != process_stop_id) {
412  m_stop_info_override_stop_id = process_stop_id;
413  if (m_stop_info_sp) {
414  if (const Architecture *arch =
415  process_sp->GetTarget().GetArchitecturePlugin())
416  arch->OverrideStopInfo(*this);
417  }
418  }
419  }
420  return m_stop_info_sp;
421 }
422 
424  lldb::StopInfoSP stop_info_sp(GetStopInfo());
425  if (stop_info_sp)
426  return stop_info_sp->GetStopReason();
427  return eStopReasonNone;
428 }
429 
431  ProcessSP process_sp(GetProcess());
432  if (process_sp)
433  return m_stop_info_stop_id == process_sp->GetStopID();
434  else
435  return true; // Process is no longer around so stop info is always up to
436  // date...
437 }
438 
440  if (m_stop_info_sp) {
441  m_stop_info_sp.reset();
442  }
443 }
444 
445 void Thread::SetStopInfo(const lldb::StopInfoSP &stop_info_sp) {
446  m_stop_info_sp = stop_info_sp;
447  if (m_stop_info_sp) {
448  m_stop_info_sp->MakeStopInfoValid();
449  // If we are overriding the ShouldReportStop, do that here:
451  m_stop_info_sp->OverrideShouldNotify(m_override_should_notify ==
452  eLazyBoolYes);
453  }
454 
455  ProcessSP process_sp(GetProcess());
456  if (process_sp)
457  m_stop_info_stop_id = process_sp->GetStopID();
458  else
460  Log *log = GetLog(LLDBLog::Thread);
461  LLDB_LOGF(log, "%p: tid = 0x%" PRIx64 ": stop info = %s (stop_id = %u)",
462  static_cast<void *>(this), GetID(),
463  stop_info_sp ? stop_info_sp->GetDescription() : "<NULL>",
465 }
466 
468  if (vote == eVoteNoOpinion)
469  return;
470  else {
472  if (m_stop_info_sp)
473  m_stop_info_sp->OverrideShouldNotify(m_override_should_notify ==
474  eLazyBoolYes);
475  }
476 }
477 
479  // Note, we can't just NULL out the private reason, or the native thread
480  // implementation will try to go calculate it again. For now, just set it to
481  // a Unix Signal with an invalid signal number.
482  SetStopInfo(
484 }
485 
487 
489  saved_state.register_backup_sp.reset();
490  lldb::StackFrameSP frame_sp(GetStackFrameAtIndex(0));
491  if (frame_sp) {
492  lldb::RegisterCheckpointSP reg_checkpoint_sp(
494  if (reg_checkpoint_sp) {
495  lldb::RegisterContextSP reg_ctx_sp(frame_sp->GetRegisterContext());
496  if (reg_ctx_sp && reg_ctx_sp->ReadAllRegisterValues(*reg_checkpoint_sp))
497  saved_state.register_backup_sp = reg_checkpoint_sp;
498  }
499  }
500  if (!saved_state.register_backup_sp)
501  return false;
502 
503  saved_state.stop_info_sp = GetStopInfo();
504  ProcessSP process_sp(GetProcess());
505  if (process_sp)
506  saved_state.orig_stop_id = process_sp->GetStopID();
508  saved_state.m_completed_plan_checkpoint =
510 
511  return true;
512 }
513 
515  ThreadStateCheckpoint &saved_state) {
516  if (saved_state.register_backup_sp) {
517  lldb::StackFrameSP frame_sp(GetStackFrameAtIndex(0));
518  if (frame_sp) {
519  lldb::RegisterContextSP reg_ctx_sp(frame_sp->GetRegisterContext());
520  if (reg_ctx_sp) {
521  bool ret =
522  reg_ctx_sp->WriteAllRegisterValues(*saved_state.register_backup_sp);
523 
524  // Clear out all stack frames as our world just changed.
526  reg_ctx_sp->InvalidateIfNeeded(true);
527  if (m_unwinder_up)
528  m_unwinder_up->Clear();
529  return ret;
530  }
531  }
532  }
533  return false;
534 }
535 
537  ThreadStateCheckpoint &saved_state) {
538  if (saved_state.stop_info_sp)
539  saved_state.stop_info_sp->MakeStopInfoValid();
540  SetStopInfo(saved_state.stop_info_sp);
541  GetStackFrameList()->SetCurrentInlinedDepth(
542  saved_state.current_inlined_depth);
544  saved_state.m_completed_plan_checkpoint);
545 }
546 
548  // If any other threads access this we will need a mutex for it
549  std::lock_guard<std::recursive_mutex> guard(m_state_mutex);
550  return m_state;
551 }
552 
554  std::lock_guard<std::recursive_mutex> guard(m_state_mutex);
555  m_state = state;
556 }
557 
559  StackFrameSP frame_sp = GetStackFrameAtIndex(0);
560 
561  if (!frame_sp)
562  return GetStopDescriptionRaw();
563 
564  auto recognized_frame_sp = frame_sp->GetRecognizedFrame();
565 
566  if (!recognized_frame_sp)
567  return GetStopDescriptionRaw();
568 
569  std::string recognized_stop_description =
570  recognized_frame_sp->GetStopDescription();
571 
572  if (!recognized_stop_description.empty())
573  return recognized_stop_description;
574 
575  return GetStopDescriptionRaw();
576 }
577 
579  StopInfoSP stop_info_sp = GetStopInfo();
580  std::string raw_stop_description;
581  if (stop_info_sp && stop_info_sp->IsValid()) {
582  raw_stop_description = stop_info_sp->GetDescription();
583  assert((!raw_stop_description.empty() ||
584  stop_info_sp->GetStopReason() == eStopReasonNone) &&
585  "StopInfo returned an empty description.");
586  }
587  return raw_stop_description;
588 }
589 
591  Log *log = GetLog(LLDBLog::Thread);
592 
593  auto frames_list_sp = GetStackFrameList();
594 
595  // Only the top frame should be recognized.
596  auto frame_sp = frames_list_sp->GetFrameAtIndex(0);
597 
598  auto recognized_frame_sp = frame_sp->GetRecognizedFrame();
599 
600  if (!recognized_frame_sp) {
601  LLDB_LOG(log, "Frame #0 not recognized");
602  return;
603  }
604 
605  if (StackFrameSP most_relevant_frame_sp =
606  recognized_frame_sp->GetMostRelevantFrame()) {
607  LLDB_LOG(log, "Found most relevant frame at index {0}",
608  most_relevant_frame_sp->GetFrameIndex());
609  SetSelectedFrame(most_relevant_frame_sp.get());
610  } else {
611  LLDB_LOG(log, "No relevant frame!");
612  }
613 }
614 
616  ThreadPlan *current_plan = GetCurrentPlan();
617 
619 
620  // FIXME: I may decide to disallow threads with no plans. In which
621  // case this should go to an assert.
622 
623  if (!current_plan)
624  return;
625 
626  current_plan->WillStop();
627 }
628 
630  if (GetResumeState() != eStateSuspended) {
631  // If we're at a breakpoint push the step-over breakpoint plan. Do this
632  // before telling the current plan it will resume, since we might change
633  // what the current plan is.
634 
635  lldb::RegisterContextSP reg_ctx_sp(GetRegisterContext());
636  if (reg_ctx_sp) {
637  const addr_t thread_pc = reg_ctx_sp->GetPC();
638  BreakpointSiteSP bp_site_sp =
639  GetProcess()->GetBreakpointSiteList().FindByAddress(thread_pc);
640  if (bp_site_sp) {
641  // Note, don't assume there's a ThreadPlanStepOverBreakpoint, the
642  // target may not require anything special to step over a breakpoint.
643 
644  ThreadPlan *cur_plan = GetCurrentPlan();
645 
646  bool push_step_over_bp_plan = false;
647  if (cur_plan->GetKind() == ThreadPlan::eKindStepOverBreakpoint) {
649  (ThreadPlanStepOverBreakpoint *)cur_plan;
650  if (bp_plan->GetBreakpointLoadAddress() != thread_pc)
651  push_step_over_bp_plan = true;
652  } else
653  push_step_over_bp_plan = true;
654 
655  if (push_step_over_bp_plan) {
656  ThreadPlanSP step_bp_plan_sp(new ThreadPlanStepOverBreakpoint(*this));
657  if (step_bp_plan_sp) {
658  step_bp_plan_sp->SetPrivate(true);
659 
660  if (GetCurrentPlan()->RunState() != eStateStepping) {
661  ThreadPlanStepOverBreakpoint *step_bp_plan =
662  static_cast<ThreadPlanStepOverBreakpoint *>(
663  step_bp_plan_sp.get());
664  step_bp_plan->SetAutoContinue(true);
665  }
666  QueueThreadPlan(step_bp_plan_sp, false);
667  }
668  }
669  }
670  }
671  }
672 }
673 
674 bool Thread::ShouldResume(StateType resume_state) {
675  // At this point clear the completed plan stack.
676  GetPlans().WillResume();
678 
679  StateType prev_resume_state = GetTemporaryResumeState();
680 
681  SetTemporaryResumeState(resume_state);
682 
683  lldb::ThreadSP backing_thread_sp(GetBackingThread());
684  if (backing_thread_sp)
685  backing_thread_sp->SetTemporaryResumeState(resume_state);
686 
687  // Make sure m_stop_info_sp is valid. Don't do this for threads we suspended
688  // in the previous run.
689  if (prev_resume_state != eStateSuspended)
691 
692  // This is a little dubious, but we are trying to limit how often we actually
693  // fetch stop info from the target, 'cause that slows down single stepping.
694  // So assume that if we got to the point where we're about to resume, and we
695  // haven't yet had to fetch the stop reason, then it doesn't need to know
696  // about the fact that we are resuming...
697  const uint32_t process_stop_id = GetProcess()->GetStopID();
698  if (m_stop_info_stop_id == process_stop_id &&
699  (m_stop_info_sp && m_stop_info_sp->IsValid())) {
700  StopInfo *stop_info = GetPrivateStopInfo().get();
701  if (stop_info)
702  stop_info->WillResume(resume_state);
703  }
704 
705  // Tell all the plans that we are about to resume in case they need to clear
706  // any state. We distinguish between the plan on the top of the stack and the
707  // lower plans in case a plan needs to do any special business before it
708  // runs.
709 
710  bool need_to_resume = false;
711  ThreadPlan *plan_ptr = GetCurrentPlan();
712  if (plan_ptr) {
713  need_to_resume = plan_ptr->WillResume(resume_state, true);
714 
715  while ((plan_ptr = GetPreviousPlan(plan_ptr)) != nullptr) {
716  plan_ptr->WillResume(resume_state, false);
717  }
718 
719  // If the WillResume for the plan says we are faking a resume, then it will
720  // have set an appropriate stop info. In that case, don't reset it here.
721 
722  if (need_to_resume && resume_state != eStateSuspended) {
723  m_stop_info_sp.reset();
724  }
725  }
726 
727  if (need_to_resume) {
729  // Let Thread subclasses do any special work they need to prior to resuming
730  WillResume(resume_state);
731  }
732 
733  return need_to_resume;
734 }
735 
738  // This will get recomputed each time when we stop.
740 }
741 
743 
744 bool Thread::ShouldStop(Event *event_ptr) {
745  ThreadPlan *current_plan = GetCurrentPlan();
746 
747  bool should_stop = true;
748 
749  Log *log = GetLog(LLDBLog::Step);
750 
751  if (GetResumeState() == eStateSuspended) {
752  LLDB_LOGF(log,
753  "Thread::%s for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64
754  ", should_stop = 0 (ignore since thread was suspended)",
755  __FUNCTION__, GetID(), GetProtocolID());
756  return false;
757  }
758 
760  LLDB_LOGF(log,
761  "Thread::%s for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64
762  ", should_stop = 0 (ignore since thread was suspended)",
763  __FUNCTION__, GetID(), GetProtocolID());
764  return false;
765  }
766 
767  // Based on the current thread plan and process stop info, check if this
768  // thread caused the process to stop. NOTE: this must take place before the
769  // plan is moved from the current plan stack to the completed plan stack.
770  if (!ThreadStoppedForAReason()) {
771  LLDB_LOGF(log,
772  "Thread::%s for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64
773  ", pc = 0x%16.16" PRIx64
774  ", should_stop = 0 (ignore since no stop reason)",
775  __FUNCTION__, GetID(), GetProtocolID(),
778  return false;
779  }
780 
781  // Clear the "must run me before stop" if it was set:
783 
784  if (log) {
785  LLDB_LOGF(log,
786  "Thread::%s(%p) for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64
787  ", pc = 0x%16.16" PRIx64,
788  __FUNCTION__, static_cast<void *>(this), GetID(), GetProtocolID(),
791  LLDB_LOGF(log, "^^^^^^^^ Thread::ShouldStop Begin ^^^^^^^^");
792  StreamString s;
793  s.IndentMore();
794  GetProcess()->DumpThreadPlansForTID(
795  s, GetID(), eDescriptionLevelVerbose, true /* internal */,
796  false /* condense_trivial */, true /* skip_unreported */);
797  LLDB_LOGF(log, "Plan stack initial state:\n%s", s.GetData());
798  }
799 
800  // The top most plan always gets to do the trace log...
801  current_plan->DoTraceLog();
802 
803  // First query the stop info's ShouldStopSynchronous. This handles
804  // "synchronous" stop reasons, for example the breakpoint command on internal
805  // breakpoints. If a synchronous stop reason says we should not stop, then
806  // we don't have to do any more work on this stop.
807  StopInfoSP private_stop_info(GetPrivateStopInfo());
808  if (private_stop_info &&
809  !private_stop_info->ShouldStopSynchronous(event_ptr)) {
810  LLDB_LOGF(log, "StopInfo::ShouldStop async callback says we should not "
811  "stop, returning ShouldStop of false.");
812  return false;
813  }
814 
815  // If we've already been restarted, don't query the plans since the state
816  // they would examine is not current.
818  return false;
819 
820  // Before the plans see the state of the world, calculate the current inlined
821  // depth.
822  GetStackFrameList()->CalculateCurrentInlinedDepth();
823 
824  // If the base plan doesn't understand why we stopped, then we have to find a
825  // plan that does. If that plan is still working, then we don't need to do
826  // any more work. If the plan that explains the stop is done, then we should
827  // pop all the plans below it, and pop it, and then let the plans above it
828  // decide whether they still need to do more work.
829 
830  bool done_processing_current_plan = false;
831 
832  if (!current_plan->PlanExplainsStop(event_ptr)) {
833  if (current_plan->TracerExplainsStop()) {
834  done_processing_current_plan = true;
835  should_stop = false;
836  } else {
837  // If the current plan doesn't explain the stop, then find one that does
838  // and let it handle the situation.
839  ThreadPlan *plan_ptr = current_plan;
840  while ((plan_ptr = GetPreviousPlan(plan_ptr)) != nullptr) {
841  if (plan_ptr->PlanExplainsStop(event_ptr)) {
842  LLDB_LOGF(log, "Plan %s explains stop.", plan_ptr->GetName());
843 
844  should_stop = plan_ptr->ShouldStop(event_ptr);
845 
846  // plan_ptr explains the stop, next check whether plan_ptr is done,
847  // if so, then we should take it and all the plans below it off the
848  // stack.
849 
850  if (plan_ptr->MischiefManaged()) {
851  // We're going to pop the plans up to and including the plan that
852  // explains the stop.
853  ThreadPlan *prev_plan_ptr = GetPreviousPlan(plan_ptr);
854 
855  do {
856  if (should_stop)
857  current_plan->WillStop();
858  PopPlan();
859  } while ((current_plan = GetCurrentPlan()) != prev_plan_ptr);
860  // Now, if the responsible plan was not "Okay to discard" then
861  // we're done, otherwise we forward this to the next plan in the
862  // stack below.
863  done_processing_current_plan =
864  (plan_ptr->IsControllingPlan() && !plan_ptr->OkayToDiscard());
865  } else {
866  bool should_force_run = plan_ptr->ShouldRunBeforePublicStop();
867  if (should_force_run) {
869  should_stop = false;
870  }
871  done_processing_current_plan = true;
872  }
873  break;
874  }
875  }
876  }
877  }
878 
879  if (!done_processing_current_plan) {
880  bool override_stop = false;
881 
882  // We're starting from the base plan, so just let it decide;
883  if (current_plan->IsBasePlan()) {
884  should_stop = current_plan->ShouldStop(event_ptr);
885  LLDB_LOGF(log, "Base plan says should stop: %i.", should_stop);
886  } else {
887  // Otherwise, don't let the base plan override what the other plans say
888  // to do, since presumably if there were other plans they would know what
889  // to do...
890  while (true) {
891  if (current_plan->IsBasePlan())
892  break;
893 
894  should_stop = current_plan->ShouldStop(event_ptr);
895  LLDB_LOGF(log, "Plan %s should stop: %d.", current_plan->GetName(),
896  should_stop);
897  if (current_plan->MischiefManaged()) {
898  if (should_stop)
899  current_plan->WillStop();
900 
901  if (current_plan->ShouldAutoContinue(event_ptr)) {
902  override_stop = true;
903  LLDB_LOGF(log, "Plan %s auto-continue: true.",
904  current_plan->GetName());
905  }
906 
907  // If a Controlling Plan wants to stop, we let it. Otherwise, see if
908  // the plan's parent wants to stop.
909 
910  PopPlan();
911  if (should_stop && current_plan->IsControllingPlan() &&
912  !current_plan->OkayToDiscard()) {
913  break;
914  }
915 
916  current_plan = GetCurrentPlan();
917  if (current_plan == nullptr) {
918  break;
919  }
920  } else {
921  break;
922  }
923  }
924  }
925 
926  if (override_stop)
927  should_stop = false;
928  }
929 
930  // One other potential problem is that we set up a controlling plan, then stop
931  // in before it is complete - for instance by hitting a breakpoint during a
932  // step-over - then do some step/finish/etc operations that wind up past the
933  // end point condition of the initial plan. We don't want to strand the
934  // original plan on the stack, This code clears stale plans off the stack.
935 
936  if (should_stop) {
937  ThreadPlan *plan_ptr = GetCurrentPlan();
938 
939  // Discard the stale plans and all plans below them in the stack, plus move
940  // the completed plans to the completed plan stack
941  while (!plan_ptr->IsBasePlan()) {
942  bool stale = plan_ptr->IsPlanStale();
943  ThreadPlan *examined_plan = plan_ptr;
944  plan_ptr = GetPreviousPlan(examined_plan);
945 
946  if (stale) {
947  LLDB_LOGF(
948  log,
949  "Plan %s being discarded in cleanup, it says it is already done.",
950  examined_plan->GetName());
951  while (GetCurrentPlan() != examined_plan) {
952  DiscardPlan();
953  }
954  if (examined_plan->IsPlanComplete()) {
955  // plan is complete but does not explain the stop (example: step to a
956  // line with breakpoint), let us move the plan to
957  // completed_plan_stack anyway
958  PopPlan();
959  } else
960  DiscardPlan();
961  }
962  }
963  }
964 
965  if (log) {
966  StreamString s;
967  s.IndentMore();
968  GetProcess()->DumpThreadPlansForTID(
969  s, GetID(), eDescriptionLevelVerbose, true /* internal */,
970  false /* condense_trivial */, true /* skip_unreported */);
971  LLDB_LOGF(log, "Plan stack final state:\n%s", s.GetData());
972  LLDB_LOGF(log, "vvvvvvvv Thread::ShouldStop End (returning %i) vvvvvvvv",
973  should_stop);
974  }
975  return should_stop;
976 }
977 
979  StateType thread_state = GetResumeState();
980  StateType temp_thread_state = GetTemporaryResumeState();
981 
982  Log *log = GetLog(LLDBLog::Step);
983 
984  if (thread_state == eStateSuspended || thread_state == eStateInvalid) {
985  LLDB_LOGF(log,
986  "Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
987  ": returning vote %i (state was suspended or invalid)",
988  GetID(), eVoteNoOpinion);
989  return eVoteNoOpinion;
990  }
991 
992  if (temp_thread_state == eStateSuspended ||
993  temp_thread_state == eStateInvalid) {
994  LLDB_LOGF(log,
995  "Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
996  ": returning vote %i (temporary state was suspended or invalid)",
997  GetID(), eVoteNoOpinion);
998  return eVoteNoOpinion;
999  }
1000 
1001  if (!ThreadStoppedForAReason()) {
1002  LLDB_LOGF(log,
1003  "Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
1004  ": returning vote %i (thread didn't stop for a reason.)",
1005  GetID(), eVoteNoOpinion);
1006  return eVoteNoOpinion;
1007  }
1008 
1009  if (GetPlans().AnyCompletedPlans()) {
1010  // Pass skip_private = false to GetCompletedPlan, since we want to ask
1011  // the last plan, regardless of whether it is private or not.
1012  LLDB_LOGF(log,
1013  "Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
1014  ": returning vote for complete stack's back plan",
1015  GetID());
1016  return GetPlans().GetCompletedPlan(false)->ShouldReportStop(event_ptr);
1017  } else {
1018  Vote thread_vote = eVoteNoOpinion;
1019  ThreadPlan *plan_ptr = GetCurrentPlan();
1020  while (true) {
1021  if (plan_ptr->PlanExplainsStop(event_ptr)) {
1022  thread_vote = plan_ptr->ShouldReportStop(event_ptr);
1023  break;
1024  }
1025  if (plan_ptr->IsBasePlan())
1026  break;
1027  else
1028  plan_ptr = GetPreviousPlan(plan_ptr);
1029  }
1030  LLDB_LOGF(log,
1031  "Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
1032  ": returning vote %i for current plan",
1033  GetID(), thread_vote);
1034 
1035  return thread_vote;
1036  }
1037 }
1038 
1040  StateType thread_state = GetResumeState();
1041 
1042  if (thread_state == eStateSuspended || thread_state == eStateInvalid) {
1043  return eVoteNoOpinion;
1044  }
1045 
1046  Log *log = GetLog(LLDBLog::Step);
1047  if (GetPlans().AnyCompletedPlans()) {
1048  // Pass skip_private = false to GetCompletedPlan, since we want to ask
1049  // the last plan, regardless of whether it is private or not.
1050  LLDB_LOGF(log,
1051  "Current Plan for thread %d(%p) (0x%4.4" PRIx64
1052  ", %s): %s being asked whether we should report run.",
1053  GetIndexID(), static_cast<void *>(this), GetID(),
1055  GetCompletedPlan()->GetName());
1056 
1057  return GetPlans().GetCompletedPlan(false)->ShouldReportRun(event_ptr);
1058  } else {
1059  LLDB_LOGF(log,
1060  "Current Plan for thread %d(%p) (0x%4.4" PRIx64
1061  ", %s): %s being asked whether we should report run.",
1062  GetIndexID(), static_cast<void *>(this), GetID(),
1064  GetCurrentPlan()->GetName());
1065 
1066  return GetCurrentPlan()->ShouldReportRun(event_ptr);
1067  }
1068 }
1069 
1070 bool Thread::MatchesSpec(const ThreadSpec *spec) {
1071  return (spec == nullptr) ? true : spec->ThreadPassesBasicTests(*this);
1072 }
1073 
1075  ThreadPlanStack *plans = GetProcess()->FindThreadPlans(GetID());
1076  if (plans)
1077  return *plans;
1078 
1079  // History threads don't have a thread plan, but they do ask get asked to
1080  // describe themselves, which usually involves pulling out the stop reason.
1081  // That in turn will check for a completed plan on the ThreadPlanStack.
1082  // Instead of special-casing at that point, we return a Stack with a
1083  // ThreadPlanNull as its base plan. That will give the right answers to the
1084  // queries GetDescription makes, and only assert if you try to run the thread.
1085  if (!m_null_plan_stack_up)
1086  m_null_plan_stack_up = std::make_unique<ThreadPlanStack>(*this, true);
1087  return *(m_null_plan_stack_up.get());
1088 }
1089 
1090 void Thread::PushPlan(ThreadPlanSP thread_plan_sp) {
1091  assert(thread_plan_sp && "Don't push an empty thread plan.");
1092 
1093  Log *log = GetLog(LLDBLog::Step);
1094  if (log) {
1095  StreamString s;
1096  thread_plan_sp->GetDescription(&s, lldb::eDescriptionLevelFull);
1097  LLDB_LOGF(log, "Thread::PushPlan(0x%p): \"%s\", tid = 0x%4.4" PRIx64 ".",
1098  static_cast<void *>(this), s.GetData(),
1099  thread_plan_sp->GetThread().GetID());
1100  }
1101 
1102  GetPlans().PushPlan(std::move(thread_plan_sp));
1103 }
1104 
1106  Log *log = GetLog(LLDBLog::Step);
1107  ThreadPlanSP popped_plan_sp = GetPlans().PopPlan();
1108  if (log) {
1109  LLDB_LOGF(log, "Popping plan: \"%s\", tid = 0x%4.4" PRIx64 ".",
1110  popped_plan_sp->GetName(), popped_plan_sp->GetThread().GetID());
1111  }
1112 }
1113 
1115  Log *log = GetLog(LLDBLog::Step);
1116  ThreadPlanSP discarded_plan_sp = GetPlans().DiscardPlan();
1117 
1118  LLDB_LOGF(log, "Discarding plan: \"%s\", tid = 0x%4.4" PRIx64 ".",
1119  discarded_plan_sp->GetName(),
1120  discarded_plan_sp->GetThread().GetID());
1121 }
1122 
1124  const ThreadPlanStack &plans = GetPlans();
1125  if (!plans.AnyPlans())
1126  return;
1127 
1128  // Iterate from the second plan (index: 1) to skip the base plan.
1129  ThreadPlanSP p;
1130  uint32_t i = 1;
1131  while ((p = plans.GetPlanByIndex(i, false))) {
1132  StreamString strm;
1133  p->GetDescription(&strm, eDescriptionLevelInitial);
1134  request.TryCompleteCurrentArg(std::to_string(i), strm.GetString());
1135  i++;
1136  }
1137 }
1138 
1140  return GetPlans().GetCurrentPlan().get();
1141 }
1142 
1143 ThreadPlanSP Thread::GetCompletedPlan() const {
1144  return GetPlans().GetCompletedPlan();
1145 }
1146 
1147 ValueObjectSP Thread::GetReturnValueObject() const {
1148  return GetPlans().GetReturnValueObject();
1149 }
1150 
1151 ExpressionVariableSP Thread::GetExpressionVariable() const {
1152  return GetPlans().GetExpressionVariable();
1153 }
1154 
1156  return GetPlans().IsPlanDone(plan);
1157 }
1158 
1160  return GetPlans().WasPlanDiscarded(plan);
1161 }
1162 
1164  return GetPlans().AnyCompletedPlans();
1165 }
1166 
1168  return GetPlans().GetPreviousPlan(current_plan);
1169 }
1170 
1171 Status Thread::QueueThreadPlan(ThreadPlanSP &thread_plan_sp,
1172  bool abort_other_plans) {
1173  Status status;
1174  StreamString s;
1175  if (!thread_plan_sp->ValidatePlan(&s)) {
1176  DiscardThreadPlansUpToPlan(thread_plan_sp);
1177  thread_plan_sp.reset();
1178  status.SetErrorString(s.GetString());
1179  return status;
1180  }
1181 
1182  if (abort_other_plans)
1183  DiscardThreadPlans(true);
1184 
1185  PushPlan(thread_plan_sp);
1186 
1187  // This seems a little funny, but I don't want to have to split up the
1188  // constructor and the DidPush in the scripted plan, that seems annoying.
1189  // That means the constructor has to be in DidPush. So I have to validate the
1190  // plan AFTER pushing it, and then take it off again...
1191  if (!thread_plan_sp->ValidatePlan(&s)) {
1192  DiscardThreadPlansUpToPlan(thread_plan_sp);
1193  thread_plan_sp.reset();
1194  status.SetErrorString(s.GetString());
1195  return status;
1196  }
1197 
1198  return status;
1199 }
1200 
1202  // Count the user thread plans from the back end to get the number of the one
1203  // we want to discard:
1204 
1205  ThreadPlan *up_to_plan_ptr = GetPlans().GetPlanByIndex(plan_index).get();
1206  if (up_to_plan_ptr == nullptr)
1207  return false;
1208 
1209  DiscardThreadPlansUpToPlan(up_to_plan_ptr);
1210  return true;
1211 }
1212 
1213 void Thread::DiscardThreadPlansUpToPlan(lldb::ThreadPlanSP &up_to_plan_sp) {
1214  DiscardThreadPlansUpToPlan(up_to_plan_sp.get());
1215 }
1216 
1218  Log *log = GetLog(LLDBLog::Step);
1219  LLDB_LOGF(log,
1220  "Discarding thread plans for thread tid = 0x%4.4" PRIx64
1221  ", up to %p",
1222  GetID(), static_cast<void *>(up_to_plan_ptr));
1223  GetPlans().DiscardPlansUpToPlan(up_to_plan_ptr);
1224 }
1225 
1226 void Thread::DiscardThreadPlans(bool force) {
1227  Log *log = GetLog(LLDBLog::Step);
1228  if (log) {
1229  LLDB_LOGF(log,
1230  "Discarding thread plans for thread (tid = 0x%4.4" PRIx64
1231  ", force %d)",
1232  GetID(), force);
1233  }
1234 
1235  if (force) {
1237  return;
1238  }
1240 }
1241 
1243  Status error;
1244  ThreadPlan *innermost_expr_plan = GetPlans().GetInnermostExpression();
1245  if (!innermost_expr_plan) {
1246  error.SetErrorString("No expressions currently active on this thread");
1247  return error;
1248  }
1249  DiscardThreadPlansUpToPlan(innermost_expr_plan);
1250  return error;
1251 }
1252 
1253 ThreadPlanSP Thread::QueueBasePlan(bool abort_other_plans) {
1254  ThreadPlanSP thread_plan_sp(new ThreadPlanBase(*this));
1255  QueueThreadPlan(thread_plan_sp, abort_other_plans);
1256  return thread_plan_sp;
1257 }
1258 
1260  bool step_over, bool abort_other_plans, bool stop_other_threads,
1261  Status &status) {
1262  ThreadPlanSP thread_plan_sp(new ThreadPlanStepInstruction(
1263  *this, step_over, stop_other_threads, eVoteNoOpinion, eVoteNoOpinion));
1264  status = QueueThreadPlan(thread_plan_sp, abort_other_plans);
1265  return thread_plan_sp;
1266 }
1267 
1269  bool abort_other_plans, const AddressRange &range,
1270  const SymbolContext &addr_context, lldb::RunMode stop_other_threads,
1271  Status &status, LazyBool step_out_avoids_code_withoug_debug_info) {
1272  ThreadPlanSP thread_plan_sp;
1273  thread_plan_sp = std::make_shared<ThreadPlanStepOverRange>(
1274  *this, range, addr_context, stop_other_threads,
1275  step_out_avoids_code_withoug_debug_info);
1276 
1277  status = QueueThreadPlan(thread_plan_sp, abort_other_plans);
1278  return thread_plan_sp;
1279 }
1280 
1281 // Call the QueueThreadPlanForStepOverRange method which takes an address
1282 // range.
1284  bool abort_other_plans, const LineEntry &line_entry,
1285  const SymbolContext &addr_context, lldb::RunMode stop_other_threads,
1286  Status &status, LazyBool step_out_avoids_code_withoug_debug_info) {
1287  const bool include_inlined_functions = true;
1288  auto address_range =
1289  line_entry.GetSameLineContiguousAddressRange(include_inlined_functions);
1291  abort_other_plans, address_range, addr_context, stop_other_threads,
1292  status, step_out_avoids_code_withoug_debug_info);
1293 }
1294 
1296  bool abort_other_plans, const AddressRange &range,
1297  const SymbolContext &addr_context, const char *step_in_target,
1298  lldb::RunMode stop_other_threads, Status &status,
1299  LazyBool step_in_avoids_code_without_debug_info,
1300  LazyBool step_out_avoids_code_without_debug_info) {
1301  ThreadPlanSP thread_plan_sp(new ThreadPlanStepInRange(
1302  *this, range, addr_context, step_in_target, stop_other_threads,
1303  step_in_avoids_code_without_debug_info,
1304  step_out_avoids_code_without_debug_info));
1305  status = QueueThreadPlan(thread_plan_sp, abort_other_plans);
1306  return thread_plan_sp;
1307 }
1308 
1309 // Call the QueueThreadPlanForStepInRange method which takes an address range.
1311  bool abort_other_plans, const LineEntry &line_entry,
1312  const SymbolContext &addr_context, const char *step_in_target,
1313  lldb::RunMode stop_other_threads, Status &status,
1314  LazyBool step_in_avoids_code_without_debug_info,
1315  LazyBool step_out_avoids_code_without_debug_info) {
1316  const bool include_inlined_functions = false;
1318  abort_other_plans,
1319  line_entry.GetSameLineContiguousAddressRange(include_inlined_functions),
1320  addr_context, step_in_target, stop_other_threads, status,
1321  step_in_avoids_code_without_debug_info,
1322  step_out_avoids_code_without_debug_info);
1323 }
1324 
1326  bool abort_other_plans, SymbolContext *addr_context, bool first_insn,
1327  bool stop_other_threads, Vote report_stop_vote, Vote report_run_vote,
1328  uint32_t frame_idx, Status &status,
1329  LazyBool step_out_avoids_code_without_debug_info) {
1330  ThreadPlanSP thread_plan_sp(new ThreadPlanStepOut(
1331  *this, addr_context, first_insn, stop_other_threads, report_stop_vote,
1332  report_run_vote, frame_idx, step_out_avoids_code_without_debug_info));
1333 
1334  status = QueueThreadPlan(thread_plan_sp, abort_other_plans);
1335  return thread_plan_sp;
1336 }
1337 
1339  bool abort_other_plans, SymbolContext *addr_context, bool first_insn,
1340  bool stop_other_threads, Vote report_stop_vote, Vote report_run_vote,
1341  uint32_t frame_idx, Status &status, bool continue_to_next_branch) {
1342  const bool calculate_return_value =
1343  false; // No need to calculate the return value here.
1344  ThreadPlanSP thread_plan_sp(new ThreadPlanStepOut(
1345  *this, addr_context, first_insn, stop_other_threads, report_stop_vote,
1346  report_run_vote, frame_idx, eLazyBoolNo, continue_to_next_branch,
1347  calculate_return_value));
1348 
1349  ThreadPlanStepOut *new_plan =
1350  static_cast<ThreadPlanStepOut *>(thread_plan_sp.get());
1351  new_plan->ClearShouldStopHereCallbacks();
1352 
1353  status = QueueThreadPlan(thread_plan_sp, abort_other_plans);
1354  return thread_plan_sp;
1355 }
1356 
1357 ThreadPlanSP Thread::QueueThreadPlanForStepThrough(StackID &return_stack_id,
1358  bool abort_other_plans,
1359  bool stop_other_threads,
1360  Status &status) {
1361  ThreadPlanSP thread_plan_sp(
1362  new ThreadPlanStepThrough(*this, return_stack_id, stop_other_threads));
1363  if (!thread_plan_sp || !thread_plan_sp->ValidatePlan(nullptr))
1364  return ThreadPlanSP();
1365 
1366  status = QueueThreadPlan(thread_plan_sp, abort_other_plans);
1367  return thread_plan_sp;
1368 }
1369 
1370 ThreadPlanSP Thread::QueueThreadPlanForRunToAddress(bool abort_other_plans,
1371  Address &target_addr,
1372  bool stop_other_threads,
1373  Status &status) {
1374  ThreadPlanSP thread_plan_sp(
1375  new ThreadPlanRunToAddress(*this, target_addr, stop_other_threads));
1376 
1377  status = QueueThreadPlan(thread_plan_sp, abort_other_plans);
1378  return thread_plan_sp;
1379 }
1380 
1382  bool abort_other_plans, lldb::addr_t *address_list, size_t num_addresses,
1383  bool stop_other_threads, uint32_t frame_idx, Status &status) {
1384  ThreadPlanSP thread_plan_sp(new ThreadPlanStepUntil(
1385  *this, address_list, num_addresses, stop_other_threads, frame_idx));
1386 
1387  status = QueueThreadPlan(thread_plan_sp, abort_other_plans);
1388  return thread_plan_sp;
1389 }
1390 
1392  bool abort_other_plans, const char *class_name,
1393  StructuredData::ObjectSP extra_args_sp, bool stop_other_threads,
1394  Status &status) {
1395 
1396  ThreadPlanSP thread_plan_sp(new ThreadPlanPython(
1397  *this, class_name, StructuredDataImpl(extra_args_sp)));
1398  thread_plan_sp->SetStopOthers(stop_other_threads);
1399  status = QueueThreadPlan(thread_plan_sp, abort_other_plans);
1400  return thread_plan_sp;
1401 }
1402 
1404 
1406  TargetSP target_sp;
1407  ProcessSP process_sp(GetProcess());
1408  if (process_sp)
1409  target_sp = process_sp->CalculateTarget();
1410  return target_sp;
1411 }
1412 
1413 ProcessSP Thread::CalculateProcess() { return GetProcess(); }
1414 
1415 ThreadSP Thread::CalculateThread() { return shared_from_this(); }
1416 
1417 StackFrameSP Thread::CalculateStackFrame() { return StackFrameSP(); }
1418 
1420  exe_ctx.SetContext(shared_from_this());
1421 }
1422 
1423 StackFrameListSP Thread::GetStackFrameList() {
1424  std::lock_guard<std::recursive_mutex> guard(m_frame_mutex);
1425 
1426  if (!m_curr_frames_sp)
1428  std::make_shared<StackFrameList>(*this, m_prev_frames_sp, true);
1429 
1430  return m_curr_frames_sp;
1431 }
1432 
1434  std::lock_guard<std::recursive_mutex> guard(m_frame_mutex);
1435 
1436  GetUnwinder().Clear();
1437 
1438  // Only store away the old "reference" StackFrameList if we got all its
1439  // frames:
1440  // FIXME: At some point we can try to splice in the frames we have fetched
1441  // into
1442  // the new frame as we make it, but let's not try that now.
1443  if (m_curr_frames_sp && m_curr_frames_sp->GetAllFramesFetched())
1445  m_curr_frames_sp.reset();
1446 
1447  m_extended_info.reset();
1448  m_extended_info_fetched = false;
1449 }
1450 
1451 lldb::StackFrameSP Thread::GetFrameWithConcreteFrameIndex(uint32_t unwind_idx) {
1452  return GetStackFrameList()->GetFrameWithConcreteFrameIndex(unwind_idx);
1453 }
1454 
1456  lldb::ValueObjectSP return_value_sp,
1457  bool broadcast) {
1458  StackFrameSP frame_sp = GetStackFrameAtIndex(frame_idx);
1459  Status return_error;
1460 
1461  if (!frame_sp) {
1462  return_error.SetErrorStringWithFormat(
1463  "Could not find frame with index %d in thread 0x%" PRIx64 ".",
1464  frame_idx, GetID());
1465  }
1466 
1467  return ReturnFromFrame(frame_sp, return_value_sp, broadcast);
1468 }
1469 
1470 Status Thread::ReturnFromFrame(lldb::StackFrameSP frame_sp,
1471  lldb::ValueObjectSP return_value_sp,
1472  bool broadcast) {
1473  Status return_error;
1474 
1475  if (!frame_sp) {
1476  return_error.SetErrorString("Can't return to a null frame.");
1477  return return_error;
1478  }
1479 
1480  Thread *thread = frame_sp->GetThread().get();
1481  uint32_t older_frame_idx = frame_sp->GetFrameIndex() + 1;
1482  StackFrameSP older_frame_sp = thread->GetStackFrameAtIndex(older_frame_idx);
1483  if (!older_frame_sp) {
1484  return_error.SetErrorString("No older frame to return to.");
1485  return return_error;
1486  }
1487 
1488  if (return_value_sp) {
1489  lldb::ABISP abi = thread->GetProcess()->GetABI();
1490  if (!abi) {
1491  return_error.SetErrorString("Could not find ABI to set return value.");
1492  return return_error;
1493  }
1494  SymbolContext sc = frame_sp->GetSymbolContext(eSymbolContextFunction);
1495 
1496  // FIXME: ValueObject::Cast doesn't currently work correctly, at least not
1497  // for scalars.
1498  // Turn that back on when that works.
1499  if (/* DISABLES CODE */ (false) && sc.function != nullptr) {
1500  Type *function_type = sc.function->GetType();
1501  if (function_type) {
1502  CompilerType return_type =
1504  if (return_type) {
1505  StreamString s;
1506  return_type.DumpTypeDescription(&s);
1507  ValueObjectSP cast_value_sp = return_value_sp->Cast(return_type);
1508  if (cast_value_sp) {
1509  cast_value_sp->SetFormat(eFormatHex);
1510  return_value_sp = cast_value_sp;
1511  }
1512  }
1513  }
1514  }
1515 
1516  return_error = abi->SetReturnValueObject(older_frame_sp, return_value_sp);
1517  if (!return_error.Success())
1518  return return_error;
1519  }
1520 
1521  // Now write the return registers for the chosen frame: Note, we can't use
1522  // ReadAllRegisterValues->WriteAllRegisterValues, since the read & write cook
1523  // their data
1524 
1525  StackFrameSP youngest_frame_sp = thread->GetStackFrameAtIndex(0);
1526  if (youngest_frame_sp) {
1527  lldb::RegisterContextSP reg_ctx_sp(youngest_frame_sp->GetRegisterContext());
1528  if (reg_ctx_sp) {
1529  bool copy_success = reg_ctx_sp->CopyFromRegisterContext(
1530  older_frame_sp->GetRegisterContext());
1531  if (copy_success) {
1532  thread->DiscardThreadPlans(true);
1533  thread->ClearStackFrames();
1536  new ThreadEventData(this->shared_from_this()));
1537  } else {
1538  return_error.SetErrorString("Could not reset register values.");
1539  }
1540  } else {
1541  return_error.SetErrorString("Frame has no register context.");
1542  }
1543  } else {
1544  return_error.SetErrorString("Returned past top frame.");
1545  }
1546  return return_error;
1547 }
1548 
1549 static void DumpAddressList(Stream &s, const std::vector<Address> &list,
1550  ExecutionContextScope *exe_scope) {
1551  for (size_t n = 0; n < list.size(); n++) {
1552  s << "\t";
1553  list[n].Dump(&s, exe_scope, Address::DumpStyleResolvedDescription,
1555  s << "\n";
1556  }
1557 }
1558 
1560  bool can_leave_function, std::string *warnings) {
1562  Target *target = exe_ctx.GetTargetPtr();
1563  TargetSP target_sp = exe_ctx.GetTargetSP();
1564  RegisterContext *reg_ctx = exe_ctx.GetRegisterContext();
1565  StackFrame *frame = exe_ctx.GetFramePtr();
1566  const SymbolContext &sc = frame->GetSymbolContext(eSymbolContextFunction);
1567 
1568  // Find candidate locations.
1569  std::vector<Address> candidates, within_function, outside_function;
1570  target->GetImages().FindAddressesForLine(target_sp, file, line, sc.function,
1571  within_function, outside_function);
1572 
1573  // If possible, we try and stay within the current function. Within a
1574  // function, we accept multiple locations (optimized code may do this,
1575  // there's no solution here so we do the best we can). However if we're
1576  // trying to leave the function, we don't know how to pick the right
1577  // location, so if there's more than one then we bail.
1578  if (!within_function.empty())
1579  candidates = within_function;
1580  else if (outside_function.size() == 1 && can_leave_function)
1581  candidates = outside_function;
1582 
1583  // Check if we got anything.
1584  if (candidates.empty()) {
1585  if (outside_function.empty()) {
1586  return Status("Cannot locate an address for %s:%i.",
1587  file.GetFilename().AsCString(), line);
1588  } else if (outside_function.size() == 1) {
1589  return Status("%s:%i is outside the current function.",
1590  file.GetFilename().AsCString(), line);
1591  } else {
1592  StreamString sstr;
1593  DumpAddressList(sstr, outside_function, target);
1594  return Status("%s:%i has multiple candidate locations:\n%s",
1595  file.GetFilename().AsCString(), line, sstr.GetData());
1596  }
1597  }
1598 
1599  // Accept the first location, warn about any others.
1600  Address dest = candidates[0];
1601  if (warnings && candidates.size() > 1) {
1602  StreamString sstr;
1603  sstr.Printf("%s:%i appears multiple times in this function, selecting the "
1604  "first location:\n",
1605  file.GetFilename().AsCString(), line);
1606  DumpAddressList(sstr, candidates, target);
1607  *warnings = std::string(sstr.GetString());
1608  }
1609 
1610  if (!reg_ctx->SetPC(dest))
1611  return Status("Cannot change PC to target address.");
1612 
1613  return Status();
1614 }
1615 
1617  bool stop_format) {
1618  ExecutionContext exe_ctx(shared_from_this());
1619  Process *process = exe_ctx.GetProcessPtr();
1620  if (process == nullptr)
1621  return;
1622 
1623  StackFrameSP frame_sp;
1624  SymbolContext frame_sc;
1625  if (frame_idx != LLDB_INVALID_FRAME_ID) {
1626  frame_sp = GetStackFrameAtIndex(frame_idx);
1627  if (frame_sp) {
1628  exe_ctx.SetFrameSP(frame_sp);
1629  frame_sc = frame_sp->GetSymbolContext(eSymbolContextEverything);
1630  }
1631  }
1632 
1633  const FormatEntity::Entry *thread_format;
1634  if (stop_format)
1635  thread_format = exe_ctx.GetTargetRef().GetDebugger().GetThreadStopFormat();
1636  else
1637  thread_format = exe_ctx.GetTargetRef().GetDebugger().GetThreadFormat();
1638 
1639  assert(thread_format);
1640 
1641  FormatEntity::Format(*thread_format, strm, frame_sp ? &frame_sc : nullptr,
1642  &exe_ctx, nullptr, nullptr, false, false);
1643 }
1644 
1646 
1648 
1650 
1651 addr_t Thread::GetThreadLocalData(const ModuleSP module,
1652  lldb::addr_t tls_file_addr) {
1653  // The default implementation is to ask the dynamic loader for it. This can
1654  // be overridden for specific platforms.
1655  DynamicLoader *loader = GetProcess()->GetDynamicLoader();
1656  if (loader)
1657  return loader->GetThreadLocalData(module, shared_from_this(),
1658  tls_file_addr);
1659  else
1660  return LLDB_INVALID_ADDRESS;
1661 }
1662 
1664  Process *process = GetProcess().get();
1665  if (process) {
1666  SystemRuntime *runtime = process->GetSystemRuntime();
1667  if (runtime) {
1668  return runtime->SafeToCallFunctionsOnThisThread(shared_from_this());
1669  }
1670  }
1671  return true;
1672 }
1673 
1674 lldb::StackFrameSP
1676  return GetStackFrameList()->GetStackFrameSPForStackFramePtr(stack_frame_ptr);
1677 }
1678 
1680  switch (reason) {
1681  case eStopReasonInvalid:
1682  return "invalid";
1683  case eStopReasonNone:
1684  return "none";
1685  case eStopReasonTrace:
1686  return "trace";
1687  case eStopReasonBreakpoint:
1688  return "breakpoint";
1689  case eStopReasonWatchpoint:
1690  return "watchpoint";
1691  case eStopReasonSignal:
1692  return "signal";
1693  case eStopReasonException:
1694  return "exception";
1695  case eStopReasonExec:
1696  return "exec";
1697  case eStopReasonFork:
1698  return "fork";
1699  case eStopReasonVFork:
1700  return "vfork";
1701  case eStopReasonVForkDone:
1702  return "vfork done";
1704  return "plan complete";
1706  return "thread exiting";
1708  return "instrumentation break";
1710  return "processor trace";
1711  }
1712 
1713  return "StopReason = " + std::to_string(reason);
1714 }
1715 
1717  switch (mode) {
1718  case eOnlyThisThread:
1719  return "only this thread";
1720  case eAllThreads:
1721  return "all threads";
1722  case eOnlyDuringStepping:
1723  return "only during stepping";
1724  }
1725 
1726  return "RunMode = " + std::to_string(mode);
1727 }
1728 
1729 size_t Thread::GetStatus(Stream &strm, uint32_t start_frame,
1730  uint32_t num_frames, uint32_t num_frames_with_source,
1731  bool stop_format, bool only_stacks) {
1732 
1733  if (!only_stacks) {
1734  ExecutionContext exe_ctx(shared_from_this());
1735  Target *target = exe_ctx.GetTargetPtr();
1736  Process *process = exe_ctx.GetProcessPtr();
1737  strm.Indent();
1738  bool is_selected = false;
1739  if (process) {
1740  if (process->GetThreadList().GetSelectedThread().get() == this)
1741  is_selected = true;
1742  }
1743  strm.Printf("%c ", is_selected ? '*' : ' ');
1744  if (target && target->GetDebugger().GetUseExternalEditor()) {
1745  StackFrameSP frame_sp = GetStackFrameAtIndex(start_frame);
1746  if (frame_sp) {
1747  SymbolContext frame_sc(
1748  frame_sp->GetSymbolContext(eSymbolContextLineEntry));
1749  if (frame_sc.line_entry.line != 0 && frame_sc.line_entry.file) {
1751  frame_sc.line_entry.line);
1752  }
1753  }
1754  }
1755 
1756  DumpUsingSettingsFormat(strm, start_frame, stop_format);
1757  }
1758 
1759  size_t num_frames_shown = 0;
1760  if (num_frames > 0) {
1761  strm.IndentMore();
1762 
1763  const bool show_frame_info = true;
1764  const bool show_frame_unique = only_stacks;
1765  const char *selected_frame_marker = nullptr;
1766  if (num_frames == 1 || only_stacks ||
1767  (GetID() != GetProcess()->GetThreadList().GetSelectedThread()->GetID()))
1768  strm.IndentMore();
1769  else
1770  selected_frame_marker = "* ";
1771 
1772  num_frames_shown = GetStackFrameList()->GetStatus(
1773  strm, start_frame, num_frames, show_frame_info, num_frames_with_source,
1774  show_frame_unique, selected_frame_marker);
1775  if (num_frames == 1)
1776  strm.IndentLess();
1777  strm.IndentLess();
1778  }
1779  return num_frames_shown;
1780 }
1781 
1783  bool print_json_thread, bool print_json_stopinfo) {
1784  const bool stop_format = false;
1785  DumpUsingSettingsFormat(strm, 0, stop_format);
1786  strm.Printf("\n");
1787 
1788  StructuredData::ObjectSP thread_info = GetExtendedInfo();
1789 
1790  if (print_json_thread || print_json_stopinfo) {
1791  if (thread_info && print_json_thread) {
1792  thread_info->Dump(strm);
1793  strm.Printf("\n");
1794  }
1795 
1796  if (print_json_stopinfo && m_stop_info_sp) {
1797  StructuredData::ObjectSP stop_info = m_stop_info_sp->GetExtendedInfo();
1798  if (stop_info) {
1799  stop_info->Dump(strm);
1800  strm.Printf("\n");
1801  }
1802  }
1803 
1804  return true;
1805  }
1806 
1807  if (thread_info) {
1808  StructuredData::ObjectSP activity =
1809  thread_info->GetObjectForDotSeparatedPath("activity");
1810  StructuredData::ObjectSP breadcrumb =
1811  thread_info->GetObjectForDotSeparatedPath("breadcrumb");
1812  StructuredData::ObjectSP messages =
1813  thread_info->GetObjectForDotSeparatedPath("trace_messages");
1814 
1815  bool printed_activity = false;
1816  if (activity && activity->GetType() == eStructuredDataTypeDictionary) {
1817  StructuredData::Dictionary *activity_dict = activity->GetAsDictionary();
1818  StructuredData::ObjectSP id = activity_dict->GetValueForKey("id");
1819  StructuredData::ObjectSP name = activity_dict->GetValueForKey("name");
1820  if (name && name->GetType() == eStructuredDataTypeString && id &&
1821  id->GetType() == eStructuredDataTypeInteger) {
1822  strm.Format(" Activity '{0}', {1:x}\n",
1823  name->GetAsString()->GetValue(),
1824  id->GetAsInteger()->GetValue());
1825  }
1826  printed_activity = true;
1827  }
1828  bool printed_breadcrumb = false;
1829  if (breadcrumb && breadcrumb->GetType() == eStructuredDataTypeDictionary) {
1830  if (printed_activity)
1831  strm.Printf("\n");
1832  StructuredData::Dictionary *breadcrumb_dict =
1833  breadcrumb->GetAsDictionary();
1834  StructuredData::ObjectSP breadcrumb_text =
1835  breadcrumb_dict->GetValueForKey("name");
1836  if (breadcrumb_text &&
1837  breadcrumb_text->GetType() == eStructuredDataTypeString) {
1838  strm.Format(" Current Breadcrumb: {0}\n",
1839  breadcrumb_text->GetAsString()->GetValue());
1840  }
1841  printed_breadcrumb = true;
1842  }
1843  if (messages && messages->GetType() == eStructuredDataTypeArray) {
1844  if (printed_breadcrumb)
1845  strm.Printf("\n");
1846  StructuredData::Array *messages_array = messages->GetAsArray();
1847  const size_t msg_count = messages_array->GetSize();
1848  if (msg_count > 0) {
1849  strm.Printf(" %zu trace messages:\n", msg_count);
1850  for (size_t i = 0; i < msg_count; i++) {
1851  StructuredData::ObjectSP message = messages_array->GetItemAtIndex(i);
1852  if (message && message->GetType() == eStructuredDataTypeDictionary) {
1853  StructuredData::Dictionary *message_dict =
1854  message->GetAsDictionary();
1855  StructuredData::ObjectSP message_text =
1856  message_dict->GetValueForKey("message");
1857  if (message_text &&
1858  message_text->GetType() == eStructuredDataTypeString) {
1859  strm.Format(" {0}\n", message_text->GetAsString()->GetValue());
1860  }
1861  }
1862  }
1863  }
1864  }
1865  }
1866 
1867  return true;
1868 }
1869 
1870 size_t Thread::GetStackFrameStatus(Stream &strm, uint32_t first_frame,
1871  uint32_t num_frames, bool show_frame_info,
1872  uint32_t num_frames_with_source) {
1873  return GetStackFrameList()->GetStatus(
1874  strm, first_frame, num_frames, show_frame_info, num_frames_with_source);
1875 }
1876 
1878  if (!m_unwinder_up)
1879  m_unwinder_up = std::make_unique<UnwindLLDB>(*this);
1880  return *m_unwinder_up;
1881 }
1882 
1884  ClearStackFrames();
1885  m_reg_context_sp.reset();
1886 }
1887 
1889  // If we are currently stopped at a breakpoint, always return that stopinfo
1890  // and don't reset it. This allows threads to maintain their breakpoint
1891  // stopinfo, such as when thread-stepping in multithreaded programs.
1892  if (m_stop_info_sp) {
1893  StopReason stop_reason = m_stop_info_sp->GetStopReason();
1894  if (stop_reason == lldb::eStopReasonBreakpoint) {
1895  uint64_t value = m_stop_info_sp->GetValue();
1896  lldb::RegisterContextSP reg_ctx_sp(GetRegisterContext());
1897  if (reg_ctx_sp) {
1898  lldb::addr_t pc = reg_ctx_sp->GetPC();
1899  BreakpointSiteSP bp_site_sp =
1900  GetProcess()->GetBreakpointSiteList().FindByAddress(pc);
1901  if (bp_site_sp && static_cast<break_id_t>(value) == bp_site_sp->GetID())
1902  return true;
1903  }
1904  }
1905  }
1906  return false;
1907 }
1908 
1909 Status Thread::StepIn(bool source_step,
1910  LazyBool step_in_avoids_code_without_debug_info,
1911  LazyBool step_out_avoids_code_without_debug_info)
1912 
1913 {
1914  Status error;
1915  Process *process = GetProcess().get();
1916  if (StateIsStoppedState(process->GetState(), true)) {
1917  StackFrameSP frame_sp = GetStackFrameAtIndex(0);
1918  ThreadPlanSP new_plan_sp;
1919  const lldb::RunMode run_mode = eOnlyThisThread;
1920  const bool abort_other_plans = false;
1921 
1922  if (source_step && frame_sp && frame_sp->HasDebugInformation()) {
1923  SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
1924  new_plan_sp = QueueThreadPlanForStepInRange(
1925  abort_other_plans, sc.line_entry, sc, nullptr, run_mode, error,
1926  step_in_avoids_code_without_debug_info,
1927  step_out_avoids_code_without_debug_info);
1928  } else {
1930  false, abort_other_plans, run_mode, error);
1931  }
1932 
1933  new_plan_sp->SetIsControllingPlan(true);
1934  new_plan_sp->SetOkayToDiscard(false);
1935 
1936  // Why do we need to set the current thread by ID here???
1938  error = process->Resume();
1939  } else {
1940  error.SetErrorString("process not stopped");
1941  }
1942  return error;
1943 }
1944 
1945 Status Thread::StepOver(bool source_step,
1946  LazyBool step_out_avoids_code_without_debug_info) {
1947  Status error;
1948  Process *process = GetProcess().get();
1949  if (StateIsStoppedState(process->GetState(), true)) {
1950  StackFrameSP frame_sp = GetStackFrameAtIndex(0);
1951  ThreadPlanSP new_plan_sp;
1952 
1953  const lldb::RunMode run_mode = eOnlyThisThread;
1954  const bool abort_other_plans = false;
1955 
1956  if (source_step && frame_sp && frame_sp->HasDebugInformation()) {
1957  SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
1958  new_plan_sp = QueueThreadPlanForStepOverRange(
1959  abort_other_plans, sc.line_entry, sc, run_mode, error,
1960  step_out_avoids_code_without_debug_info);
1961  } else {
1963  true, abort_other_plans, run_mode, error);
1964  }
1965 
1966  new_plan_sp->SetIsControllingPlan(true);
1967  new_plan_sp->SetOkayToDiscard(false);
1968 
1969  // Why do we need to set the current thread by ID here???
1971  error = process->Resume();
1972  } else {
1973  error.SetErrorString("process not stopped");
1974  }
1975  return error;
1976 }
1977 
1979  Status error;
1980  Process *process = GetProcess().get();
1981  if (StateIsStoppedState(process->GetState(), true)) {
1982  const bool first_instruction = false;
1983  const bool stop_other_threads = false;
1984  const bool abort_other_plans = false;
1985 
1986  ThreadPlanSP new_plan_sp(QueueThreadPlanForStepOut(
1987  abort_other_plans, nullptr, first_instruction, stop_other_threads,
1988  eVoteYes, eVoteNoOpinion, frame_idx, error));
1989 
1990  new_plan_sp->SetIsControllingPlan(true);
1991  new_plan_sp->SetOkayToDiscard(false);
1992 
1993  // Why do we need to set the current thread by ID here???
1995  error = process->Resume();
1996  } else {
1997  error.SetErrorString("process not stopped");
1998  }
1999  return error;
2000 }
2001 
2003  if (auto frame_sp = GetStackFrameAtIndex(0))
2004  if (auto recognized_frame = frame_sp->GetRecognizedFrame())
2005  if (auto e = recognized_frame->GetExceptionObject())
2006  return e;
2007 
2008  // NOTE: Even though this behavior is generalized, only ObjC is actually
2009  // supported at the moment.
2010  for (LanguageRuntime *runtime : GetProcess()->GetLanguageRuntimes()) {
2011  if (auto e = runtime->GetExceptionObjectForThread(shared_from_this()))
2012  return e;
2013  }
2014 
2015  return ValueObjectSP();
2016 }
2017 
2019  ValueObjectSP exception = GetCurrentException();
2020  if (!exception)
2021  return ThreadSP();
2022 
2023  // NOTE: Even though this behavior is generalized, only ObjC is actually
2024  // supported at the moment.
2025  for (LanguageRuntime *runtime : GetProcess()->GetLanguageRuntimes()) {
2026  if (auto bt = runtime->GetBacktraceThreadFromException(exception))
2027  return bt;
2028  }
2029 
2030  return ThreadSP();
2031 }
2032 
2033 lldb::ValueObjectSP Thread::GetSiginfoValue() {
2034  ProcessSP process_sp = GetProcess();
2035  assert(process_sp);
2036  Target &target = process_sp->GetTarget();
2037  PlatformSP platform_sp = target.GetPlatform();
2038  assert(platform_sp);
2039  ArchSpec arch = target.GetArchitecture();
2040 
2041  CompilerType type = platform_sp->GetSiginfoType(arch.GetTriple());
2042  if (!type.IsValid())
2043  return ValueObjectConstResult::Create(&target, Status("no siginfo_t for the platform"));
2044 
2045  llvm::Optional<uint64_t> type_size = type.GetByteSize(nullptr);
2046  assert(type_size);
2047  llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>> data =
2048  GetSiginfo(type_size.value());
2049  if (!data)
2050  return ValueObjectConstResult::Create(&target, Status(data.takeError()));
2051 
2052  DataExtractor data_extractor{data.get()->getBufferStart(), data.get()->getBufferSize(),
2053  process_sp->GetByteOrder(), arch.GetAddressByteSize()};
2054  return ValueObjectConstResult::Create(&target, type, ConstString("__lldb_siginfo"), data_extractor);
2055 }
lldb_private::Thread::m_temporary_resume_state
lldb::StateType m_temporary_resume_state
This state records what the thread was told to do by the thread plan logic for the current resume.
Definition: Thread.h:1287
lldb_private::ThreadProperties
Definition: Thread.h:35
RegularExpression.h
lldb_private::Thread::GetStackFrameSPForStackFramePtr
lldb::StackFrameSP GetStackFrameSPForStackFramePtr(StackFrame *stack_frame_ptr)
Definition: Thread.cpp:1675
lldb_private::Stream::IndentLess
void IndentLess(unsigned amount=2)
Decrement the current indentation level.
Definition: Stream.cpp:171
lldb_private::Stream::Format
void Format(const char *format, Args &&... args)
Definition: Stream.h:309
list
MATCHES FreeBSD list(APPEND FBSDKERNEL_LIBS kvm) endif() if(NOT FBSDKERNEL_LIBS) message(STATUS "Skipping FreeBSDKernel plugin due to missing libfbsdvmcore") return() endif() add_lldb_library(lldbPluginProcessFreeBSDKernel PLUGIN ProcessFreeBSDKernel.cpp RegisterContextFreeBSDKernel_arm64.cpp RegisterContextFreeBSDKernel_i386.cpp RegisterContextFreeBSDKernel_x86_64.cpp ThreadFreeBSDKernel.cpp LINK_LIBS lldbCore lldbTarget $
Definition: Plugins/Process/FreeBSDKernel/CMakeLists.txt:6
lldb_private::Broadcaster::CheckInWithManager
void CheckInWithManager()
Definition: Broadcaster.cpp:46
lldb_private::Thread::DiscardThreadPlans
void DiscardThreadPlans(bool force)
Discards the plans queued on the plan stack of the current thread.
Definition: Thread.cpp:1226
lldb_private::Thread::m_state_mutex
std::recursive_mutex m_state_mutex
Multithreaded protection for m_state.
Definition: Thread.h:1275
lldb_private::Address::DumpStyleSectionNameOffset
@ DumpStyleSectionNameOffset
Display as the section name + offset.
Definition: Address.h:71
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
lldb_private::Thread::DidResume
virtual void DidResume()
Definition: Thread.cpp:736
ThreadPlanStepUntil.h
lldb_private::Thread::GetPrivateStopInfo
virtual lldb::StopInfoSP GetPrivateStopInfo(bool calculate=true)
Definition: Thread.cpp:373
lldb_private::LineEntry::file
FileSpec file
The source file, possibly mapped by the target.source-map setting.
Definition: LineEntry.h:140
lldb_private::Properties::GetValueProperties
virtual lldb::OptionValuePropertiesSP GetValueProperties() const
Definition: UserSettingsController.h:42
lldb_private::StructuredData::Dictionary
Definition: StructuredData.h:352
lldb_private::Thread::GetCurrentInlinedDepth
uint32_t GetCurrentInlinedDepth()
Definition: Thread.h:410
lldb_private::Thread::GetStackFrameStatus
size_t GetStackFrameStatus(Stream &strm, uint32_t first_frame, uint32_t num_frames, bool show_frame_info, uint32_t num_frames_with_source)
Definition: Thread.cpp:1870
lldb_private::ThreadPlanStack::AnyPlans
bool AnyPlans() const
Definition: ThreadPlanStack.cpp:314
lldb_private::Thread::StopInfoIsUpToDate
bool StopInfoIsUpToDate() const
Definition: Thread.cpp:430
lldb_private::Architecture
Definition: Architecture.h:17
lldb_private::ArchSpec
Definition: ArchSpec.h:32
lldb_private::EventData::GetFlavor
virtual ConstString GetFlavor() const =0
ThreadPlanStepOverRange.h
lldb_private::RegularExpression
Definition: RegularExpression.h:18
lldb_private::ThreadPlan::ShouldRunBeforePublicStop
virtual bool ShouldRunBeforePublicStop()
Definition: ThreadPlan.h:388
lldb_private::Thread::AutoCompleteThreadPlans
void AutoCompleteThreadPlans(CompletionRequest &request) const
Format the thread plan information for auto completion.
Definition: Thread.cpp:1123
lldb_private::Thread::ThreadStateCheckpoint::stop_info_sp
lldb::StopInfoSP stop_info_sp
Definition: Thread.h:123
lldb_private::ThreadProperties::GetTraceEnabledState
bool GetTraceEnabledState() const
Definition: Thread.cpp:126
lldb_private::Thread::ThreadStateCheckpoint::orig_stop_id
uint32_t orig_stop_id
Definition: Thread.h:121
lldb_private::Thread::GetIndexID
uint32_t GetIndexID() const
Definition: Thread.cpp:1403
lldb_private::Event
Definition: Event.h:182
lldb_private::ThreadPlan::IsPlanComplete
bool IsPlanComplete()
Definition: ThreadPlan.cpp:61
lldb_private::Thread::GetDescription
bool GetDescription(Stream &s, lldb::DescriptionLevel level, bool print_json_thread, bool print_json_stopinfo)
Definition: Thread.cpp:1782
lldb_private::ThreadPlanStack::GetCompletedPlan
lldb::ThreadPlanSP GetCompletedPlan(bool skip_private=true) const
Definition: ThreadPlanStack.cpp:255
lldb_private::Thread::SetupForResume
void SetupForResume()
Definition: Thread.cpp:629
lldb_private::StructuredData::Array
Definition: StructuredData.h:165
lldb_private::StructuredData::Dictionary::GetValueForKey
ObjectSP GetValueForKey(llvm::StringRef key) const
Definition: StructuredData.h:389
lldb_private::Thread::Flush
void Flush()
Definition: Thread.cpp:1883
UnwindLLDB.h
lldb_private::Thread::m_resume_signal
int m_resume_signal
The signal that should be used when continuing this thread.
Definition: Thread.h:1282
lldb::eStopReasonVFork
@ eStopReasonVFork
Definition: lldb-enumerations.h:253
lldb_private::ExecutionContext::GetProcessPtr
Process * GetProcessPtr() const
Returns a pointer to the process object.
Definition: ExecutionContext.cpp:206
lldb_private::eVoteYes
@ eVoteYes
Definition: lldb-private-enumerations.h:59
lldb_private::Thread::ThreadStateCheckpoint::register_backup_sp
lldb::RegisterCheckpointSP register_backup_sp
Definition: Thread.h:127
lldb_private::Thread::GetUnwinder
virtual Unwind & GetUnwinder()
Definition: Thread.cpp:1877
Host.h
lldb_private::Thread::GetSiginfo
virtual llvm::Expected< std::unique_ptr< llvm::MemoryBuffer > > GetSiginfo(size_t max_size) const
Definition: Thread.h:1252
lldb::eStructuredDataTypeString
@ eStructuredDataTypeString
Definition: lldb-enumerations.h:800
lldb_private::ThreadPlanStack::GetCurrentPlan
lldb::ThreadPlanSP GetCurrentPlan() const
Definition: ThreadPlanStack.cpp:249
lldb::eStructuredDataTypeDictionary
@ eStructuredDataTypeDictionary
Definition: lldb-enumerations.h:801
ThreadPlanStepOut.h
lldb_private::CompletionRequest::TryCompleteCurrentArg
void TryCompleteCurrentArg(llvm::StringRef completion, llvm::StringRef description="")
Adds a possible completion string if the completion would complete the current argument.
Definition: CompletionRequest.h:180
lldb_private::Thread::ClearStackFrames
virtual void ClearStackFrames()
Definition: Thread.cpp:1433
lldb_private::Thread::QueueThreadPlanForStepOverRange
virtual lldb::ThreadPlanSP QueueThreadPlanForStepOverRange(bool abort_other_plans, const AddressRange &range, const SymbolContext &addr_context, lldb::RunMode stop_other_threads, Status &status, LazyBool step_out_avoids_code_without_debug_info=eLazyBoolCalculate)
Queues the plan used to step through an address range, stepping over function calls.
Definition: Thread.cpp:1268
lldb_private::Thread::ThreadEventData::GetStackIDFromEvent
static StackID GetStackIDFromEvent(const Event *event_ptr)
Definition: Thread.cpp:189
lldb_private::Thread::JumpToLine
Status JumpToLine(const FileSpec &file, uint32_t line, bool can_leave_function, std::string *warnings=nullptr)
Definition: Thread.cpp:1559
lldb_private::ThreadPlan::eKindStepOverBreakpoint
@ eKindStepOverBreakpoint
Definition: ThreadPlan.h:300
lldb_private::ThreadPlanStepThrough
Definition: ThreadPlanStepThrough.h:17
lldb_private::Thread::QueueThreadPlanForStepOutNoShouldStop
virtual lldb::ThreadPlanSP QueueThreadPlanForStepOutNoShouldStop(bool abort_other_plans, SymbolContext *addr_context, bool first_insn, bool stop_other_threads, Vote report_stop_vote, Vote report_run_vote, uint32_t frame_idx, Status &status, bool continue_to_next_branch=false)
Queue the plan used to step out of the function at the current PC of a thread.
Definition: Thread.cpp:1338
lldb_private::UserID
Definition: UserID.h:31
lldb_private::eLazyBoolYes
@ eLazyBoolYes
Definition: lldb-private-enumerations.h:115
lldb::eStopReasonThreadExiting
@ eStopReasonThreadExiting
Definition: lldb-enumerations.h:249
LLDB_LOGF
#define LLDB_LOGF(log,...)
Definition: Log.h:344
lldb_private::Thread::QueueThreadPlanForStepOut
virtual lldb::ThreadPlanSP QueueThreadPlanForStepOut(bool abort_other_plans, SymbolContext *addr_context, bool first_insn, bool stop_other_threads, Vote report_stop_vote, Vote report_run_vote, uint32_t frame_idx, Status &status, LazyBool step_out_avoids_code_without_debug_info=eLazyBoolCalculate)
Queue the plan used to step out of the function at the current PC of thread.
Definition: Thread.cpp:1325
lldb_private::ThreadPlan::GetKind
ThreadPlanKind GetKind() const
Definition: ThreadPlan.h:425
lldb_private::ThreadPlanStepOut
Definition: ThreadPlanStepOut.h:18
lldb_private::ThreadPlanStack::DiscardPlan
lldb::ThreadPlanSP DiscardPlan()
Definition: ThreadPlanStack.cpp:163
lldb_private::Process
Definition: Process.h:338
lldb_private::ThreadPlanStack::RestoreCompletedPlanCheckpoint
void RestoreCompletedPlanCheckpoint(size_t checkpoint)
Definition: ThreadPlanStack.cpp:92
lldb_private::EventData
Definition: Event.h:36
lldb_private::Thread::CalculateTarget
lldb::TargetSP CalculateTarget() override
Definition: Thread.cpp:1405
lldb_private::Thread::ResetStopInfo
void ResetStopInfo()
Definition: Thread.cpp:439
Module.h
lldb_private::Process::GetThreadList
ThreadList & GetThreadList()
Definition: Process.h:2086
BreakpointLocation.h
lldb::eStopReasonInvalid
@ eStopReasonInvalid
Definition: lldb-enumerations.h:240
lldb_private::StopInfo::CreateStopReasonWithSignal
static lldb::StopInfoSP CreateStopReasonWithSignal(Thread &thread, int signo, const char *description=nullptr)
Definition: StopInfo.cpp:1375
lldb_private::Thread::GetStopDescription
std::string GetStopDescription()
Definition: Thread.cpp:558
lldb_private::StateAsCString
const char * StateAsCString(lldb::StateType state)
Converts a StateType to a C string.
Definition: State.cpp:14
lldb_private::Thread::m_destroy_called
bool m_destroy_called
Definition: Thread.h:1293
lldb_private::ThreadPlanStack::IsPlanDone
bool IsPlanDone(ThreadPlan *plan) const
Definition: ThreadPlanStack.cpp:330
lldb_private::Thread::UnwindInnermostExpression
Status UnwindInnermostExpression()
Unwinds the thread stack for the innermost expression plan currently on the thread plan stack.
Definition: Thread.cpp:1242
lldb_private::Thread::DiscardUserThreadPlansUpToIndex
bool DiscardUserThreadPlansUpToIndex(uint32_t thread_index)
Discards the plans queued on the plan stack of the current thread up to and including the plan in tha...
Definition: Thread.cpp:1201
lldb_private::ThreadSpec::ThreadPassesBasicTests
bool ThreadPassesBasicTests(Thread &thread) const
Definition: ThreadSpec.cpp:107
lldb_private::Property
Definition: Property.h:35
lldb::StopReason
StopReason
Thread stop reasons.
Definition: lldb-enumerations.h:239
lldb_private::Thread::GetPreviousPlan
ThreadPlan * GetPreviousPlan(ThreadPlan *plan) const
Definition: Thread.cpp:1167
lldb_private::SystemRuntime
Definition: SystemRuntime.h:43
lldb_private::ExecutionContext::GetFramePtr
StackFrame * GetFramePtr() const
Returns a pointer to the frame object.
Definition: ExecutionContext.h:408
lldb_private::LineEntry::GetSameLineContiguousAddressRange
AddressRange GetSameLineContiguousAddressRange(bool include_inlined_functions) const
Give the range for this LineEntry + any additional LineEntries for this same source line that are con...
Definition: LineEntry.cpp:192
lldb_private::ConstString::AsCString
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
Definition: ConstString.h:192
lldb_private::ThreadPlanStack::GetPlanByIndex
lldb::ThreadPlanSP GetPlanByIndex(uint32_t plan_idx, bool skip_private=true) const
Definition: ThreadPlanStack.cpp:272
lldb_private::FileSpec::GetFilename
const ConstString & GetFilename() const
Filename string const get accessor.
Definition: FileSpec.h:239
lldb::eStopReasonException
@ eStopReasonException
Definition: lldb-enumerations.h:246
lldb_private::Thread::SelectMostRelevantFrame
void SelectMostRelevantFrame()
Definition: Thread.cpp:590
lldb_private::CompilerType::GetByteSize
llvm::Optional< uint64_t > GetByteSize(ExecutionContextScope *exe_scope) const
Return the size of the type in bytes.
Definition: CompilerType.cpp:489
ThreadPlanStack.h
lldb_private::Thread::GetPlans
ThreadPlanStack & GetPlans() const
Definition: Thread.cpp:1074
lldb_private::Thread::ThreadEventData::Dump
void Dump(Stream *s) const override
Definition: Thread.cpp:168
lldb_private::Thread::GetCurrentPlan
ThreadPlan * GetCurrentPlan() const
Gets the plan which will execute next on the plan stack.
Definition: Thread.cpp:1139
lldb_private::eVoteNoOpinion
@ eVoteNoOpinion
Definition: lldb-private-enumerations.h:59
lldb_private::Thread::m_null_plan_stack_up
std::unique_ptr< ThreadPlanStack > m_null_plan_stack_up
Definition: Thread.h:1296
lldb_private::ThreadPlan::ShouldStop
virtual bool ShouldStop(Event *event_ptr)=0
lldb_private::Stream
Definition: Stream.h:28
lldb_private::ArchSpec::GetTriple
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition: ArchSpec.h:454
ThreadPlanPython.h
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
pc
@ pc
Definition: CompactUnwindInfo.cpp:1251
lldb_private::Thread::RestoreThreadStateFromCheckpoint
void RestoreThreadStateFromCheckpoint(ThreadStateCheckpoint &saved_state)
Definition: Thread.cpp:536
lldb_private::Thread::RestoreRegisterStateFromCheckpoint
virtual bool RestoreRegisterStateFromCheckpoint(ThreadStateCheckpoint &saved_state)
Definition: Thread.cpp:514
ThreadPlanStepThrough.h
lldb_private::Thread::ReturnFromFrameWithIndex
Status ReturnFromFrameWithIndex(uint32_t frame_idx, lldb::ValueObjectSP return_value_sp, bool broadcast=false)
Definition: Thread.cpp:1455
lldb_private::Thread::CompletedPlanOverridesBreakpoint
bool CompletedPlanOverridesBreakpoint() const
Check if we have completed plan to override breakpoint stop reason.
Definition: Thread.cpp:1163
lldb_private::LazyBool
LazyBool
Definition: lldb-private-enumerations.h:115
lldb::eStopReasonTrace
@ eStopReasonTrace
Definition: lldb-enumerations.h:242
lldb_private::Debugger::GetUseExternalEditor
bool GetUseExternalEditor() const
Definition: Debugger.cpp:353
lldb_private::Target::GetDebugger
Debugger & GetDebugger()
Definition: Target.h:1030
lldb_private::Thread::GetStopReason
lldb::StopReason GetStopReason()
Definition: Thread.cpp:423
lldb_private::Thread::m_curr_frames_sp
lldb::StackFrameListSP m_curr_frames_sp
The stack frames that get lazily populated after a thread stops.
Definition: Thread.h:1278
lldb_private::ThreadPlanStack::PushPlan
void PushPlan(lldb::ThreadPlanSP new_plan_sp)
Definition: ThreadPlanStack.cpp:133
Debugger.h
lldb_private::SymbolContext
Definition: SymbolContext.h:33
lldb_private::Target
Definition: Target.h:469
lldb_private::StackFrame::HasDebugInformation
bool HasDebugInformation()
Determine whether this StackFrame has debug information available or not.
Definition: StackFrame.cpp:1153
lldb_private::Thread::ShouldStop
bool ShouldStop(Event *event_ptr)
Definition: Thread.cpp:744
lldb_private::ExecutionContext::GetThreadPtr
Thread * GetThreadPtr() const
Returns a pointer to the thread object.
Definition: ExecutionContext.h:399
lldb_private::Thread::GetProtocolID
virtual lldb::user_id_t GetProtocolID() const
Definition: Thread.h:1082
lldb_private::Cloneable
Definition: Cloneable.h:40
lldb_private::Thread::GetResumeState
lldb::StateType GetResumeState() const
Gets the USER resume state for this thread.
Definition: Thread.h:197
lldb_private::ThreadPlanStack::GetReturnValueObject
lldb::ValueObjectSP GetReturnValueObject() const
Definition: ThreadPlanStack.cpp:287
lldb_private::Thread::SafeToCallFunctions
virtual bool SafeToCallFunctions()
Check whether this thread is safe to run functions.
Definition: Thread.cpp:1663
ABI.h
lldb_private::Target::GetImages
const ModuleList & GetImages() const
Get accessor for the images for this process.
Definition: Target.h:947
lldb_private::Thread::RunModeAsString
static std::string RunModeAsString(lldb::RunMode mode)
Definition: Thread.cpp:1716
lldb_private::StreamString::GetString
llvm::StringRef GetString() const
Definition: StreamString.cpp:51
lldb_private::ThreadPlanStepInstruction
Definition: ThreadPlanStepInstruction.h:18
lldb_private::Process::GetState
lldb::StateType GetState()
Get accessor for the current process state.
Definition: Process.cpp:1295
lldb_private::Thread::FrameSelectedCallback
void FrameSelectedCallback(lldb_private::StackFrame *frame)
Definition: Thread.cpp:321
lldb_private::ThreadPlanShouldStopHere::ClearShouldStopHereCallbacks
void ClearShouldStopHereCallbacks()
Definition: ThreadPlanShouldStopHere.h:95
lldb_private::Thread::GetState
lldb::StateType GetState() const
Definition: Thread.cpp:547
lldb_private::Thread::ThreadEventData::~ThreadEventData
~ThreadEventData() override
Process.h
lldb_private::Thread::eBroadcastBitStackChanged
@ eBroadcastBitStackChanged
Definition: Thread.h:69
lldb_private::Thread::GetCompletedPlan
lldb::ThreadPlanSP GetCompletedPlan() const
Gets the outer-most plan that was popped off the plan stack in the most recent stop.
Definition: Thread.cpp:1143
lldb_private::ThreadPlanPython
Definition: ThreadPlanPython.h:32
lldb_private::Thread::GetName
virtual const char * GetName()
Definition: Thread.h:281
lldb_private::Thread::CheckpointThreadState
virtual bool CheckpointThreadState(ThreadStateCheckpoint &saved_state)
Definition: Thread.cpp:488
lldb_private::Thread::IsThreadPlanDone
bool IsThreadPlanDone(ThreadPlan *plan) const
Checks whether the given plan is in the completed plans for this stop.
Definition: Thread.cpp:1155
lldb_private::Thread::CalculateStopInfo
virtual bool CalculateStopInfo()=0
lldb_private::Thread::BroadcastSelectedFrameChange
void BroadcastSelectedFrameChange(StackID &new_frame_id)
Definition: Thread.cpp:260
lldb_private::ThreadPlanStepOverBreakpoint::GetBreakpointLoadAddress
lldb::addr_t GetBreakpointLoadAddress() const
Definition: ThreadPlanStepOverBreakpoint.h:36
lldb::eStateStopped
@ eStateStopped
Process or thread is stopped and can be examined.
Definition: lldb-enumerations.h:84
lldb_private::Thread::SettingsTerminate
static void SettingsTerminate()
Definition: Thread.cpp:1647
Target.h
LLDB_INVALID_FRAME_ID
#define LLDB_INVALID_FRAME_ID
Definition: lldb-defines.h:83
lldb_private::Thread::DiscardPlan
void DiscardPlan()
Definition: Thread.cpp:1114
lldb_private::Properties
Definition: UserSettingsController.h:33
lldb_private::Target::GetPlatform
lldb::PlatformSP GetPlatform()
Definition: Target.h:1403
lldb_private::Thread::GetProcess
lldb::ProcessSP GetProcess() const
Definition: Thread.h:153
lldb_private::Event::GetData
EventData * GetData()
Definition: Event.h:202
lldb_private::Thread::SetTemporaryResumeState
void SetTemporaryResumeState(lldb::StateType new_state)
Definition: Thread.h:1245
lldb_private::Thread::ThreadEventData::GetThreadFromEvent
static lldb::ThreadSP GetThreadFromEvent(const Event *event_ptr)
Definition: Thread.cpp:181
lldb_private::FileSpec
Definition: FileSpec.h:55
lldb_private::Thread::StepIn
virtual Status StepIn(bool source_step, LazyBool step_in_avoids_code_without_debug_info=eLazyBoolCalculate, LazyBool step_out_avoids_code_without_debug_info=eLazyBoolCalculate)
Default implementation for stepping into.
Definition: Thread.cpp:1909
lldb_private::Thread::ThreadEventData
Definition: Thread.h:82
lldb_private::Thread::DestroyThread
virtual void DestroyThread()
Definition: Thread.cpp:250
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
LLDB_INVALID_SIGNAL_NUMBER
#define LLDB_INVALID_SIGNAL_NUMBER
Definition: lldb-defines.h:84
lldb_private::Status::Success
bool Success() const
Test for success condition.
Definition: Status.cpp:287
lldb_private::SystemRuntime::SafeToCallFunctionsOnThisThread
virtual bool SafeToCallFunctionsOnThisThread(lldb::ThreadSP thread_sp)
Determine whether it is safe to run an expression on a given thread.
Definition: SystemRuntime.h:293
lldb_private::ThreadList::SetSelectedThreadByID
bool SetSelectedThreadByID(lldb::tid_t tid, bool notify=false)
Definition: ThreadList.cpp:696
lldb_private::ThreadProperties::GetStepInAvoidsNoDebug
bool GetStepInAvoidsNoDebug() const
Definition: Thread.cpp:132
lldb_private::Thread::CalculateProcess
lldb::ProcessSP CalculateProcess() override
Definition: Thread.cpp:1413
lldb_private::ThreadPlan
Definition: ThreadPlan.h:287
lldb_private::ExecutionContext::GetRegisterContext
RegisterContext * GetRegisterContext() const
Definition: ExecutionContext.cpp:190
lldb::eStopReasonProcessorTrace
@ eStopReasonProcessorTrace
Definition: lldb-enumerations.h:251
lldb_private::ThreadPlan::WillStop
virtual bool WillStop()=0
lldb_private::StateIsStoppedState
bool StateIsStoppedState(lldb::StateType state, bool must_exist)
Check if a state represents a state where the process or thread is stopped.
Definition: State.cpp:89
lldb_private::Stream::Indent
size_t Indent(llvm::StringRef s="")
Indent the current line in the stream.
Definition: Stream.cpp:130
DumpAddressList
static void DumpAddressList(Stream &s, const std::vector< Address > &list, ExecutionContextScope *exe_scope)
Definition: Thread.cpp:1549
lldb_private::Thread::m_state
lldb::StateType m_state
The state of our process.
Definition: Thread.h:1273
lldb_private::ThreadPlan::ShouldAutoContinue
virtual bool ShouldAutoContinue(Event *event_ptr)
Returns whether this thread plan overrides the ShouldStop of subsequently processed plans.
Definition: ThreadPlan.h:375
lldb_private::ThreadPlanStack::CheckpointCompletedPlans
size_t CheckpointCompletedPlans()
Definition: ThreadPlanStack.cpp:84
lldb_private::DataExtractor
Definition: DataExtractor.h:48
lldb_private::Thread::ReturnFromFrame
Status ReturnFromFrame(lldb::StackFrameSP frame_sp, lldb::ValueObjectSP return_value_sp, bool broadcast=false)
Definition: Thread.cpp:1470
lldb_private::Thread::ThreadEventData::GetStackFrameFromEvent
static lldb::StackFrameSP GetStackFrameFromEvent(const Event *event_ptr)
Definition: Thread.cpp:198
Log.h
lldb_private::ExecutionContextScope
Definition: ExecutionContextScope.h:32
lldb_private::ThreadPlan::MischiefManaged
virtual bool MischiefManaged()
Definition: ThreadPlan.cpp:72
lldb::eStopReasonWatchpoint
@ eStopReasonWatchpoint
Definition: lldb-enumerations.h:244
lldb_private::Thread
Definition: Thread.h:61
ThreadSpec.h
lldb_private::ThreadPlanRunToAddress
Definition: ThreadPlanRunToAddress.h:19
lldb::eStopReasonNone
@ eStopReasonNone
Definition: lldb-enumerations.h:241
lldb_private::ThreadPlanStack::WillResume
void WillResume()
Definition: ThreadPlanStack.cpp:393
lldb_private::ThreadPlanStack::GetPreviousPlan
ThreadPlan * GetPreviousPlan(ThreadPlan *current_plan) const
Definition: ThreadPlanStack.cpp:348
lldb_private::Debugger::GetThreadFormat
const FormatEntity::Entry * GetThreadFormat() const
Definition: Debugger.cpp:303
lldb_private::StructuredData::ObjectSP
std::shared_ptr< Object > ObjectSP
Definition: StructuredData.h:59
lldb_private::StreamString::GetData
const char * GetData() const
Definition: StreamString.h:43
lldb_private::Status::SetErrorStringWithFormat
int SetErrorStringWithFormat(const char *format,...) __attribute__((format(printf
Set the current error string to a formatted error string.
Definition: Status.cpp:255
lldb_private::SymbolContext::function
Function * function
The Function for a given query.
Definition: SymbolContext.h:320
StreamString.h
lldb_private::Thread::GetExpressionVariable
lldb::ExpressionVariableSP GetExpressionVariable() const
Gets the outer-most expression variable from the completed plans.
Definition: Thread.cpp:1151
lldb_private::LLDBLog::Thread
@ Thread
lldb::eStopReasonInstrumentation
@ eStopReasonInstrumentation
Definition: lldb-enumerations.h:250
lldb_private::ThreadPlanStack::GetInnermostExpression
ThreadPlan * GetInnermostExpression() const
Definition: ThreadPlanStack.cpp:376
lldb::break_id_t
int32_t break_id_t
Definition: lldb-types.h:88
lldb_private::Process::ProcessEventData::GetRestartedFromEvent
static bool GetRestartedFromEvent(const Event *event_ptr)
Definition: Process.cpp:4138
lldb_private::DataExtractor::GetByteOrder
lldb::ByteOrder GetByteOrder() const
Get the current byte order value.
Definition: DataExtractor.h:594
Property.h
lldb_private::Thread::ThreadEventData::GetFlavorString
static ConstString GetFlavorString()
Definition: Thread.cpp:152
lldb_private::ConstString
Definition: ConstString.h:39
lldb_private::Thread::m_prev_frames_sp
lldb::StackFrameListSP m_prev_frames_sp
The previous stack frames from the last time this thread stopped.
Definition: Thread.h:1280
lldb_private::Thread::GetTemporaryResumeState
lldb::StateType GetTemporaryResumeState() const
Definition: Thread.h:1160
lldb_private::Thread::QueueThreadPlanForStepThrough
virtual lldb::ThreadPlanSP QueueThreadPlanForStepThrough(StackID &return_stack_id, bool abort_other_plans, bool stop_other_threads, Status &status)
Gets the plan used to step through the code that steps from a function call site at the current PC in...
Definition: Thread.cpp:1357
lldb_private::ExecutionContext::SetContext
void SetContext(const lldb::TargetSP &target_sp, bool get_process)
Definition: ExecutionContext.cpp:288
lldb_private::StreamString
Definition: StreamString.h:23
lldb_private::ThreadPlanStepUntil
Definition: ThreadPlanStepUntil.h:17
lldb_private::Thread::StepOut
virtual Status StepOut(uint32_t frame_idx=0)
Default implementation for stepping out.
Definition: Thread.cpp:1978
lldb_private::Thread::SetStopInfo
void SetStopInfo(const lldb::StopInfoSP &stop_info_sp)
Definition: Thread.cpp:445
lldb_private::Thread::SetStopInfoToNothing
void SetStopInfoToNothing()
Definition: Thread.cpp:478
lldb::eDescriptionLevelFull
@ eDescriptionLevelFull
Definition: lldb-enumerations.h:209
lldb-enumerations.h
lldb_private::AddressRange
Definition: AddressRange.h:25
ThreadOptionValueProperties::GetPropertyAtIndex
const Property * GetPropertyAtIndex(const ExecutionContext *exe_ctx, bool will_modify, uint32_t idx) const override
Definition: Thread.cpp:80
lldb_private::Thread::QueueThreadPlanForStepInRange
virtual lldb::ThreadPlanSP QueueThreadPlanForStepInRange(bool abort_other_plans, const AddressRange &range, const SymbolContext &addr_context, const char *step_in_target, lldb::RunMode stop_other_threads, Status &status, LazyBool step_in_avoids_code_without_debug_info=eLazyBoolCalculate, LazyBool step_out_avoids_code_without_debug_info=eLazyBoolCalculate)
Queues the plan used to step through an address range, stepping into functions.
Definition: Thread.cpp:1295
ThreadOptionValueProperties::ThreadOptionValueProperties
ThreadOptionValueProperties(ConstString name)
Definition: Thread.cpp:78
lldb_private::ThreadPlanBase
Definition: ThreadPlanBase.h:23
lldb_private::Thread::GetBackingThread
virtual lldb::ThreadSP GetBackingThread() const
Definition: Thread.h:460
lldb_private::Thread::GetCurrentExceptionBacktrace
lldb::ThreadSP GetCurrentExceptionBacktrace()
Definition: Thread.cpp:2018
lldb_private::StructuredDataImpl
Definition: StructuredDataImpl.h:26
lldb_private::ThreadProperties::GetSymbolsToAvoidRegexp
const RegularExpression * GetSymbolsToAvoidRegexp()
The regular expression returned determines symbols that this thread won't stop in during "step-in" op...
Definition: Thread.cpp:112
lldb_private::Thread::m_stop_info_override_stop_id
uint32_t m_stop_info_override_stop_id
Definition: Thread.h:1263
lldb_private::DynamicLoader
Definition: DynamicLoader.h:52
lldb_private::RegisterContext::SetPC
bool SetPC(uint64_t pc)
Definition: RegisterContext.cpp:112
lldb_private::Thread::GetCurrentException
lldb::ValueObjectSP GetCurrentException()
Definition: Thread.cpp:2002
lldb_private::ThreadPlan::PlanExplainsStop
bool PlanExplainsStop(Event *event_ptr)
Definition: ThreadPlan.cpp:51
lldb_private::Thread::ShouldReportStop
Vote ShouldReportStop(Event *event_ptr)
Definition: Thread.cpp:978
lldb_private::Thread::GetExtendedInfo
StructuredData::ObjectSP GetExtendedInfo()
Retrieve a dictionary of information about this thread.
Definition: Thread.h:273
lldb_private::ThreadProperties::GetMaxBacktraceDepth
uint64_t GetMaxBacktraceDepth() const
Definition: Thread.cpp:144
lldb_private::LanguageRuntime
Definition: LanguageRuntime.h:60
lldb_private::Thread::CalculatePublicStopInfo
void CalculatePublicStopInfo()
Definition: Thread.cpp:368
lldb_private::Broadcaster::EventTypeHasListeners
bool EventTypeHasListeners(uint32_t event_type)
Definition: Broadcaster.h:345
lldb_private::Thread::ShouldResume
bool ShouldResume(lldb::StateType resume_state)
Definition: Thread.cpp:674
ThreadPlanRunToAddress.h
lldb_private::StopInfo::CreateStopReasonWithPlan
static lldb::StopInfoSP CreateStopReasonWithPlan(lldb::ThreadPlanSP &plan, lldb::ValueObjectSP return_valobj_sp, lldb::ExpressionVariableSP expression_variable_sp)
Definition: StopInfo.cpp:1385
lldb_private::Thread::SetState
void SetState(lldb::StateType state)
Definition: Thread.cpp:553
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
lldb_private::Thread::m_unwinder_up
std::unique_ptr< lldb_private::Unwind > m_unwinder_up
It gets set in Thread::ShouldResume.
Definition: Thread.h:1292
lldb_private::Thread::WillResume
virtual void WillResume(lldb::StateType resume_state)
Definition: Thread.h:209
lldb_private::Thread::SetSelectedFrame
uint32_t SetSelectedFrame(lldb_private::StackFrame *frame, bool broadcast=false)
Definition: Thread.cpp:274
lldb_private::ThreadProperties::GetStepOutAvoidsNoDebug
bool GetStepOutAvoidsNoDebug() const
Definition: Thread.cpp:138
Thread.h
ThreadPlanStepOverBreakpoint.h
lldb_private::Thread::ThreadStateCheckpoint::current_inlined_depth
uint32_t current_inlined_depth
Definition: Thread.h:128
lldb_private::Thread::m_stop_info_stop_id
uint32_t m_stop_info_stop_id
Definition: Thread.h:1259
lldb::eStateUnloaded
@ eStateUnloaded
Process is object is valid, but not currently loaded.
Definition: lldb-enumerations.h:75
lldb_private::Thread::m_should_run_before_public_stop
bool m_should_run_before_public_stop
Definition: Thread.h:1266
lldb_private::CompilerType::GetFunctionReturnType
CompilerType GetFunctionReturnType() const
Definition: CompilerType.cpp:373
lldb_private::Thread::GetThreadPointer
virtual lldb::addr_t GetThreadPointer()
Retrieves the per-thread data area.
Definition: Thread.cpp:1649
lldb_private::LLDBLog::Step
@ Step
ThreadPlanCallFunction.h
lldb_private::ThreadSpec
Definition: ThreadSpec.h:33
lldb_private::DynamicLoader::GetThreadLocalData
virtual lldb::addr_t GetThreadLocalData(const lldb::ModuleSP module, const lldb::ThreadSP thread, lldb::addr_t tls_file_addr)
Retrieves the per-module TLS block for a given thread.
Definition: DynamicLoader.h:198
lldb_private::Thread::SetSelectedFrameByIndexNoisily
bool SetSelectedFrameByIndexNoisily(uint32_t frame_idx, Stream &output_stream)
Definition: Thread.cpp:295
lldb_private::RegisterContext
Definition: RegisterContext.h:17
lldb_private::CompilerType::IsValid
bool IsValid() const
Definition: CompilerType.h:72
ValueObject.h
OptionValueProperties.h
lldb_private::ThreadPlan::OkayToDiscard
virtual bool OkayToDiscard()
Definition: ThreadPlan.cpp:155
lldb_private::ArchSpec::GetAddressByteSize
uint32_t GetAddressByteSize() const
Returns the size in bytes of an address of the current architecture.
Definition: ArchSpec.cpp:682
lldb_private::Thread::GetFrameWithConcreteFrameIndex
virtual lldb::StackFrameSP GetFrameWithConcreteFrameIndex(uint32_t unwind_idx)
Definition: Thread.cpp:1451
lldb_private::LineEntry::line
uint32_t line
The source line number, or zero if there is no line number information.
Definition: LineEntry.h:143
lldb::RunMode
RunMode
Thread Run Modes.
Definition: lldb-enumerations.h:135
lldb_private::UserID::GetID
lldb::user_id_t GetID() const
Get accessor for the user ID.
Definition: UserID.h:47
lldb_private::Thread::ThreadEventData::GetThread
lldb::ThreadSP GetThread() const
Definition: Thread.h:108
lldb_private::Thread::CalculateExecutionContext
void CalculateExecutionContext(ExecutionContext &exe_ctx) override
Reconstruct the object's execution context into sc.
Definition: Thread.cpp:1419
lldb_private::StackFrame::GetStackID
StackID & GetStackID()
Definition: StackFrame.cpp:145
lldb_private::FormatEntity::Format
static bool Format(const Entry &entry, Stream &s, const SymbolContext *sc, const ExecutionContext *exe_ctx, const Address *addr, ValueObject *valobj, bool function_changed, bool initial_function)
Definition: FormatEntity.cpp:1076
lldb_private::Thread::m_stop_info_sp
lldb::StopInfoSP m_stop_info_sp
The private stop reason for this thread.
Definition: Thread.h:1258
lldb_private::Thread::SettingsInitialize
static void SettingsInitialize()
Definition: Thread.cpp:1645
ValueObjectConstResult.h
lldb_private::Thread::QueueBasePlan
lldb::ThreadPlanSP QueueBasePlan(bool abort_other_plans)
Queues the base plan for a thread.
Definition: Thread.cpp:1253
ThreadPlan.h
lldb_private::Thread::CalculateThread
lldb::ThreadSP CalculateThread() override
Definition: Thread.cpp:1415
lldb_private::Thread::GetStatus
size_t GetStatus(Stream &strm, uint32_t start_frame, uint32_t num_frames, uint32_t num_frames_with_source, bool stop_format, bool only_stacks=false)
Definition: Thread.cpp:1729
lldb_private::Thread::IsStillAtLastBreakpointHit
virtual bool IsStillAtLastBreakpointHit()
Definition: Thread.cpp:1888
lldb::eStateStepping
@ eStateStepping
Process or thread is in the process of stepping and can not be examined.
Definition: lldb-enumerations.h:86
lldb_private::Thread::DiscardThreadPlansUpToPlan
void DiscardThreadPlansUpToPlan(lldb::ThreadPlanSP &up_to_plan_sp)
Discards the plans queued on the plan stack of the current thread up to and including up_to_plan_sp.
Definition: Thread.cpp:1213
lldb::eStateSuspended
@ eStateSuspended
Process or thread is in a suspended state as far as the debugger is concerned while other processes o...
Definition: lldb-enumerations.h:91
ThreadPlanStepInRange.h
lldb_private::Broadcaster::BroadcastEvent
void BroadcastEvent(lldb::EventSP &event_sp)
Broadcast an event which has no associated data.
Definition: Broadcaster.h:262
lldb_private::StructuredData::Object::GetAsArray
Array * GetAsArray()
Definition: StructuredData.h:85
lldb::eStopReasonSignal
@ eStopReasonSignal
Definition: lldb-enumerations.h:245
lldb_private::Target::GetArchitecture
const ArchSpec & GetArchitecture() const
Definition: Target.h:989
lldb_private::OptionValueProperties::ProtectedGetPropertyAtIndex
Property * ProtectedGetPropertyAtIndex(uint32_t idx)
Definition: OptionValueProperties.h:210
lldb_private::Thread::GetStopInfo
lldb::StopInfoSP GetStopInfo()
Definition: Thread.cpp:335
lldb_private::Thread::ShouldReportRun
Vote ShouldReportRun(Event *event_ptr)
Definition: Thread.cpp:1039
lldb_private::Thread::PopPlan
void PopPlan()
Definition: Thread.cpp:1105
lldb_private::Thread::GetStackFrameList
lldb::StackFrameListSP GetStackFrameList()
Definition: Thread.cpp:1423
lldb::eStopReasonExec
@ eStopReasonExec
Program was re-exec'ed.
Definition: lldb-enumerations.h:247
lldb_private::Status
Definition: Status.h:44
lldb_private::Thread::m_process_wp
lldb::ProcessWP m_process_wp
The process that owns this thread.
Definition: Thread.h:1257
lldb_private::Thread::SetShouldRunBeforePublicStop
void SetShouldRunBeforePublicStop(bool newval)
Definition: Thread.h:1170
lldb_private::Thread::m_reg_context_sp
lldb::RegisterContextSP m_reg_context_sp
The register context for this thread's current register state.
Definition: Thread.h:1271
lldb_private::StopInfo::WillResume
virtual void WillResume(lldb::StateType resume_state)
Definition: StopInfo.h:67
lldb_private::Address::DumpStyleResolvedDescription
@ DumpStyleResolvedDescription
Display the details about what an address resolves to.
Definition: Address.h:101
lldb_private::OptionValueFileSpecList::GetCurrentValue
FileSpecList GetCurrentValue() const
Definition: OptionValueFileSpecList.h:50
lldb_private::Thread::m_frame_mutex
std::recursive_mutex m_frame_mutex
Multithreaded protection for m_state.
Definition: Thread.h:1277
lldb_private::Thread::PushPlan
void PushPlan(lldb::ThreadPlanSP plan_sp)
Definition: Thread.cpp:1090
message
message(FATAL_ERROR "invalid libipt include path provided") endif() include_directories($
Definition: Plugins/Trace/intel-pt/CMakeLists.txt:6
uint32_t
lldb_private::eLazyBoolNo
@ eLazyBoolNo
Definition: lldb-private-enumerations.h:115
lldb_private::Thread::~Thread
~Thread() override
Definition: Thread.cpp:241
lldb_private::Stream::IndentMore
void IndentMore(unsigned amount=2)
Increment the current indentation level.
Definition: Stream.cpp:168
lldb_private::Thread::GetStaticBroadcasterClass
static ConstString & GetStaticBroadcasterClass()
Definition: Thread.cpp:213
lldb_private::Process::GetSystemRuntime
virtual SystemRuntime * GetSystemRuntime()
Get the system runtime plug-in for this process.
Definition: Process.cpp:2674
lldb_private::Address
Definition: Address.h:59
lldb_private::Unwind::Clear
void Clear()
Definition: Unwind.h:26
lldb::eOnlyDuringStepping
@ eOnlyDuringStepping
Definition: lldb-enumerations.h:135
id
void * id
Definition: PlatformiOSSimulatorCoreSimulatorSupport.h:20
lldb_private::Thread::DidStop
virtual void DidStop()
Definition: Thread.cpp:742
lldb::eStopReasonPlanComplete
@ eStopReasonPlanComplete
Definition: lldb-enumerations.h:248
lldb_private::StructuredData::Object::GetAsDictionary
Dictionary * GetAsDictionary()
Definition: StructuredData.h:91
lldb_private::RegisterCheckpoint::Reason::eExpression
@ eExpression
lldb_private::LLDBLog::Object
@ Object
lldb_private::Thread::QueueThreadPlan
Status QueueThreadPlan(lldb::ThreadPlanSP &plan_sp, bool abort_other_plans)
Queues a generic thread plan.
Definition: Thread.cpp:1171
ThreadPlanStepInstruction.h
lldb_private::Thread::ThreadEventData::GetStackID
StackID GetStackID() const
Definition: Thread.h:110
lldb_private::Type
Definition: Type.h:66
lldb_private::Status::SetErrorString
void SetErrorString(llvm::StringRef err_str)
Set the current error string to err_str.
Definition: Status.cpp:241
lldb_private::ThreadPlanStepOverBreakpoint::SetAutoContinue
void SetAutoContinue(bool do_it)
Definition: ThreadPlanStepOverBreakpoint.cpp:162
lldb_private::ModuleList::FindAddressesForLine
void FindAddressesForLine(const lldb::TargetSP target_sp, const FileSpec &file, uint32_t line, Function *function, std::vector< Address > &output_local, std::vector< Address > &output_extern)
Find addresses by file/line.
Definition: ModuleList.cpp:611
lldb_private::RegisterCheckpoint
Definition: RegisterCheckpoint.h:21
lldb_private::ThreadPlan::DoTraceLog
void DoTraceLog()
Definition: ThreadPlan.h:443
lldb_private::FormatEntity::Entry
Definition: FormatEntity.h:40
lldb_private::Thread::GetReturnValueObject
lldb::ValueObjectSP GetReturnValueObject() const
Gets the outer-most return value from the completed plans.
Definition: Thread.cpp:1147
UINT32_MAX
#define UINT32_MAX
Definition: lldb-defines.h:19
lldb_private::Thread::QueueThreadPlanForRunToAddress
virtual lldb::ThreadPlanSP QueueThreadPlanForRunToAddress(bool abort_other_plans, Address &target_addr, bool stop_other_threads, Status &status)
Gets the plan used to continue from the current PC.
Definition: Thread.cpp:1370
lldb_private::Thread::QueueThreadPlanForStepUntil
virtual lldb::ThreadPlanSP QueueThreadPlanForStepUntil(bool abort_other_plans, lldb::addr_t *address_list, size_t num_addresses, bool stop_others, uint32_t frame_idx, Status &status)
Definition: Thread.cpp:1381
lldb_private::Thread::GetSelectedFrame
lldb::StackFrameSP GetSelectedFrame()
Definition: Thread.cpp:266
FormatEntity.h
StopInfo.h
lldb::eStopReasonBreakpoint
@ eStopReasonBreakpoint
Definition: lldb-enumerations.h:243
lldb_private::ThreadProperties::~ThreadProperties
~ThreadProperties() override
lldb::eStructuredDataTypeInteger
@ eStructuredDataTypeInteger
Definition: lldb-enumerations.h:797
lldb_private::Vote
Vote
Definition: lldb-private-enumerations.h:59
lldb_private::ThreadPlan::ShouldReportRun
Vote ShouldReportRun(Event *event_ptr)
Definition: ThreadPlan.cpp:94
SystemRuntime.h
lldb_private::Thread::ThreadStateCheckpoint
Definition: Thread.h:120
ThreadPlanBase.h
LLDB_INVALID_ADDRESS
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:74
lldb_private::ThreadPlanStack::AnyCompletedPlans
bool AnyCompletedPlans() const
Definition: ThreadPlanStack.cpp:320
lldb_private::Thread::MatchesSpec
virtual bool MatchesSpec(const ThreadSpec *spec)
Definition: Thread.cpp:1070
lldb_private::ExecutionContext::GetTargetSP
const lldb::TargetSP & GetTargetSP() const
Get accessor to get the target shared pointer.
Definition: ExecutionContext.h:454
LLDB_LOG
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
Definition: Log.h:337
lldb_private::ThreadPlanStack::DiscardPlansUpToPlan
void DiscardPlansUpToPlan(ThreadPlan *up_to_plan_ptr)
Definition: ThreadPlanStack.cpp:179
StructuredDataImpl.h
lldb_private::Thread::WasThreadPlanDiscarded
bool WasThreadPlanDiscarded(ThreadPlan *plan) const
Checks whether the given plan is in the discarded plans for this stop.
Definition: Thread.cpp:1159
lldb_private::CompilerType
Generic representation of a type in a programming language.
Definition: CompilerType.h:33
Function.h
lldb_private::ValueObjectConstResult::Create
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order, uint32_t addr_byte_size, lldb::addr_t address=LLDB_INVALID_ADDRESS)
Definition: ValueObjectConstResult.cpp:28
lldb_private::Stream::Printf
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition: Stream.cpp:107
lldb_private::Function::GetType
Type * GetType()
Get accessor for the type that describes the function return value type, and parameter types.
Definition: Function.cpp:500
lldb_private::OptionValueProperties::CreateLocalCopy
static lldb::OptionValuePropertiesSP CreateLocalCopy(const Properties &global_properties)
Definition: OptionValueProperties.cpp:588
lldb_private::OptionValueFileSpecList
Definition: OptionValueFileSpecList.h:19
lldb_private::Thread::GetThreadLocalData
virtual lldb::addr_t GetThreadLocalData(const lldb::ModuleSP module, lldb::addr_t tls_file_addr)
Retrieves the per-module TLS block for a thread.
Definition: Thread.cpp:1651
LanguageRuntime.h
lldb_private::ThreadPlan::GetName
const char * GetName() const
Returns the name of this thread plan.
Definition: ThreadPlan.h:314
lldb_private::ThreadPlanStack
Definition: ThreadPlanStack.h:31
lldb_private::ExecutionContext::GetTargetRef
Target & GetTargetRef() const
Returns a reference to the target object.
Definition: ExecutionContext.cpp:224
lldb_private::ThreadPlan::IsControllingPlan
bool IsControllingPlan()
Definition: ThreadPlan.h:396
lldb_private::Thread::m_override_should_notify
LazyBool m_override_should_notify
Definition: Thread.h:1295
lldb_private::ThreadPlanStack::PopPlan
lldb::ThreadPlanSP PopPlan()
Definition: ThreadPlanStack.cpp:149
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb::eDescriptionLevelVerbose
@ eDescriptionLevelVerbose
Definition: lldb-enumerations.h:210
lldb_private::Host::OpenFileInExternalEditor
static bool OpenFileInExternalEditor(const FileSpec &file_spec, uint32_t line_no)
Definition: common/Host.cpp:550
lldb::eFormatHex
@ eFormatHex
Definition: lldb-enumerations.h:169
lldb_private::eLazyBoolCalculate
@ eLazyBoolCalculate
Definition: lldb-private-enumerations.h:115
lldb_private::Thread::Thread
Thread(Process &process, lldb::tid_t tid, bool use_invalid_index_id=false)
Constructor.
Definition: Thread.cpp:218
lldb_private::ThreadPlanStepOverBreakpoint
Definition: ThreadPlanStepOverBreakpoint.h:17
lldb_private::StopInfo
Definition: StopInfo.h:20
lldb_private::Debugger::GetThreadStopFormat
const FormatEntity::Entry * GetThreadStopFormat() const
Definition: Debugger.cpp:308
lldb_private::ThreadPlan::WillResume
bool WillResume(lldb::StateType resume_state, bool current_plan)
Definition: ThreadPlan.cpp:116
lldb_private::Thread::eBroadcastBitSelectedFrameChanged
@ eBroadcastBitSelectedFrameChanged
Definition: Thread.h:72
lldb_private::Thread::ThreadStoppedForAReason
bool ThreadStoppedForAReason()
Definition: Thread.cpp:486
lldb_private::Function::GetCompilerType
CompilerType GetCompilerType()
Definition: Function.cpp:521
lldb::eStateInvalid
@ eStateInvalid
Definition: lldb-enumerations.h:74
lldb_private::Thread::ThreadStateCheckpoint::m_completed_plan_checkpoint
size_t m_completed_plan_checkpoint
Definition: Thread.h:125
GetGlobalProperties
static DynamicLoaderDarwinKernelProperties & GetGlobalProperties()
Definition: DynamicLoaderDarwinKernel.cpp:128
lldb_private::Thread::QueueThreadPlanForStepScripted
virtual lldb::ThreadPlanSP QueueThreadPlanForStepScripted(bool abort_other_plans, const char *class_name, StructuredData::ObjectSP extra_args_sp, bool stop_other_threads, Status &status)
Definition: Thread.cpp:1391
lldb::eAllThreads
@ eAllThreads
Definition: lldb-enumerations.h:135
lldb::eStructuredDataTypeArray
@ eStructuredDataTypeArray
Definition: lldb-enumerations.h:796
lldb_private::StackID
Definition: StackID.h:17
lldb_private::ThreadPlan::ShouldReportStop
virtual Vote ShouldReportStop(Event *event_ptr)
Definition: ThreadPlan.cpp:79
lldb_private::Process::Resume
Status Resume()
Resumes all of a process's threads as configured using the Thread run control functions.
Definition: Process.cpp:1339
OptionValueFileSpecList.h
State.h
lldb_private::ThreadPlanStack::DiscardConsultingControllingPlans
void DiscardConsultingControllingPlans()
Definition: ThreadPlanStack.cpp:215
lldb_private::Thread::GetSiginfoValue
lldb::ValueObjectSP GetSiginfoValue()
Definition: Thread.cpp:2033
LLDB_INVALID_INDEX32
#define LLDB_INVALID_INDEX32
Definition: lldb-defines.h:75
lldb_private::Properties::m_collection_sp
lldb::OptionValuePropertiesSP m_collection_sp
Definition: UserSettingsController.h:87
lldb::StateType
StateType
Process and Thread States.
Definition: lldb-enumerations.h:73
Stream.h
lldb_private::Thread::StopReasonAsString
static std::string StopReasonAsString(lldb::StopReason reason)
Definition: Thread.cpp:1679
lldb_private::Log
Definition: Log.h:115
lldb_private::Thread::WillStop
void WillStop()
Definition: Thread.cpp:615
lldb_private::ThreadPlanStack::GetExpressionVariable
lldb::ExpressionVariableSP GetExpressionVariable() const
Definition: ThreadPlanStack.cpp:301
lldb_private::Thread::m_resume_state
lldb::StateType m_resume_state
This state is used to force a thread to be suspended from outside the ThreadPlan logic.
Definition: Thread.h:1284
lldb_private::StructuredData::Array::GetItemAtIndex
ObjectSP GetItemAtIndex(size_t idx) const
Definition: StructuredData.h:188
lldb_private::Thread::GetStackFrameAtIndex
virtual lldb::StackFrameSP GetStackFrameAtIndex(uint32_t idx)
Definition: Thread.h:399
lldb_private::Thread::QueueThreadPlanForStepSingleInstruction
virtual lldb::ThreadPlanSP QueueThreadPlanForStepSingleInstruction(bool step_over, bool abort_other_plans, bool stop_other_threads, Status &status)
Queues the plan used to step one instruction from the current PC of thread.
Definition: Thread.cpp:1259
lldb_private::StructuredData::Array::GetSize
size_t GetSize() const
Definition: StructuredData.h:180
lldb_private::ThreadPlanStack::DiscardAllPlans
void DiscardAllPlans()
Definition: ThreadPlanStack.cpp:207
lldb_private::SymbolContext::line_entry
LineEntry line_entry
The LineEntry for a given query.
Definition: SymbolContext.h:322
lldb_private::Thread::GetRegisterContext
virtual lldb::RegisterContextSP GetRegisterContext()=0
lldb_private::ExecutionContext::SetFrameSP
void SetFrameSP(const lldb::StackFrameSP &frame_sp)
Set accessor to set only the frame shared pointer.
Definition: ExecutionContext.cpp:256
lldb_private::GetLog
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition: Log.h:309
lldb_private::Broadcaster
Definition: Broadcaster.h:242
lldb_private::ThreadPlan::IsBasePlan
virtual bool IsBasePlan()
Definition: ThreadPlan.h:435
lldb_private::ThreadList::GetSelectedThread
lldb::ThreadSP GetSelectedThread()
Definition: ThreadList.cpp:684
lldb_private::StackFrame
Definition: StackFrame.h:40
lldb_private::ThreadPlanStack::WasPlanDiscarded
bool WasPlanDiscarded(ThreadPlan *plan) const
Definition: ThreadPlanStack.cpp:339
lldb::eStopReasonVForkDone
@ eStopReasonVForkDone
Definition: lldb-enumerations.h:254
lldb_private::Unwind
Definition: Unwind.h:18
lldb_private::Thread::SetResumeSignal
void SetResumeSignal(int signal)
Definition: Thread.h:157
DynamicLoader.h
lldb
Definition: SBAddress.h:15
lldb_private::Thread::StepOver
virtual Status StepOver(bool source_step, LazyBool step_out_avoids_code_without_debug_info=eLazyBoolCalculate)
Default implementation for stepping over.
Definition: Thread.cpp:1945
StackFrameRecognizer.h
lldb::eStateRunning
@ eStateRunning
Process or thread is running and can't be examined.
Definition: lldb-enumerations.h:85
RegisterContext.h
lldb_private::ThreadPlanStepInRange
Definition: ThreadPlanStepInRange.h:20
lldb_private::Thread::ThreadEventData::ThreadEventData
ThreadEventData()
Definition: Thread.cpp:164
lldb::eStopReasonFork
@ eStopReasonFork
Definition: lldb-enumerations.h:252
lldb_private::StackFrame::GetSymbolContext
const SymbolContext & GetSymbolContext(lldb::SymbolContextItem resolve_scope)
Provide a SymbolContext for this StackFrame's current pc value.
Definition: StackFrame.cpp:300
LLDBLog.h
lldb_private::Thread::m_extended_info_fetched
bool m_extended_info_fetched
Definition: Thread.h:1299
lldb_private::Thread::m_index_id
const uint32_t m_index_id
A unique 1 based index assigned to each thread for easy UI/command line access.
Definition: Thread.h:1269
lldb_private::LineEntry
Definition: LineEntry.h:20
lldb_private::ThreadPlan::TracerExplainsStop
bool TracerExplainsStop()
Definition: ThreadPlan.h:356
lldb_private::Thread::DumpUsingSettingsFormat
void DumpUsingSettingsFormat(Stream &strm, uint32_t frame_idx, bool stop_format)
Definition: Thread.cpp:1616
lldb_private::ExecutionContext::GetTargetPtr
Target * GetTargetPtr() const
Returns a pointer to the target object.
Definition: ExecutionContext.cpp:198
ExecutionContext.h
lldb::eDescriptionLevelInitial
@ eDescriptionLevelInitial
Definition: lldb-enumerations.h:211
lldb_private::Thread::m_extended_info
StructuredData::ObjectSP m_extended_info
Definition: Thread.h:1301
lldb_private::Thread::ThreadEventData
friend class ThreadEventData
Definition: Thread.h:1205
lldb_private::CompilerType::DumpTypeDescription
void DumpTypeDescription(lldb::DescriptionLevel level=lldb::eDescriptionLevelFull) const
Dump to stdout.
Definition: CompilerType.cpp:761
lldb::DescriptionLevel
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
Definition: lldb-enumerations.h:207
lldb_private::Thread::CalculateStackFrame
lldb::StackFrameSP CalculateStackFrame() override
Definition: Thread.cpp:1417
lldb_private::Thread::GetStopDescriptionRaw
std::string GetStopDescriptionRaw()
Definition: Thread.cpp:578
lldb::eOnlyThisThread
@ eOnlyThisThread
Definition: lldb-enumerations.h:135
lldb_private::CompletionRequest
Definition: CompletionRequest.h:100
lldb::tid_t
uint64_t tid_t
Definition: lldb-types.h:86
ThreadOptionValueProperties
Definition: Thread.cpp:75
lldb_private::Thread::SetSelectedFrameByIndex
bool SetSelectedFrameByIndex(uint32_t frame_idx, bool broadcast=false)
Definition: Thread.cpp:283
lldb_private::ThreadPlan::IsPlanStale
virtual bool IsPlanStale()
Definition: ThreadPlan.h:431
lldb_private::Thread::ThreadEventData::GetEventDataFromEvent
static const ThreadEventData * GetEventDataFromEvent(const Event *event_ptr)
Definition: Thread.cpp:171
lldb_private::Thread::SetShouldReportStop
void SetShouldReportStop(Vote vote)
Definition: Thread.cpp:467
lldb_private::ThreadProperties::GetLibrariesToAvoid
FileSpecList GetLibrariesToAvoid() const
Definition: Thread.cpp:117
lldb_private::Thread::GetGlobalProperties
static ThreadProperties & GetGlobalProperties()
Definition: Thread.cpp:60