LLDB  mainline
Thread.h
Go to the documentation of this file.
1 //===-- Thread.h ------------------------------------------------*- C++ -*-===//
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 #ifndef LLDB_TARGET_THREAD_H
10 #define LLDB_TARGET_THREAD_H
11 
12 #include <memory>
13 #include <mutex>
14 #include <string>
15 #include <vector>
16 
23 #include "lldb/Utility/Event.h"
25 #include "lldb/Utility/UserID.h"
26 #include "lldb/lldb-private.h"
27 
28 #define LLDB_THREAD_MAX_STOP_EXC_DATA 8
29 
30 namespace lldb_private {
31 
32 class ThreadPlanStack;
33 
34 class ThreadProperties : public Properties {
35 public:
36  ThreadProperties(bool is_global);
37 
38  ~ThreadProperties() override;
39 
40  /// The regular expression returned determines symbols that this
41  /// thread won't stop in during "step-in" operations.
42  ///
43  /// \return
44  /// A pointer to a regular expression to compare against symbols,
45  /// or nullptr if all symbols are allowed.
46  ///
48 
49  FileSpecList GetLibrariesToAvoid() const;
50 
51  bool GetTraceEnabledState() const;
52 
53  bool GetStepInAvoidsNoDebug() const;
54 
55  bool GetStepOutAvoidsNoDebug() const;
56 
57  uint64_t GetMaxBacktraceDepth() const;
58 };
59 
60 typedef std::shared_ptr<ThreadProperties> ThreadPropertiesSP;
61 
62 class Thread : public std::enable_shared_from_this<Thread>,
63  public ThreadProperties,
64  public UserID,
65  public ExecutionContextScope,
66  public Broadcaster {
67 public:
68  /// Broadcaster event bits definitions.
69  enum {
75  };
76 
78 
79  ConstString &GetBroadcasterClass() const override {
81  }
82 
83  class ThreadEventData : public EventData {
84  public:
85  ThreadEventData(const lldb::ThreadSP thread_sp);
86 
87  ThreadEventData(const lldb::ThreadSP thread_sp, const StackID &stack_id);
88 
90 
91  ~ThreadEventData() override;
92 
94 
95  ConstString GetFlavor() const override {
97  }
98 
99  void Dump(Stream *s) const override;
100 
101  static const ThreadEventData *GetEventDataFromEvent(const Event *event_ptr);
102 
103  static lldb::ThreadSP GetThreadFromEvent(const Event *event_ptr);
104 
105  static StackID GetStackIDFromEvent(const Event *event_ptr);
106 
107  static lldb::StackFrameSP GetStackFrameFromEvent(const Event *event_ptr);
108 
109  lldb::ThreadSP GetThread() const { return m_thread_sp; }
110 
111  StackID GetStackID() const { return m_stack_id; }
112 
113  private:
114  lldb::ThreadSP m_thread_sp;
116 
117  ThreadEventData(const ThreadEventData &) = delete;
118  const ThreadEventData &operator=(const ThreadEventData &) = delete;
119  };
120 
122  uint32_t orig_stop_id; // Dunno if I need this yet but it is an interesting
123  // bit of data.
124  lldb::StopInfoSP stop_info_sp; // You have to restore the stop info or you
125  // might continue with the wrong signals.
127  lldb::RegisterCheckpointSP
128  register_backup_sp; // You need to restore the registers, of course...
131  };
132 
133  /// Constructor
134  ///
135  /// \param [in] use_invalid_index_id
136  /// Optional parameter, defaults to false. The only subclass that
137  /// is likely to set use_invalid_index_id == true is the HistoryThread
138  /// class. In that case, the Thread we are constructing represents
139  /// a thread from earlier in the program execution. We may have the
140  /// tid of the original thread that they represent but we don't want
141  /// to reuse the IndexID of that thread, or create a new one. If a
142  /// client wants to know the original thread's IndexID, they should use
143  /// Thread::GetExtendedBacktraceOriginatingIndexID().
144  Thread(Process &process, lldb::tid_t tid, bool use_invalid_index_id = false);
145 
146  ~Thread() override;
147 
148  static void SettingsInitialize();
149 
150  static void SettingsTerminate();
151 
152  static const ThreadPropertiesSP &GetGlobalProperties();
153 
154  lldb::ProcessSP GetProcess() const { return m_process_wp.lock(); }
155 
156  int GetResumeSignal() const { return m_resume_signal; }
157 
158  void SetResumeSignal(int signal) { m_resume_signal = signal; }
159 
160  lldb::StateType GetState() const;
161 
162  void SetState(lldb::StateType state);
163 
164  /// Sets the USER resume state for this thread. If you set a thread to
165  /// suspended with
166  /// this API, it won't take part in any of the arbitration for ShouldResume,
167  /// and will stay
168  /// suspended even when other threads do get to run.
169  ///
170  /// N.B. This is not the state that is used internally by thread plans to
171  /// implement
172  /// staying on one thread while stepping over a breakpoint, etc. The is the
173  /// TemporaryResume state, and if you are implementing some bit of strategy in
174  /// the stepping
175  /// machinery you should be using that state and not the user resume state.
176  ///
177  /// If you are just preparing all threads to run, you should not override the
178  /// threads that are
179  /// marked as suspended by the debugger. In that case, pass override_suspend
180  /// = false. If you want
181  /// to force the thread to run (e.g. the "thread continue" command, or are
182  /// resetting the state
183  /// (e.g. in SBThread::Resume()), then pass true to override_suspend.
184  void SetResumeState(lldb::StateType state, bool override_suspend = false) {
185  if (m_resume_state == lldb::eStateSuspended && !override_suspend)
186  return;
187  m_resume_state = state;
188  }
189 
190  /// Gets the USER resume state for this thread. This is not the same as what
191  /// this thread is going to do for any particular step, however if this thread
192  /// returns eStateSuspended, then the process control logic will never allow
193  /// this
194  /// thread to run.
195  ///
196  /// \return
197  /// The User resume state for this thread.
199 
200  // This function is called on all the threads before "ShouldResume" and
201  // "WillResume" in case a thread needs to change its state before the
202  // ThreadList polls all the threads to figure out which ones actually will
203  // get to run and how.
204  void SetupForResume();
205 
206  // Do not override this function, it is for thread plan logic only
207  bool ShouldResume(lldb::StateType resume_state);
208 
209  // Override this to do platform specific tasks before resume.
210  virtual void WillResume(lldb::StateType resume_state) {}
211 
212  // This clears generic thread state after a resume. If you subclass this, be
213  // sure to call it.
214  virtual void DidResume();
215 
216  // This notifies the thread when a private stop occurs.
217  virtual void DidStop();
218 
219  virtual void RefreshStateAfterStop() = 0;
220 
222 
224 
226 
227  void WillStop();
228 
229  bool ShouldStop(Event *event_ptr);
230 
231  Vote ShouldReportStop(Event *event_ptr);
232 
233  Vote ShouldReportRun(Event *event_ptr);
234 
235  void Flush();
236 
237  // Return whether this thread matches the specification in ThreadSpec. This
238  // is a virtual method because at some point we may extend the thread spec
239  // with a platform specific dictionary of attributes, which then only the
240  // platform specific Thread implementation would know how to match. For now,
241  // this just calls through to the ThreadSpec's ThreadPassesBasicTests method.
242  virtual bool MatchesSpec(const ThreadSpec *spec);
243 
244  lldb::StopInfoSP GetStopInfo();
245 
247 
248  bool StopInfoIsUpToDate() const;
249 
250  // This sets the stop reason to a "blank" stop reason, so you can call
251  // functions on the thread without having the called function run with
252  // whatever stop reason you stopped with.
253  void SetStopInfoToNothing();
254 
256 
258 
260 
261  virtual const char *GetInfo() { return nullptr; }
262 
263  /// Retrieve a dictionary of information about this thread
264  ///
265  /// On Mac OS X systems there may be voucher information.
266  /// The top level dictionary returned will have an "activity" key and the
267  /// value of the activity is a dictionary. Keys in that dictionary will
268  /// be "name" and "id", among others.
269  /// There may also be "trace_messages" (an array) with each entry in that
270  /// array
271  /// being a dictionary (keys include "message" with the text of the trace
272  /// message).
277  }
278  return m_extended_info;
279  }
280 
281  virtual const char *GetName() { return nullptr; }
282 
283  virtual void SetName(const char *name) {}
284 
285  /// Whether this thread can be associated with a libdispatch queue
286  ///
287  /// The Thread may know if it is associated with a libdispatch queue,
288  /// it may know definitively that it is NOT associated with a libdispatch
289  /// queue, or it may be unknown whether it is associated with a libdispatch
290  /// queue.
291  ///
292  /// \return
293  /// eLazyBoolNo if this thread is definitely not associated with a
294  /// libdispatch queue (e.g. on a non-Darwin system where GCD aka
295  /// libdispatch is not available).
296  ///
297  /// eLazyBoolYes this thread is associated with a libdispatch queue.
298  ///
299  /// eLazyBoolCalculate this thread may be associated with a libdispatch
300  /// queue but the thread doesn't know one way or the other.
302  return eLazyBoolNo;
303  }
304 
306  lldb_private::LazyBool associated_with_libdispatch_queue) {}
307 
308  /// Retrieve the Queue ID for the queue currently using this Thread
309  ///
310  /// If this Thread is doing work on behalf of a libdispatch/GCD queue,
311  /// retrieve the QueueID.
312  ///
313  /// This is a unique identifier for the libdispatch/GCD queue in a
314  /// process. Often starting at 1 for the initial system-created
315  /// queues and incrementing, a QueueID will not be reused for a
316  /// different queue during the lifetime of a process.
317  ///
318  /// \return
319  /// A QueueID if the Thread subclass implements this, else
320  /// LLDB_INVALID_QUEUE_ID.
322 
323  virtual void SetQueueID(lldb::queue_id_t new_val) {}
324 
325  /// Retrieve the Queue name for the queue currently using this Thread
326  ///
327  /// If this Thread is doing work on behalf of a libdispatch/GCD queue,
328  /// retrieve the Queue name.
329  ///
330  /// \return
331  /// The Queue name, if the Thread subclass implements this, else
332  /// nullptr.
333  virtual const char *GetQueueName() { return nullptr; }
334 
335  virtual void SetQueueName(const char *name) {}
336 
337  /// Retrieve the Queue kind for the queue currently using this Thread
338  ///
339  /// If this Thread is doing work on behalf of a libdispatch/GCD queue,
340  /// retrieve the Queue kind - either eQueueKindSerial or
341  /// eQueueKindConcurrent, indicating that this queue processes work
342  /// items serially or concurrently.
343  ///
344  /// \return
345  /// The Queue kind, if the Thread subclass implements this, else
346  /// eQueueKindUnknown.
348 
349  virtual void SetQueueKind(lldb::QueueKind kind) {}
350 
351  /// Retrieve the Queue for this thread, if any.
352  ///
353  /// \return
354  /// A QueueSP for the queue that is currently associated with this
355  /// thread.
356  /// An empty shared pointer indicates that this thread is not
357  /// associated with a queue, or libdispatch queues are not
358  /// supported on this target.
359  virtual lldb::QueueSP GetQueue() { return lldb::QueueSP(); }
360 
361  /// Retrieve the address of the libdispatch_queue_t struct for queue
362  /// currently using this Thread
363  ///
364  /// If this Thread is doing work on behalf of a libdispatch/GCD queue,
365  /// retrieve the address of the libdispatch_queue_t structure describing
366  /// the queue.
367  ///
368  /// This address may be reused for different queues later in the Process
369  /// lifetime and should not be used to identify a queue uniquely. Use
370  /// the GetQueueID() call for that.
371  ///
372  /// \return
373  /// The Queue's libdispatch_queue_t address if the Thread subclass
374  /// implements this, else LLDB_INVALID_ADDRESS.
376  return LLDB_INVALID_ADDRESS;
377  }
378 
379  virtual void SetQueueLibdispatchQueueAddress(lldb::addr_t dispatch_queue_t) {}
380 
381  /// Whether this Thread already has all the Queue information cached or not
382  ///
383  /// A Thread may be associated with a libdispatch work Queue at a given
384  /// public stop event. If so, the thread can satisify requests like
385  /// GetQueueLibdispatchQueueAddress, GetQueueKind, GetQueueName, and
386  /// GetQueueID
387  /// either from information from the remote debug stub when it is initially
388  /// created, or it can query the SystemRuntime for that information.
389  ///
390  /// This method allows the SystemRuntime to discover if a thread has this
391  /// information already, instead of calling the thread to get the information
392  /// and having the thread call the SystemRuntime again.
393  virtual bool ThreadHasQueueInformation() const { return false; }
394 
396  return GetStackFrameList()->GetNumFrames();
397  }
398 
399  virtual lldb::StackFrameSP GetStackFrameAtIndex(uint32_t idx) {
400  return GetStackFrameList()->GetFrameAtIndex(idx);
401  }
402 
403  virtual lldb::StackFrameSP
405 
407  return GetStackFrameList()->DecrementCurrentInlinedDepth();
408  }
409 
411  return GetStackFrameList()->GetCurrentInlinedDepth();
412  }
413 
415  lldb::ValueObjectSP return_value_sp,
416  bool broadcast = false);
417 
418  Status ReturnFromFrame(lldb::StackFrameSP frame_sp,
419  lldb::ValueObjectSP return_value_sp,
420  bool broadcast = false);
421 
422  Status JumpToLine(const FileSpec &file, uint32_t line,
423  bool can_leave_function, std::string *warnings = nullptr);
424 
425  virtual lldb::StackFrameSP GetFrameWithStackID(const StackID &stack_id) {
426  if (stack_id.IsValid())
427  return GetStackFrameList()->GetFrameWithStackID(stack_id);
428  return lldb::StackFrameSP();
429  }
430 
432  return GetStackFrameList()->GetSelectedFrameIndex();
433  }
434 
435  lldb::StackFrameSP GetSelectedFrame();
436 
438  bool broadcast = false);
439 
440  bool SetSelectedFrameByIndex(uint32_t frame_idx, bool broadcast = false);
441 
443  Stream &output_stream);
444 
446  GetStackFrameList()->SetDefaultFileAndLineToSelectedFrame();
447  }
448 
449  virtual lldb::RegisterContextSP GetRegisterContext() = 0;
450 
451  virtual lldb::RegisterContextSP
453 
454  virtual void ClearStackFrames();
455 
456  virtual bool SetBackingThread(const lldb::ThreadSP &thread_sp) {
457  return false;
458  }
459 
460  virtual lldb::ThreadSP GetBackingThread() const { return lldb::ThreadSP(); }
461 
462  virtual void ClearBackingThread() {
463  // Subclasses can use this function if a thread is actually backed by
464  // another thread. This is currently used for the OperatingSystem plug-ins
465  // where they might have a thread that is in memory, yet its registers are
466  // available through the lldb_private::Thread subclass for the current
467  // lldb_private::Process class. Since each time the process stops the
468  // backing threads for memory threads can change, we need a way to clear
469  // the backing thread for all memory threads each time we stop.
470  }
471 
472  /// Dump \a count instructions of the thread's \a Trace starting at the \a
473  /// start_position position in reverse order.
474  ///
475  /// The instructions are indexed in reverse order, which means that the \a
476  /// start_position 0 represents the last instruction of the trace
477  /// chronologically.
478  ///
479  /// \param[in] s
480  /// The stream object where the instructions are printed.
481  ///
482  /// \param[in] count
483  /// The number of instructions to print.
484  ///
485  /// \param[in] start_position
486  /// The position of the first instruction to print.
487  void DumpTraceInstructions(Stream &s, size_t count,
488  size_t start_position = 0) const;
489 
490  // If stop_format is true, this will be the form used when we print stop
491  // info. If false, it will be the form we use for thread list and co.
492  void DumpUsingSettingsFormat(Stream &strm, uint32_t frame_idx,
493  bool stop_format);
494 
496  bool print_json_thread, bool print_json_stopinfo);
497 
498  /// Default implementation for stepping into.
499  ///
500  /// This function is designed to be used by commands where the
501  /// process is publicly stopped.
502  ///
503  /// \param[in] source_step
504  /// If true and the frame has debug info, then do a source level
505  /// step in, else do a single instruction step in.
506  ///
507  /// \param[in] step_in_avoids_code_without_debug_info
508  /// If \a true, then avoid stepping into code that doesn't have
509  /// debug info, else step into any code regardless of whether it
510  /// has debug info.
511  ///
512  /// \param[in] step_out_avoids_code_without_debug_info
513  /// If \a true, then if you step out to code with no debug info, keep
514  /// stepping out till you get to code with debug info.
515  ///
516  /// \return
517  /// An error that describes anything that went wrong
518  virtual Status
519  StepIn(bool source_step,
520  LazyBool step_in_avoids_code_without_debug_info = eLazyBoolCalculate,
521  LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate);
522 
523  /// Default implementation for stepping over.
524  ///
525  /// This function is designed to be used by commands where the
526  /// process is publicly stopped.
527  ///
528  /// \param[in] source_step
529  /// If true and the frame has debug info, then do a source level
530  /// step over, else do a single instruction step over.
531  ///
532  /// \return
533  /// An error that describes anything that went wrong
534  virtual Status StepOver(
535  bool source_step,
536  LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate);
537 
538  /// Default implementation for stepping out.
539  ///
540  /// This function is designed to be used by commands where the
541  /// process is publicly stopped.
542  ///
543  /// \return
544  /// An error that describes anything that went wrong
545  virtual Status StepOut();
546 
547  /// Retrieves the per-thread data area.
548  /// Most OSs maintain a per-thread pointer (e.g. the FS register on
549  /// x64), which we return the value of here.
550  ///
551  /// \return
552  /// LLDB_INVALID_ADDRESS if not supported, otherwise the thread
553  /// pointer value.
554  virtual lldb::addr_t GetThreadPointer();
555 
556  /// Retrieves the per-module TLS block for a thread.
557  ///
558  /// \param[in] module
559  /// The module to query TLS data for.
560  ///
561  /// \param[in] tls_file_addr
562  /// The thread local address in module
563  /// \return
564  /// If the thread has TLS data allocated for the
565  /// module, the address of the TLS block. Otherwise
566  /// LLDB_INVALID_ADDRESS is returned.
567  virtual lldb::addr_t GetThreadLocalData(const lldb::ModuleSP module,
568  lldb::addr_t tls_file_addr);
569 
570  /// Check whether this thread is safe to run functions
571  ///
572  /// The SystemRuntime may know of certain thread states (functions in
573  /// process of execution, for instance) which can make it unsafe for
574  /// functions to be called.
575  ///
576  /// \return
577  /// True if it is safe to call functions on this thread.
578  /// False if function calls should be avoided on this thread.
579  virtual bool SafeToCallFunctions();
580 
581  // Thread Plan Providers:
582  // This section provides the basic thread plans that the Process control
583  // machinery uses to run the target. ThreadPlan.h provides more details on
584  // how this mechanism works. The thread provides accessors to a set of plans
585  // that perform basic operations. The idea is that particular Platform
586  // plugins can override these methods to provide the implementation of these
587  // basic operations appropriate to their environment.
588  //
589  // NB: All the QueueThreadPlanXXX providers return Shared Pointers to
590  // Thread plans. This is useful so that you can modify the plans after
591  // creation in ways specific to that plan type. Also, it is often necessary
592  // for ThreadPlans that utilize other ThreadPlans to implement their task to
593  // keep a shared pointer to the sub-plan. But besides that, the shared
594  // pointers should only be held onto by entities who live no longer than the
595  // thread containing the ThreadPlan.
596  // FIXME: If this becomes a problem, we can make a version that just returns a
597  // pointer,
598  // which it is clearly unsafe to hold onto, and a shared pointer version, and
599  // only allow ThreadPlan and Co. to use the latter. That is made more
600  // annoying to do because there's no elegant way to friend a method to all
601  // sub-classes of a given class.
602  //
603 
604  /// Queues the base plan for a thread.
605  /// The version returned by Process does some things that are useful,
606  /// like handle breakpoints and signals, so if you return a plugin specific
607  /// one you probably want to call through to the Process one for anything
608  /// your plugin doesn't explicitly handle.
609  ///
610  /// \param[in] abort_other_plans
611  /// \b true if we discard the currently queued plans and replace them with
612  /// this one.
613  /// Otherwise this plan will go on the end of the plan stack.
614  ///
615  /// \return
616  /// A shared pointer to the newly queued thread plan, or nullptr if the
617  /// plan could not be queued.
618  lldb::ThreadPlanSP QueueBasePlan(bool abort_other_plans);
619 
620  /// Queues the plan used to step one instruction from the current PC of \a
621  /// thread.
622  ///
623  /// \param[in] step_over
624  /// \b true if we step over calls to functions, false if we step in.
625  ///
626  /// \param[in] abort_other_plans
627  /// \b true if we discard the currently queued plans and replace them with
628  /// this one.
629  /// Otherwise this plan will go on the end of the plan stack.
630  ///
631  /// \param[in] stop_other_threads
632  /// \b true if we will stop other threads while we single step this one.
633  ///
634  /// \param[out] status
635  /// A status with an error if queuing failed.
636  ///
637  /// \return
638  /// A shared pointer to the newly queued thread plan, or nullptr if the
639  /// plan could not be queued.
640  virtual lldb::ThreadPlanSP QueueThreadPlanForStepSingleInstruction(
641  bool step_over, bool abort_other_plans, bool stop_other_threads,
642  Status &status);
643 
644  /// Queues the plan used to step through an address range, stepping over
645  /// function calls.
646  ///
647  /// \param[in] abort_other_plans
648  /// \b true if we discard the currently queued plans and replace them with
649  /// this one.
650  /// Otherwise this plan will go on the end of the plan stack.
651  ///
652  /// \param[in] type
653  /// Type of step to do, only eStepTypeInto and eStepTypeOver are supported
654  /// by this plan.
655  ///
656  /// \param[in] range
657  /// The address range to step through.
658  ///
659  /// \param[in] addr_context
660  /// When dealing with stepping through inlined functions the current PC is
661  /// not enough information to know
662  /// what "step" means. For instance a series of nested inline functions
663  /// might start at the same address.
664  // The \a addr_context provides the current symbol context the step
665  /// is supposed to be out of.
666  // FIXME: Currently unused.
667  ///
668  /// \param[in] stop_other_threads
669  /// \b true if we will stop other threads while we single step this one.
670  ///
671  /// \param[out] status
672  /// A status with an error if queuing failed.
673  ///
674  /// \param[in] step_out_avoids_code_without_debug_info
675  /// If eLazyBoolYes, if the step over steps out it will continue to step
676  /// out till it comes to a frame with debug info.
677  /// If eLazyBoolCalculate, we will consult the default set in the thread.
678  ///
679  /// \return
680  /// A shared pointer to the newly queued thread plan, or nullptr if the
681  /// plan could not be queued.
682  virtual lldb::ThreadPlanSP QueueThreadPlanForStepOverRange(
683  bool abort_other_plans, const AddressRange &range,
684  const SymbolContext &addr_context, lldb::RunMode stop_other_threads,
685  Status &status,
686  LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate);
687 
688  // Helper function that takes a LineEntry to step, insted of an AddressRange.
689  // This may combine multiple LineEntries of the same source line number to
690  // step over a longer address range in a single operation.
691  virtual lldb::ThreadPlanSP QueueThreadPlanForStepOverRange(
692  bool abort_other_plans, const LineEntry &line_entry,
693  const SymbolContext &addr_context, lldb::RunMode stop_other_threads,
694  Status &status,
695  LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate);
696 
697  /// Queues the plan used to step through an address range, stepping into
698  /// functions.
699  ///
700  /// \param[in] abort_other_plans
701  /// \b true if we discard the currently queued plans and replace them with
702  /// this one.
703  /// Otherwise this plan will go on the end of the plan stack.
704  ///
705  /// \param[in] type
706  /// Type of step to do, only eStepTypeInto and eStepTypeOver are supported
707  /// by this plan.
708  ///
709  /// \param[in] range
710  /// The address range to step through.
711  ///
712  /// \param[in] addr_context
713  /// When dealing with stepping through inlined functions the current PC is
714  /// not enough information to know
715  /// what "step" means. For instance a series of nested inline functions
716  /// might start at the same address.
717  // The \a addr_context provides the current symbol context the step
718  /// is supposed to be out of.
719  // FIXME: Currently unused.
720  ///
721  /// \param[in] step_in_target
722  /// Name if function we are trying to step into. We will step out if we
723  /// don't land in that function.
724  ///
725  /// \param[in] stop_other_threads
726  /// \b true if we will stop other threads while we single step this one.
727  ///
728  /// \param[out] status
729  /// A status with an error if queuing failed.
730  ///
731  /// \param[in] step_in_avoids_code_without_debug_info
732  /// If eLazyBoolYes we will step out if we step into code with no debug
733  /// info.
734  /// If eLazyBoolCalculate we will consult the default set in the thread.
735  ///
736  /// \param[in] step_out_avoids_code_without_debug_info
737  /// If eLazyBoolYes, if the step over steps out it will continue to step
738  /// out till it comes to a frame with debug info.
739  /// If eLazyBoolCalculate, it will consult the default set in the thread.
740  ///
741  /// \return
742  /// A shared pointer to the newly queued thread plan, or nullptr if the
743  /// plan could not be queued.
744  virtual lldb::ThreadPlanSP QueueThreadPlanForStepInRange(
745  bool abort_other_plans, const AddressRange &range,
746  const SymbolContext &addr_context, const char *step_in_target,
747  lldb::RunMode stop_other_threads, Status &status,
748  LazyBool step_in_avoids_code_without_debug_info = eLazyBoolCalculate,
749  LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate);
750 
751  // Helper function that takes a LineEntry to step, insted of an AddressRange.
752  // This may combine multiple LineEntries of the same source line number to
753  // step over a longer address range in a single operation.
754  virtual lldb::ThreadPlanSP QueueThreadPlanForStepInRange(
755  bool abort_other_plans, const LineEntry &line_entry,
756  const SymbolContext &addr_context, const char *step_in_target,
757  lldb::RunMode stop_other_threads, Status &status,
758  LazyBool step_in_avoids_code_without_debug_info = eLazyBoolCalculate,
759  LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate);
760 
761  /// Queue the plan used to step out of the function at the current PC of
762  /// \a thread.
763  ///
764  /// \param[in] abort_other_plans
765  /// \b true if we discard the currently queued plans and replace them with
766  /// this one.
767  /// Otherwise this plan will go on the end of the plan stack.
768  ///
769  /// \param[in] addr_context
770  /// When dealing with stepping through inlined functions the current PC is
771  /// not enough information to know
772  /// what "step" means. For instance a series of nested inline functions
773  /// might start at the same address.
774  // The \a addr_context provides the current symbol context the step
775  /// is supposed to be out of.
776  // FIXME: Currently unused.
777  ///
778  /// \param[in] first_insn
779  /// \b true if this is the first instruction of a function.
780  ///
781  /// \param[in] stop_other_threads
782  /// \b true if we will stop other threads while we single step this one.
783  ///
784  /// \param[in] report_stop_vote
785  /// See standard meanings for the stop & run votes in ThreadPlan.h.
786  ///
787  /// \param[in] report_run_vote
788  /// See standard meanings for the stop & run votes in ThreadPlan.h.
789  ///
790  /// \param[out] status
791  /// A status with an error if queuing failed.
792  ///
793  /// \param[in] step_out_avoids_code_without_debug_info
794  /// If eLazyBoolYes, if the step over steps out it will continue to step
795  /// out till it comes to a frame with debug info.
796  /// If eLazyBoolCalculate, it will consult the default set in the thread.
797  ///
798  /// \return
799  /// A shared pointer to the newly queued thread plan, or nullptr if the
800  /// plan could not be queued.
801  virtual lldb::ThreadPlanSP QueueThreadPlanForStepOut(
802  bool abort_other_plans, SymbolContext *addr_context, bool first_insn,
803  bool stop_other_threads, Vote report_stop_vote, Vote report_run_vote,
804  uint32_t frame_idx, Status &status,
805  LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate);
806 
807  /// Queue the plan used to step out of the function at the current PC of
808  /// a thread. This version does not consult the should stop here callback,
809  /// and should only
810  /// be used by other thread plans when they need to retain control of the step
811  /// out.
812  ///
813  /// \param[in] abort_other_plans
814  /// \b true if we discard the currently queued plans and replace them with
815  /// this one.
816  /// Otherwise this plan will go on the end of the plan stack.
817  ///
818  /// \param[in] addr_context
819  /// When dealing with stepping through inlined functions the current PC is
820  /// not enough information to know
821  /// what "step" means. For instance a series of nested inline functions
822  /// might start at the same address.
823  // The \a addr_context provides the current symbol context the step
824  /// is supposed to be out of.
825  // FIXME: Currently unused.
826  ///
827  /// \param[in] first_insn
828  /// \b true if this is the first instruction of a function.
829  ///
830  /// \param[in] stop_other_threads
831  /// \b true if we will stop other threads while we single step this one.
832  ///
833  /// \param[in] report_stop_vote
834  /// See standard meanings for the stop & run votes in ThreadPlan.h.
835  ///
836  /// \param[in] report_run_vote
837  /// See standard meanings for the stop & run votes in ThreadPlan.h.
838  ///
839  /// \param[in] frame_idx
840  /// The fame index.
841  ///
842  /// \param[out] status
843  /// A status with an error if queuing failed.
844  ///
845  /// \param[in] continue_to_next_branch
846  /// Normally this will enqueue a plan that will put a breakpoint on the
847  /// return address and continue
848  /// to there. If continue_to_next_branch is true, this is an operation not
849  /// involving the user --
850  /// e.g. stepping "next" in a source line and we instruction stepped into
851  /// another function --
852  /// so instead of putting a breakpoint on the return address, advance the
853  /// breakpoint to the
854  /// end of the source line that is doing the call, or until the next flow
855  /// control instruction.
856  /// If the return value from the function call is to be retrieved /
857  /// displayed to the user, you must stop
858  /// on the return address. The return value may be stored in volatile
859  /// registers which are overwritten
860  /// before the next branch instruction.
861  ///
862  /// \return
863  /// A shared pointer to the newly queued thread plan, or nullptr if the
864  /// plan could not be queued.
865  virtual lldb::ThreadPlanSP QueueThreadPlanForStepOutNoShouldStop(
866  bool abort_other_plans, SymbolContext *addr_context, bool first_insn,
867  bool stop_other_threads, Vote report_stop_vote, Vote report_run_vote,
868  uint32_t frame_idx, Status &status, bool continue_to_next_branch = false);
869 
870  /// Gets the plan used to step through the code that steps from a function
871  /// call site at the current PC into the actual function call.
872  ///
873  /// \param[in] return_stack_id
874  /// The stack id that we will return to (by setting backstop breakpoints on
875  /// the return
876  /// address to that frame) if we fail to step through.
877  ///
878  /// \param[in] abort_other_plans
879  /// \b true if we discard the currently queued plans and replace them with
880  /// this one.
881  /// Otherwise this plan will go on the end of the plan stack.
882  ///
883  /// \param[in] stop_other_threads
884  /// \b true if we will stop other threads while we single step this one.
885  ///
886  /// \param[out] status
887  /// A status with an error if queuing failed.
888  ///
889  /// \return
890  /// A shared pointer to the newly queued thread plan, or nullptr if the
891  /// plan could not be queued.
892  virtual lldb::ThreadPlanSP
893  QueueThreadPlanForStepThrough(StackID &return_stack_id,
894  bool abort_other_plans, bool stop_other_threads,
895  Status &status);
896 
897  /// Gets the plan used to continue from the current PC.
898  /// This is a simple plan, mostly useful as a backstop when you are continuing
899  /// for some particular purpose.
900  ///
901  /// \param[in] abort_other_plans
902  /// \b true if we discard the currently queued plans and replace them with
903  /// this one.
904  /// Otherwise this plan will go on the end of the plan stack.
905  ///
906  /// \param[in] target_addr
907  /// The address to which we're running.
908  ///
909  /// \param[in] stop_other_threads
910  /// \b true if we will stop other threads while we single step this one.
911  ///
912  /// \param[out] status
913  /// A status with an error if queuing failed.
914  ///
915  /// \return
916  /// A shared pointer to the newly queued thread plan, or nullptr if the
917  /// plan could not be queued.
918  virtual lldb::ThreadPlanSP
919  QueueThreadPlanForRunToAddress(bool abort_other_plans, Address &target_addr,
920  bool stop_other_threads, Status &status);
921 
922  virtual lldb::ThreadPlanSP QueueThreadPlanForStepUntil(
923  bool abort_other_plans, lldb::addr_t *address_list, size_t num_addresses,
924  bool stop_others, uint32_t frame_idx, Status &status);
925 
926  virtual lldb::ThreadPlanSP
927  QueueThreadPlanForStepScripted(bool abort_other_plans, const char *class_name,
928  StructuredData::ObjectSP extra_args_sp,
929  bool stop_other_threads, Status &status);
930 
931  // Thread Plan accessors:
932 
933  /// Format the thread plan information for auto completion.
934  ///
935  /// \param[in] request
936  /// The reference to the completion handler.
937  void AutoCompleteThreadPlans(CompletionRequest &request) const;
938 
939  /// Gets the plan which will execute next on the plan stack.
940  ///
941  /// \return
942  /// A pointer to the next executed plan.
943  ThreadPlan *GetCurrentPlan() const;
944 
945  /// Unwinds the thread stack for the innermost expression plan currently
946  /// on the thread plan stack.
947  ///
948  /// \return
949  /// An error if the thread plan could not be unwound.
950 
952 
953  /// Gets the outer-most plan that was popped off the plan stack in the
954  /// most recent stop. Useful for printing the stop reason accurately.
955  ///
956  /// \return
957  /// A pointer to the last completed plan.
958  lldb::ThreadPlanSP GetCompletedPlan() const;
959 
960  /// Gets the outer-most return value from the completed plans
961  ///
962  /// \return
963  /// A ValueObjectSP, either empty if there is no return value,
964  /// or containing the return value.
965  lldb::ValueObjectSP GetReturnValueObject() const;
966 
967  /// Gets the outer-most expression variable from the completed plans
968  ///
969  /// \return
970  /// A ExpressionVariableSP, either empty if there is no
971  /// plan completed an expression during the current stop
972  /// or the expression variable that was made for the completed expression.
973  lldb::ExpressionVariableSP GetExpressionVariable() const;
974 
975  /// Checks whether the given plan is in the completed plans for this
976  /// stop.
977  ///
978  /// \param[in] plan
979  /// Pointer to the plan you're checking.
980  ///
981  /// \return
982  /// Returns true if the input plan is in the completed plan stack,
983  /// false otherwise.
984  bool IsThreadPlanDone(ThreadPlan *plan) const;
985 
986  /// Checks whether the given plan is in the discarded plans for this
987  /// stop.
988  ///
989  /// \param[in] plan
990  /// Pointer to the plan you're checking.
991  ///
992  /// \return
993  /// Returns true if the input plan is in the discarded plan stack,
994  /// false otherwise.
995  bool WasThreadPlanDiscarded(ThreadPlan *plan) const;
996 
997  /// Check if we have completed plan to override breakpoint stop reason
998  ///
999  /// \return
1000  /// Returns true if completed plan stack is not empty
1001  /// false otherwise.
1002  bool CompletedPlanOverridesBreakpoint() const;
1003 
1004  /// Queues a generic thread plan.
1005  ///
1006  /// \param[in] plan_sp
1007  /// The plan to queue.
1008  ///
1009  /// \param[in] abort_other_plans
1010  /// \b true if we discard the currently queued plans and replace them with
1011  /// this one.
1012  /// Otherwise this plan will go on the end of the plan stack.
1013  ///
1014  /// \return
1015  /// A pointer to the last completed plan.
1016  Status QueueThreadPlan(lldb::ThreadPlanSP &plan_sp, bool abort_other_plans);
1017 
1018  /// Discards the plans queued on the plan stack of the current thread. This
1019  /// is
1020  /// arbitrated by the "Master" ThreadPlans, using the "OkayToDiscard" call.
1021  // But if \a force is true, all thread plans are discarded.
1022  void DiscardThreadPlans(bool force);
1023 
1024  /// Discards the plans queued on the plan stack of the current thread up to
1025  /// and
1026  /// including up_to_plan_sp.
1027  //
1028  // \param[in] up_to_plan_sp
1029  // Discard all plans up to and including this one.
1030  void DiscardThreadPlansUpToPlan(lldb::ThreadPlanSP &up_to_plan_sp);
1031 
1032  void DiscardThreadPlansUpToPlan(ThreadPlan *up_to_plan_ptr);
1033 
1034  /// Discards the plans queued on the plan stack of the current thread up to
1035  /// and
1036  /// including the plan in that matches \a thread_index counting only
1037  /// the non-Private plans.
1038  ///
1039  /// \param[in] thread_index
1040  /// Discard all plans up to and including this user plan given by this
1041  /// index.
1042  ///
1043  /// \return
1044  /// \b true if there was a thread plan with that user index, \b false
1045  /// otherwise.
1046  bool DiscardUserThreadPlansUpToIndex(uint32_t thread_index);
1047 
1048  virtual bool CheckpointThreadState(ThreadStateCheckpoint &saved_state);
1049 
1050  virtual bool
1051  RestoreRegisterStateFromCheckpoint(ThreadStateCheckpoint &saved_state);
1052 
1053  void RestoreThreadStateFromCheckpoint(ThreadStateCheckpoint &saved_state);
1054 
1055  // Get the thread index ID. The index ID that is guaranteed to not be re-used
1056  // by a process. They start at 1 and increase with each new thread. This
1057  // allows easy command line access by a unique ID that is easier to type than
1058  // the actual system thread ID.
1059  uint32_t GetIndexID() const;
1060 
1061  // Get the originating thread's index ID.
1062  // In the case of an "extended" thread -- a thread which represents the stack
1063  // that enqueued/spawned work that is currently executing -- we need to
1064  // provide the IndexID of the thread that actually did this work. We don't
1065  // want to just masquerade as that thread's IndexID by using it in our own
1066  // IndexID because that way leads to madness - but the driver program which
1067  // is iterating over extended threads may ask for the OriginatingThreadID to
1068  // display that information to the user.
1069  // Normal threads will return the same thing as GetIndexID();
1071  return GetIndexID();
1072  }
1073 
1074  // The API ID is often the same as the Thread::GetID(), but not in all cases.
1075  // Thread::GetID() is the user visible thread ID that clients would want to
1076  // see. The API thread ID is the thread ID that is used when sending data
1077  // to/from the debugging protocol.
1078  virtual lldb::user_id_t GetProtocolID() const { return GetID(); }
1079 
1080  // lldb::ExecutionContextScope pure virtual functions
1081  lldb::TargetSP CalculateTarget() override;
1082 
1083  lldb::ProcessSP CalculateProcess() override;
1084 
1085  lldb::ThreadSP CalculateThread() override;
1086 
1087  lldb::StackFrameSP CalculateStackFrame() override;
1088 
1089  void CalculateExecutionContext(ExecutionContext &exe_ctx) override;
1090 
1091  lldb::StackFrameSP
1092  GetStackFrameSPForStackFramePtr(StackFrame *stack_frame_ptr);
1093 
1094  size_t GetStatus(Stream &strm, uint32_t start_frame, uint32_t num_frames,
1095  uint32_t num_frames_with_source, bool stop_format,
1096  bool only_stacks = false);
1097 
1098  size_t GetStackFrameStatus(Stream &strm, uint32_t first_frame,
1099  uint32_t num_frames, bool show_frame_info,
1100  uint32_t num_frames_with_source);
1101 
1102  // We need a way to verify that even though we have a thread in a shared
1103  // pointer that the object itself is still valid. Currently this won't be the
1104  // case if DestroyThread() was called. DestroyThread is called when a thread
1105  // has been removed from the Process' thread list.
1106  bool IsValid() const { return !m_destroy_called; }
1107 
1108  // Sets and returns a valid stop info based on the process stop ID and the
1109  // current thread plan. If the thread stop ID does not match the process'
1110  // stop ID, the private stop reason is not set and an invalid StopInfoSP may
1111  // be returned.
1112  //
1113  // NOTE: This function must be called before the current thread plan is
1114  // moved to the completed plan stack (in Thread::ShouldStop()).
1115  //
1116  // NOTE: If subclasses override this function, ensure they do not overwrite
1117  // the m_actual_stop_info if it is valid. The stop info may be a
1118  // "checkpointed and restored" stop info, so if it is still around it is
1119  // right even if you have not calculated this yourself, or if it disagrees
1120  // with what you might have calculated.
1121  virtual lldb::StopInfoSP GetPrivateStopInfo();
1122 
1123  // Calculate the stop info that will be shown to lldb clients. For instance,
1124  // a "step out" is implemented by running to a breakpoint on the function
1125  // return PC, so the process plugin initially sets the stop info to a
1126  // StopInfoBreakpoint. But once we've run the ShouldStop machinery, we
1127  // discover that there's a completed ThreadPlanStepOut, and that's really
1128  // the StopInfo we want to show. That will happen naturally the next
1129  // time GetStopInfo is called, but if you want to force the replacement,
1130  // you can call this.
1131 
1132  void CalculatePublicStopInfo();
1133 
1134  // Ask the thread subclass to set its stop info.
1135  //
1136  // Thread subclasses should call Thread::SetStopInfo(...) with the reason the
1137  // thread stopped.
1138  //
1139  // \return
1140  // True if Thread::SetStopInfo(...) was called, false otherwise.
1141  virtual bool CalculateStopInfo() = 0;
1142 
1143  // Gets the temporary resume state for a thread.
1144  //
1145  // This value gets set in each thread by complex debugger logic in
1146  // Thread::ShouldResume() and an appropriate thread resume state will get set
1147  // in each thread every time the process is resumed prior to calling
1148  // Process::DoResume(). The lldb_private::Process subclass should adhere to
1149  // the thread resume state request which will be one of:
1150  //
1151  // eStateRunning - thread will resume when process is resumed
1152  // eStateStepping - thread should step 1 instruction and stop when process
1153  // is resumed
1154  // eStateSuspended - thread should not execute any instructions when
1155  // process is resumed
1157  return m_temporary_resume_state;
1158  }
1159 
1160  void SetStopInfo(const lldb::StopInfoSP &stop_info_sp);
1161 
1162  void ResetStopInfo();
1163 
1164  void SetShouldReportStop(Vote vote);
1165 
1166  /// Sets the extended backtrace token for this thread
1167  ///
1168  /// Some Thread subclasses may maintain a token to help with providing
1169  /// an extended backtrace. The SystemRuntime plugin will set/request this.
1170  ///
1171  /// \param [in] token The extended backtrace token.
1172  virtual void SetExtendedBacktraceToken(uint64_t token) {}
1173 
1174  /// Gets the extended backtrace token for this thread
1175  ///
1176  /// Some Thread subclasses may maintain a token to help with providing
1177  /// an extended backtrace. The SystemRuntime plugin will set/request this.
1178  ///
1179  /// \return
1180  /// The token needed by the SystemRuntime to create an extended backtrace.
1181  /// LLDB_INVALID_ADDRESS is returned if no token is available.
1182  virtual uint64_t GetExtendedBacktraceToken() { return LLDB_INVALID_ADDRESS; }
1183 
1184  lldb::ValueObjectSP GetCurrentException();
1185 
1186  lldb::ThreadSP GetCurrentExceptionBacktrace();
1187 
1188 protected:
1189  friend class ThreadPlan;
1190  friend class ThreadList;
1191  friend class ThreadEventData;
1192  friend class StackFrameList;
1193  friend class StackFrame;
1194  friend class OperatingSystem;
1195 
1196  // This is necessary to make sure thread assets get destroyed while the
1197  // thread is still in good shape to call virtual thread methods. This must
1198  // be called by classes that derive from Thread in their destructor.
1199  virtual void DestroyThread();
1200 
1201  ThreadPlanStack &GetPlans() const;
1202 
1203  void PushPlan(lldb::ThreadPlanSP plan_sp);
1204 
1205  void PopPlan();
1206 
1207  void DiscardPlan();
1208 
1209  ThreadPlan *GetPreviousPlan(ThreadPlan *plan) const;
1210 
1211  virtual Unwind &GetUnwinder();
1212 
1213  // Check to see whether the thread is still at the last breakpoint hit that
1214  // stopped it.
1215  virtual bool IsStillAtLastBreakpointHit();
1216 
1217  // Some threads are threads that are made up by OperatingSystem plugins that
1218  // are threads that exist and are context switched out into memory. The
1219  // OperatingSystem plug-in need a ways to know if a thread is "real" or made
1220  // up.
1221  virtual bool IsOperatingSystemPluginThread() const { return false; }
1222 
1223  // Subclasses that have a way to get an extended info dictionary for this
1224  // thread should fill
1226  return StructuredData::ObjectSP();
1227  }
1228 
1229  lldb::StackFrameListSP GetStackFrameList();
1230 
1232  m_temporary_resume_state = new_state;
1233  }
1234 
1236 
1237  // Classes that inherit from Process can see and modify these
1238  lldb::ProcessWP m_process_wp; ///< The process that owns this thread.
1239  lldb::StopInfoSP m_stop_info_sp; ///< The private stop reason for this thread
1240  uint32_t m_stop_info_stop_id; // This is the stop id for which the StopInfo is
1241  // valid. Can use this so you know that
1242  // the thread's m_stop_info_sp is current and you don't have to fetch it
1243  // again
1244  uint32_t m_stop_info_override_stop_id; // The stop ID containing the last time
1245  // the stop info was checked against
1246  // the stop info override
1247  const uint32_t m_index_id; ///< A unique 1 based index assigned to each thread
1248  ///for easy UI/command line access.
1249  lldb::RegisterContextSP m_reg_context_sp; ///< The register context for this
1250  ///thread's current register state.
1251  lldb::StateType m_state; ///< The state of our process.
1252  mutable std::recursive_mutex
1253  m_state_mutex; ///< Multithreaded protection for m_state.
1254  mutable std::recursive_mutex
1255  m_frame_mutex; ///< Multithreaded protection for m_state.
1256  lldb::StackFrameListSP m_curr_frames_sp; ///< The stack frames that get lazily
1257  ///populated after a thread stops.
1258  lldb::StackFrameListSP m_prev_frames_sp; ///< The previous stack frames from
1259  ///the last time this thread stopped.
1260  int m_resume_signal; ///< The signal that should be used when continuing this
1261  ///thread.
1262  lldb::StateType m_resume_state; ///< This state is used to force a thread to
1263  ///be suspended from outside the ThreadPlan
1264  ///logic.
1265  lldb::StateType m_temporary_resume_state; ///< This state records what the
1266  ///thread was told to do by the
1267  ///thread plan logic for the current
1268  ///resume.
1269  /// It gets set in Thread::ShouldResume.
1270  std::unique_ptr<lldb_private::Unwind> m_unwinder_up;
1271  bool m_destroy_called; // This is used internally to make sure derived Thread
1272  // classes call DestroyThread.
1274  mutable std::unique_ptr<ThreadPlanStack> m_null_plan_stack_up;
1275 
1276 private:
1277  bool m_extended_info_fetched; // Have we tried to retrieve the m_extended_info
1278  // for this thread?
1279  StructuredData::ObjectSP m_extended_info; // The extended info for this thread
1280 
1281  void BroadcastSelectedFrameChange(StackID &new_frame_id);
1282 
1283  Thread(const Thread &) = delete;
1284  const Thread &operator=(const Thread &) = delete;
1285 };
1286 
1287 } // namespace lldb_private
1288 
1289 #endif // LLDB_TARGET_THREAD_H
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:1265
lldb_private::ThreadProperties
Definition: Thread.h:34
lldb_private::Thread::GetStackFrameSPForStackFramePtr
lldb::StackFrameSP GetStackFrameSPForStackFramePtr(StackFrame *stack_frame_ptr)
Definition: Thread.cpp:1660
lldb_private::Thread::DiscardThreadPlans
void DiscardThreadPlans(bool force)
Discards the plans queued on the plan stack of the current thread.
Definition: Thread.cpp:1205
lldb_private::Thread::ThreadHasQueueInformation
virtual bool ThreadHasQueueInformation() const
Whether this Thread already has all the Queue information cached or not.
Definition: Thread.h:393
lldb_private::Thread::m_state_mutex
std::recursive_mutex m_state_mutex
Multithreaded protection for m_state.
Definition: Thread.h:1253
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
lldb_private::Thread::DidResume
virtual void DidResume()
Definition: Thread.cpp:727
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:1855
lldb_private::Thread::StopInfoIsUpToDate
bool StopInfoIsUpToDate() const
Definition: Thread.cpp:419
lldb_private::Thread::eBroadcastBitThreadResumed
@ eBroadcastBitThreadResumed
Definition: Thread.h:72
lldb_private::RegularExpression
Definition: RegularExpression.h:18
lldb_private::Thread::SetResumeState
void SetResumeState(lldb::StateType state, bool override_suspend=false)
Sets the USER resume state for this thread.
Definition: Thread.h:184
lldb_private::Thread::AutoCompleteThreadPlans
void AutoCompleteThreadPlans(CompletionRequest &request) const
Format the thread plan information for auto completion.
Definition: Thread.cpp:1102
lldb_private::Thread::ThreadStateCheckpoint::stop_info_sp
lldb::StopInfoSP stop_info_sp
Definition: Thread.h:124
lldb_private::ThreadProperties::GetTraceEnabledState
bool GetTraceEnabledState() const
Definition: Thread.cpp:125
lldb_private::Thread::GetResumeSignal
int GetResumeSignal() const
Definition: Thread.h:156
lldb_private::Thread::ThreadStateCheckpoint::orig_stop_id
uint32_t orig_stop_id
Definition: Thread.h:122
lldb_private::Thread::GetIndexID
uint32_t GetIndexID() const
Definition: Thread.cpp:1388
lldb_private::Event
Definition: Event.h:180
lldb_private::Thread::GetDescription
bool GetDescription(Stream &s, lldb::DescriptionLevel level, bool print_json_thread, bool print_json_stopinfo)
Definition: Thread.cpp:1767
lldb_private::Thread::GetFrameWithStackID
virtual lldb::StackFrameSP GetFrameWithStackID(const StackID &stack_id)
Definition: Thread.h:425
lldb_private::Thread::SetupForResume
void SetupForResume()
Definition: Thread.cpp:620
lldb_private::Thread::GetGlobalProperties
static const ThreadPropertiesSP & GetGlobalProperties()
Definition: Thread.cpp:58
lldb_private::Thread::Flush
void Flush()
Definition: Thread.cpp:1868
lldb_private::Thread::m_resume_signal
int m_resume_signal
The signal that should be used when continuing this thread.
Definition: Thread.h:1260
StructuredData.h
lldb_private::Thread::ThreadStateCheckpoint::register_backup_sp
lldb::RegisterCheckpointSP register_backup_sp
Definition: Thread.h:128
lldb_private::Thread::GetUnwinder
virtual Unwind & GetUnwinder()
Definition: Thread.cpp:1862
lldb_private::Thread::ClearStackFrames
virtual void ClearStackFrames()
Definition: Thread.cpp:1418
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:1247
lldb_private::Thread::ThreadEventData::GetStackIDFromEvent
static StackID GetStackIDFromEvent(const Event *event_ptr)
Definition: Thread.cpp:188
lldb_private::Thread::GetQueueLibdispatchQueueAddress
virtual lldb::addr_t GetQueueLibdispatchQueueAddress()
Retrieve the address of the libdispatch_queue_t struct for queue currently using this Thread.
Definition: Thread.h:375
lldb_private::Thread::JumpToLine
Status JumpToLine(const FileSpec &file, uint32_t line, bool can_leave_function, std::string *warnings=nullptr)
Definition: Thread.cpp:1544
lldb_private::Thread::GetPrivateStopInfo
virtual lldb::StopInfoSP GetPrivateStopInfo()
Definition: Thread.cpp:371
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:1317
lldb_private::Thread::ClearBackingThread
virtual void ClearBackingThread()
Definition: Thread.h:462
lldb_private::UserID
Definition: UserID.h:31
lldb_private::Thread::GetExtendedBacktraceToken
virtual uint64_t GetExtendedBacktraceToken()
Gets the extended backtrace token for this thread.
Definition: Thread.h:1182
lldb_private::Thread::StepOut
virtual Status StepOut()
Default implementation for stepping out.
Definition: Thread.cpp:1963
lldb_private::Thread::GetQueueID
virtual lldb::queue_id_t GetQueueID()
Retrieve the Queue ID for the queue currently using this Thread.
Definition: Thread.h:321
lldb_private::ThreadPropertiesSP
std::shared_ptr< ThreadProperties > ThreadPropertiesSP
Definition: Thread.h:60
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:1304
lldb_private::Process
Definition: Process.h:342
lldb_private::Thread::GetSelectedFrameIndex
uint32_t GetSelectedFrameIndex()
Definition: Thread.h:431
lldb_private::EventData
Definition: Event.h:36
lldb_private::Thread::CalculateTarget
lldb::TargetSP CalculateTarget() override
Definition: Thread.cpp:1390
lldb_private::Thread::ResetStopInfo
void ResetStopInfo()
Definition: Thread.cpp:428
lldb_private::Thread::operator=
const Thread & operator=(const Thread &)=delete
lldb_private::Thread::GetStopDescription
std::string GetStopDescription()
Definition: Thread.cpp:549
lldb_private::Thread::m_destroy_called
bool m_destroy_called
Definition: Thread.h:1271
lldb_private::Thread::DecrementCurrentInlinedDepth
bool DecrementCurrentInlinedDepth()
Definition: Thread.h:406
lldb_private::Thread::UnwindInnermostExpression
Status UnwindInnermostExpression()
Unwinds the thread stack for the innermost expression plan currently on the thread plan stack.
Definition: Thread.cpp:1221
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:1180
lldb::StopReason
StopReason
Thread stop reasons.
Definition: lldb-enumerations.h:239
lldb_private::Thread::GetPreviousPlan
ThreadPlan * GetPreviousPlan(ThreadPlan *plan) const
Definition: Thread.cpp:1146
lldb_private::Thread::SelectMostRelevantFrame
void SelectMostRelevantFrame()
Definition: Thread.cpp:581
lldb_private::Thread::GetPlans
ThreadPlanStack & GetPlans() const
Definition: Thread.cpp:1053
lldb_private::Thread::ThreadEventData::Dump
void Dump(Stream *s) const override
Definition: Thread.cpp:167
lldb_private::Thread::GetCurrentPlan
ThreadPlan * GetCurrentPlan() const
Gets the plan which will execute next on the plan stack.
Definition: Thread.cpp:1118
lldb_private::Thread::m_null_plan_stack_up
std::unique_ptr< ThreadPlanStack > m_null_plan_stack_up
Definition: Thread.h:1274
lldb_private::Stream
Definition: Stream.h:28
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb_private::Thread::RestoreThreadStateFromCheckpoint
void RestoreThreadStateFromCheckpoint(ThreadStateCheckpoint &saved_state)
Definition: Thread.cpp:527
lldb_private::Thread::RestoreRegisterStateFromCheckpoint
virtual bool RestoreRegisterStateFromCheckpoint(ThreadStateCheckpoint &saved_state)
Definition: Thread.cpp:505
lldb_private::Thread::ReturnFromFrameWithIndex
Status ReturnFromFrameWithIndex(uint32_t frame_idx, lldb::ValueObjectSP return_value_sp, bool broadcast=false)
Definition: Thread.cpp:1440
lldb_private::Thread::CompletedPlanOverridesBreakpoint
bool CompletedPlanOverridesBreakpoint() const
Check if we have completed plan to override breakpoint stop reason.
Definition: Thread.cpp:1142
lldb_private::LazyBool
LazyBool
Definition: lldb-private-enumerations.h:115
lldb_private::Thread::SetDefaultFileAndLineToSelectedFrame
void SetDefaultFileAndLineToSelectedFrame()
Definition: Thread.h:445
lldb_private::Thread::GetStopReason
lldb::StopReason GetStopReason()
Definition: Thread.cpp:412
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:1256
lldb_private::Thread::SetName
virtual void SetName(const char *name)
Definition: Thread.h:283
lldb_private::SymbolContext
Definition: SymbolContext.h:33
CompletionRequest.h
lldb_private::Thread::SetQueueLibdispatchQueueAddress
virtual void SetQueueLibdispatchQueueAddress(lldb::addr_t dispatch_queue_t)
Definition: Thread.h:379
lldb_private::Thread::ShouldStop
bool ShouldStop(Event *event_ptr)
Definition: Thread.cpp:731
lldb_private::Thread::GetProtocolID
virtual lldb::user_id_t GetProtocolID() const
Definition: Thread.h:1078
lldb_private::Thread::GetResumeState
lldb::StateType GetResumeState() const
Gets the USER resume state for this thread.
Definition: Thread.h:198
lldb_private::Thread::SafeToCallFunctions
virtual bool SafeToCallFunctions()
Check whether this thread is safe to run functions.
Definition: Thread.cpp:1648
lldb_private::Thread::RunModeAsString
static std::string RunModeAsString(lldb::RunMode mode)
Definition: Thread.cpp:1701
lldb_private::Thread::GetQueue
virtual lldb::QueueSP GetQueue()
Retrieve the Queue for this thread, if any.
Definition: Thread.h:359
lldb_private::Thread::FrameSelectedCallback
void FrameSelectedCallback(lldb_private::StackFrame *frame)
Definition: Thread.cpp:319
lldb_private::Thread::GetState
lldb::StateType GetState() const
Definition: Thread.cpp:538
lldb_private::Thread::ThreadEventData::~ThreadEventData
~ThreadEventData() override
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:1122
Broadcaster.h
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:479
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:1134
lldb_private::Thread::CalculateStopInfo
virtual bool CalculateStopInfo()=0
lldb_private::Thread::BroadcastSelectedFrameChange
void BroadcastSelectedFrameChange(StackID &new_frame_id)
Definition: Thread.cpp:258
lldb_private::Thread::SettingsTerminate
static void SettingsTerminate()
Definition: Thread.cpp:1632
lldb_private::Thread::DiscardPlan
void DiscardPlan()
Definition: Thread.cpp:1093
lldb_private::Properties
Definition: UserSettingsController.h:33
lldb::queue_id_t
uint64_t queue_id_t
Definition: lldb-types.h:91
lldb_private::StackFrameList
Definition: StackFrameList.h:20
lldb_private::Thread::GetProcess
lldb::ProcessSP GetProcess() const
Definition: Thread.h:154
lldb_private::Thread::SetTemporaryResumeState
void SetTemporaryResumeState(lldb::StateType new_state)
Definition: Thread.h:1231
lldb_private::Thread::ThreadEventData::GetThreadFromEvent
static lldb::ThreadSP GetThreadFromEvent(const Event *event_ptr)
Definition: Thread.cpp:180
lldb_private::FileSpec
Definition: FileSpec.h:56
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:1894
lldb_private::Thread::ThreadEventData
Definition: Thread.h:83
lldb_private::Thread::DestroyThread
virtual void DestroyThread()
Definition: Thread.cpp:248
lldb_private::ThreadProperties::GetStepInAvoidsNoDebug
bool GetStepInAvoidsNoDebug() const
Definition: Thread.cpp:131
lldb_private::Thread::CalculateProcess
lldb::ProcessSP CalculateProcess() override
Definition: Thread.cpp:1398
lldb_private::ThreadPlan
Definition: ThreadPlan.h:282
lldb_private::Thread::GetBroadcasterClass
ConstString & GetBroadcasterClass() const override
This needs to be filled in if you are going to register the broadcaster with the broadcaster manager ...
Definition: Thread.h:79
lldb_private::Thread::m_state
lldb::StateType m_state
The state of our process.
Definition: Thread.h:1251
lldb_private::Thread::ReturnFromFrame
Status ReturnFromFrame(lldb::StackFrameSP frame_sp, lldb::ValueObjectSP return_value_sp, bool broadcast=false)
Definition: Thread.cpp:1455
lldb_private::Thread::ThreadEventData::GetStackFrameFromEvent
static lldb::StackFrameSP GetStackFrameFromEvent(const Event *event_ptr)
Definition: Thread.cpp:197
lldb_private::ExecutionContextScope
Definition: ExecutionContextScope.h:32
lldb_private::ThreadProperties::ThreadProperties
ThreadProperties(bool is_global)
Definition: Thread.cpp:99
lldb_private::Thread::RefreshStateAfterStop
virtual void RefreshStateAfterStop()=0
lldb_private::Thread
Definition: Thread.h:62
lldb_private::Thread::CreateRegisterContextForFrame
virtual lldb::RegisterContextSP CreateRegisterContextForFrame(StackFrame *frame)=0
lldb_private::Thread::FetchThreadExtendedInfo
virtual lldb_private::StructuredData::ObjectSP FetchThreadExtendedInfo()
Definition: Thread.h:1225
lldb_private::Thread::SetQueueKind
virtual void SetQueueKind(lldb::QueueKind kind)
Definition: Thread.h:349
StackFrameList.h
lldb_private::StructuredData::ObjectSP
std::shared_ptr< Object > ObjectSP
Definition: StructuredData.h:59
lldb_private::Thread::eBroadcastBitThreadSuspended
@ eBroadcastBitThreadSuspended
Definition: Thread.h:71
lldb_private::Thread::GetExpressionVariable
lldb::ExpressionVariableSP GetExpressionVariable() const
Gets the outer-most expression variable from the completed plans.
Definition: Thread.cpp:1130
lldb_private::Thread::eBroadcastBitStackChanged
@ eBroadcastBitStackChanged
Definition: Thread.h:70
lldb_private::Thread::SetAssociatedWithLibdispatchQueue
virtual void SetAssociatedWithLibdispatchQueue(lldb_private::LazyBool associated_with_libdispatch_queue)
Definition: Thread.h:305
lldb_private::ThreadList
Definition: ThreadList.h:26
lldb_private::Thread::ThreadEventData::GetFlavorString
static ConstString GetFlavorString()
Definition: Thread.cpp:151
lldb_private::ConstString
Definition: ConstString.h:40
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:1258
lldb_private::Thread::GetTemporaryResumeState
lldb::StateType GetTemporaryResumeState() const
Definition: Thread.h:1156
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:1336
lldb::eQueueKindUnknown
@ eQueueKindUnknown
Definition: lldb-enumerations.h:945
lldb_private::Thread::SetStopInfo
void SetStopInfo(const lldb::StopInfoSP &stop_info_sp)
Definition: Thread.cpp:434
lldb_private::Thread::SetStopInfoToNothing
void SetStopInfoToNothing()
Definition: Thread.cpp:467
lldb_private::AddressRange
Definition: AddressRange.h:25
lldb_private::Thread::eBroadcastBitSelectedFrameChanged
@ eBroadcastBitSelectedFrameChanged
Definition: Thread.h:73
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:1274
lldb_private::Thread::GetBackingThread
virtual lldb::ThreadSP GetBackingThread() const
Definition: Thread.h:460
lldb_private::OperatingSystem
Definition: OperatingSystem.h:27
lldb_private::Thread::GetCurrentExceptionBacktrace
lldb::ThreadSP GetCurrentExceptionBacktrace()
Definition: Thread.cpp:2003
lldb_private::Thread::GetStackFrameCount
virtual uint32_t GetStackFrameCount()
Definition: Thread.h:395
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:111
lldb_private::Thread::DumpTraceInstructions
void DumpTraceInstructions(Stream &s, size_t count, size_t start_position=0) const
Dump count instructions of the thread's Trace starting at the start_position position in reverse orde...
lldb_private::Thread::m_stop_info_override_stop_id
uint32_t m_stop_info_override_stop_id
Definition: Thread.h:1244
lldb_private::Thread::GetCurrentException
lldb::ValueObjectSP GetCurrentException()
Definition: Thread.cpp:1987
lldb_private::Thread::ShouldReportStop
Vote ShouldReportStop(Event *event_ptr)
Definition: Thread.cpp:957
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:143
lldb_private::Thread::CalculatePublicStopInfo
void CalculatePublicStopInfo()
Definition: Thread.cpp:366
lldb_private::Thread::ShouldResume
bool ShouldResume(lldb::StateType resume_state)
Definition: Thread.cpp:665
lldb_private::Thread::SetState
void SetState(lldb::StateType state)
Definition: Thread.cpp:544
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
lldb_private::Thread::ThreadStateCheckpoint::current_inlined_pc
lldb::addr_t current_inlined_pc
Definition: Thread.h:130
lldb_private::Thread::m_unwinder_up
std::unique_ptr< lldb_private::Unwind > m_unwinder_up
It gets set in Thread::ShouldResume.
Definition: Thread.h:1270
lldb_private::Thread::WillResume
virtual void WillResume(lldb::StateType resume_state)
Definition: Thread.h:210
lldb_private::Thread::SetSelectedFrame
uint32_t SetSelectedFrame(lldb_private::StackFrame *frame, bool broadcast=false)
Definition: Thread.cpp:272
LLDB_INVALID_QUEUE_ID
#define LLDB_INVALID_QUEUE_ID
Definition: lldb-defines.h:100
lldb_private::Thread::ThreadEventData::GetFlavor
ConstString GetFlavor() const override
Definition: Thread.h:95
lldb_private::ThreadProperties::GetStepOutAvoidsNoDebug
bool GetStepOutAvoidsNoDebug() const
Definition: Thread.cpp:137
lldb_private::Thread::ThreadStateCheckpoint::current_inlined_depth
uint32_t current_inlined_depth
Definition: Thread.h:129
lldb_private::Thread::m_stop_info_stop_id
uint32_t m_stop_info_stop_id
Definition: Thread.h:1240
lldb_private::Thread::GetThreadPointer
virtual lldb::addr_t GetThreadPointer()
Retrieves the per-thread data area.
Definition: Thread.cpp:1634
lldb_private::ThreadSpec
Definition: ThreadSpec.h:33
lldb_private::Thread::SetSelectedFrameByIndexNoisily
bool SetSelectedFrameByIndexNoisily(uint32_t frame_idx, Stream &output_stream)
Definition: Thread.cpp:293
Event.h
UserID.h
lldb_private::Thread::GetFrameWithConcreteFrameIndex
virtual lldb::StackFrameSP GetFrameWithConcreteFrameIndex(uint32_t unwind_idx)
Definition: Thread.cpp:1436
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:109
lldb_private::Thread::CalculateExecutionContext
void CalculateExecutionContext(ExecutionContext &exe_ctx) override
Reconstruct the object's execution context into sc.
Definition: Thread.cpp:1404
lldb-private.h
lldb_private::Thread::ThreadEventData::m_stack_id
StackID m_stack_id
Definition: Thread.h:115
lldb_private::Thread::m_stop_info_sp
lldb::StopInfoSP m_stop_info_sp
The private stop reason for this thread.
Definition: Thread.h:1239
lldb_private::Thread::SettingsInitialize
static void SettingsInitialize()
Definition: Thread.cpp:1630
lldb_private::Thread::GetAssociatedWithLibdispatchQueue
virtual lldb_private::LazyBool GetAssociatedWithLibdispatchQueue()
Whether this thread can be associated with a libdispatch queue.
Definition: Thread.h:301
lldb_private::Thread::QueueBasePlan
lldb::ThreadPlanSP QueueBasePlan(bool abort_other_plans)
Queues the base plan for a thread.
Definition: Thread.cpp:1232
lldb_private::Thread::CalculateThread
lldb::ThreadSP CalculateThread() override
Definition: Thread.cpp:1400
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:1714
lldb_private::Thread::GetInfo
virtual const char * GetInfo()
Definition: Thread.h:261
lldb_private::Thread::IsStillAtLastBreakpointHit
virtual bool IsStillAtLastBreakpointHit()
Definition: Thread.cpp:1873
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:1192
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
lldb_private::Thread::GetStopInfo
lldb::StopInfoSP GetStopInfo()
Definition: Thread.cpp:333
lldb_private::Thread::ShouldReportRun
Vote ShouldReportRun(Event *event_ptr)
Definition: Thread.cpp:1018
lldb_private::Thread::PopPlan
void PopPlan()
Definition: Thread.cpp:1084
lldb_private::Thread::GetStackFrameList
lldb::StackFrameListSP GetStackFrameList()
Definition: Thread.cpp:1408
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:1238
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:1249
lldb_private::Thread::m_frame_mutex
std::recursive_mutex m_frame_mutex
Multithreaded protection for m_state.
Definition: Thread.h:1255
lldb_private::Thread::PushPlan
void PushPlan(lldb::ThreadPlanSP plan_sp)
Definition: Thread.cpp:1069
uint32_t
lldb_private::eLazyBoolNo
@ eLazyBoolNo
Definition: lldb-private-enumerations.h:115
lldb_private::Thread::~Thread
~Thread() override
Definition: Thread.cpp:239
UserSettingsController.h
RegisterCheckpoint.h
lldb_private::Thread::GetStaticBroadcasterClass
static ConstString & GetStaticBroadcasterClass()
Definition: Thread.cpp:212
lldb_private::Address
Definition: Address.h:59
lldb_private::Thread::DidStop
virtual void DidStop()
Definition: Thread.cpp:729
lldb_private::Thread::QueueThreadPlan
Status QueueThreadPlan(lldb::ThreadPlanSP &plan_sp, bool abort_other_plans)
Queues a generic thread plan.
Definition: Thread.cpp:1150
lldb_private::Thread::ThreadEventData::GetStackID
StackID GetStackID() const
Definition: Thread.h:111
ExecutionContextScope.h
lldb_private::Thread::IsOperatingSystemPluginThread
virtual bool IsOperatingSystemPluginThread() const
Definition: Thread.h:1221
lldb_private::Thread::GetReturnValueObject
lldb::ValueObjectSP GetReturnValueObject() const
Gets the outer-most return value from the completed plans.
Definition: Thread.cpp:1126
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:1349
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:1360
lldb_private::Thread::GetSelectedFrame
lldb::StackFrameSP GetSelectedFrame()
Definition: Thread.cpp:264
lldb_private::ThreadProperties::~ThreadProperties
~ThreadProperties() override
lldb_private::Vote
Vote
Definition: lldb-private-enumerations.h:59
lldb_private::Thread::ThreadStateCheckpoint
Definition: Thread.h:121
LLDB_INVALID_ADDRESS
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:86
lldb_private::Thread::MatchesSpec
virtual bool MatchesSpec(const ThreadSpec *spec)
Definition: Thread.cpp:1049
lldb_private::Thread::eBroadcastBitThreadSelected
@ eBroadcastBitThreadSelected
Definition: Thread.h:74
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:1138
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:1636
lldb_private::ThreadPlanStack
Definition: ThreadPlanStack.h:31
lldb::user_id_t
uint64_t user_id_t
Definition: lldb-types.h:84
lldb_private::Thread::m_override_should_notify
LazyBool m_override_should_notify
Definition: Thread.h:1273
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
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:217
lldb_private::Thread::ThreadStoppedForAReason
bool ThreadStoppedForAReason()
Definition: Thread.cpp:475
lldb_private::Thread::IsValid
bool IsValid() const
Definition: Thread.h:1106
lldb_private::StackID::IsValid
bool IsValid() const
Definition: StackID.h:49
lldb_private::Thread::ThreadEventData::m_thread_sp
lldb::ThreadSP m_thread_sp
Definition: Thread.h:114
lldb_private::Thread::ThreadStateCheckpoint::m_completed_plan_checkpoint
size_t m_completed_plan_checkpoint
Definition: Thread.h:126
lldb_private::Thread::GetQueueKind
virtual lldb::QueueKind GetQueueKind()
Retrieve the Queue kind for the queue currently using this Thread.
Definition: Thread.h:347
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:1370
lldb_private::StackID
Definition: StackID.h:17
lldb_private::Thread::SetQueueID
virtual void SetQueueID(lldb::queue_id_t new_val)
Definition: Thread.h:323
lldb_private::Thread::SetBackingThread
virtual bool SetBackingThread(const lldb::ThreadSP &thread_sp)
Definition: Thread.h:456
lldb::StateType
StateType
Process and Thread States.
Definition: lldb-enumerations.h:73
lldb_private::Thread::StopReasonAsString
static std::string StopReasonAsString(lldb::StopReason reason)
Definition: Thread.cpp:1664
lldb_private::Thread::WillStop
void WillStop()
Definition: Thread.cpp:606
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:1262
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:1238
lldb_private::Thread::ThreadEventData::operator=
const ThreadEventData & operator=(const ThreadEventData &)=delete
lldb_private::Thread::GetRegisterContext
virtual lldb::RegisterContextSP GetRegisterContext()=0
lldb_private::Broadcaster
Definition: Broadcaster.h:242
lldb_private::StackFrame
Definition: StackFrame.h:40
lldb_private::Unwind
Definition: Unwind.h:18
lldb_private::Thread::SetResumeSignal
void SetResumeSignal(int signal)
Definition: Thread.h:158
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:1930
lldb_private::Thread::ThreadEventData::ThreadEventData
ThreadEventData()
Definition: Thread.cpp:163
lldb::QueueKind
QueueKind
Queue type.
Definition: lldb-enumerations.h:944
lldb_private::Thread::m_extended_info_fetched
bool m_extended_info_fetched
Definition: Thread.h:1277
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:1247
lldb_private::LineEntry
Definition: LineEntry.h:20
lldb_private::Thread::SetExtendedBacktraceToken
virtual void SetExtendedBacktraceToken(uint64_t token)
Sets the extended backtrace token for this thread.
Definition: Thread.h:1172
lldb_private::Thread::SetQueueName
virtual void SetQueueName(const char *name)
Definition: Thread.h:335
lldb_private::Thread::DumpUsingSettingsFormat
void DumpUsingSettingsFormat(Stream &strm, uint32_t frame_idx, bool stop_format)
Definition: Thread.cpp:1601
lldb_private::Thread::m_extended_info
StructuredData::ObjectSP m_extended_info
Definition: Thread.h:1279
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:1402
lldb_private::Thread::GetStopDescriptionRaw
std::string GetStopDescriptionRaw()
Definition: Thread.cpp:569
lldb_private::Thread::GetQueueName
virtual const char * GetQueueName()
Retrieve the Queue name for the queue currently using this Thread.
Definition: Thread.h:333
lldb_private::CompletionRequest
Definition: CompletionRequest.h:100
lldb_private::Thread::GetExtendedBacktraceOriginatingIndexID
virtual uint32_t GetExtendedBacktraceOriginatingIndexID()
Definition: Thread.h:1070
lldb::tid_t
uint64_t tid_t
Definition: lldb-types.h:86
lldb_private::Thread::SetSelectedFrameByIndex
bool SetSelectedFrameByIndex(uint32_t frame_idx, bool broadcast=false)
Definition: Thread.cpp:281
lldb_private::Thread::ThreadEventData::GetEventDataFromEvent
static const ThreadEventData * GetEventDataFromEvent(const Event *event_ptr)
Definition: Thread.cpp:170
lldb_private::Thread::SetShouldReportStop
void SetShouldReportStop(Vote vote)
Definition: Thread.cpp:456
lldb_private::ThreadProperties::GetLibrariesToAvoid
FileSpecList GetLibrariesToAvoid() const
Definition: Thread.cpp:116