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