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