Thread.h revision 36de3c01c2f3ceac59b8e34b47c17fac200e27a1
1//===-- Thread.h ------------------------------------------------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef liblldb_Thread_h_
11#define liblldb_Thread_h_
12
13#include "lldb/lldb-private.h"
14#include "lldb/Host/Mutex.h"
15#include "lldb/Core/UserID.h"
16#include "lldb/Core/UserSettingsController.h"
17#include "lldb/Target/ExecutionContextScope.h"
18#include "lldb/Target/StackFrameList.h"
19
20#define LLDB_THREAD_MAX_STOP_EXC_DATA 8
21
22namespace lldb_private {
23
24class ThreadProperties : public Properties
25{
26public:
27    ThreadProperties(bool is_global);
28
29    virtual
30    ~ThreadProperties();
31
32    //------------------------------------------------------------------
33    /// The regular expression returned determines symbols that this
34    /// thread won't stop in during "step-in" operations.
35    ///
36    /// @return
37    ///    A pointer to a regular expression to compare against symbols,
38    ///    or NULL if all symbols are allowed.
39    ///
40    //------------------------------------------------------------------
41    const RegularExpression *
42    GetSymbolsToAvoidRegexp();
43
44    bool
45    GetTraceEnabledState() const;
46};
47
48typedef STD_SHARED_PTR(ThreadProperties) ThreadPropertiesSP;
49
50
51class Thread :
52    public STD_ENABLE_SHARED_FROM_THIS(Thread),
53    public ThreadProperties,
54    public UserID,
55    public ExecutionContextScope
56{
57public:
58    // TODO: You shouldn't just checkpoint the register state alone, so this should get
59    // moved to protected.  To do that ThreadStateCheckpoint needs to be returned as a token...
60    class RegisterCheckpoint
61    {
62    public:
63
64        RegisterCheckpoint() :
65            m_stack_id (),
66            m_data_sp ()
67        {
68        }
69
70        RegisterCheckpoint (const StackID &stack_id) :
71            m_stack_id (stack_id),
72            m_data_sp ()
73        {
74        }
75
76        ~RegisterCheckpoint()
77        {
78        }
79
80        const RegisterCheckpoint&
81        operator= (const RegisterCheckpoint &rhs)
82        {
83            if (this != &rhs)
84            {
85                this->m_stack_id = rhs.m_stack_id;
86                this->m_data_sp  = rhs.m_data_sp;
87            }
88            return *this;
89        }
90
91        RegisterCheckpoint (const RegisterCheckpoint &rhs) :
92            m_stack_id (rhs.m_stack_id),
93            m_data_sp (rhs.m_data_sp)
94        {
95        }
96
97        const StackID &
98        GetStackID()
99        {
100            return m_stack_id;
101        }
102
103        void
104        SetStackID (const StackID &stack_id)
105        {
106            m_stack_id = stack_id;
107        }
108
109        lldb::DataBufferSP &
110        GetData()
111        {
112            return m_data_sp;
113        }
114
115        const lldb::DataBufferSP &
116        GetData() const
117        {
118            return m_data_sp;
119        }
120
121    protected:
122        StackID m_stack_id;
123        lldb::DataBufferSP m_data_sp;
124    };
125
126    struct ThreadStateCheckpoint
127    {
128        uint32_t           orig_stop_id;  // Dunno if I need this yet but it is an interesting bit of data.
129        lldb::StopInfoSP   stop_info_sp;  // You have to restore the stop info or you might continue with the wrong signals.
130        RegisterCheckpoint register_backup;  // You need to restore the registers, of course...
131        uint32_t           current_inlined_depth;
132        lldb::addr_t       current_inlined_pc;
133    };
134
135    static void
136    SettingsInitialize ();
137
138    static void
139    SettingsTerminate ();
140
141    static const ThreadPropertiesSP &
142    GetGlobalProperties();
143
144    Thread (const lldb::ProcessSP &process_sp, lldb::tid_t tid);
145    virtual ~Thread();
146
147    lldb::ProcessSP
148    GetProcess() const
149    {
150        return m_process_wp.lock();
151    }
152
153    int
154    GetResumeSignal () const
155    {
156        return m_resume_signal;
157    }
158
159    void
160    SetResumeSignal (int signal)
161    {
162        m_resume_signal = signal;
163    }
164
165    lldb::StateType
166    GetState() const;
167
168    void
169    SetState (lldb::StateType state);
170
171    lldb::StateType
172    GetResumeState () const
173    {
174        return m_resume_state;
175    }
176
177    void
178    SetResumeState (lldb::StateType state)
179    {
180        m_resume_state = state;
181    }
182
183    // This function is called on all the threads before "WillResume" in case
184    // a thread needs to change its state before the ThreadList polls all the
185    // threads to figure out which ones actually will get to run and how.
186    void
187    SetupForResume ();
188
189    // Override this to do platform specific tasks before resume, but always
190    // call the Thread::WillResume at the end of your work.
191
192    virtual bool
193    WillResume (lldb::StateType resume_state);
194
195    // This clears generic thread state after a resume.  If you subclass this,
196    // be sure to call it.
197    virtual void
198    DidResume ();
199
200    virtual void
201    RefreshStateAfterStop() = 0;
202
203    void
204    WillStop ();
205
206    bool
207    ShouldStop (Event *event_ptr);
208
209    Vote
210    ShouldReportStop (Event *event_ptr);
211
212    Vote
213    ShouldReportRun (Event *event_ptr);
214
215    void
216    Flush ();
217
218    // Return whether this thread matches the specification in ThreadSpec.  This is a virtual
219    // method because at some point we may extend the thread spec with a platform specific
220    // dictionary of attributes, which then only the platform specific Thread implementation
221    // would know how to match.  For now, this just calls through to the ThreadSpec's
222    // ThreadPassesBasicTests method.
223    virtual bool
224    MatchesSpec (const ThreadSpec *spec);
225
226    lldb::StopInfoSP
227    GetStopInfo ();
228
229    // This sets the stop reason to a "blank" stop reason, so you can call functions on the thread
230    // without having the called function run with whatever stop reason you stopped with.
231    void
232    SetStopInfoToNothing();
233
234    bool
235    ThreadStoppedForAReason ();
236
237    static const char *
238    RunModeAsCString (lldb::RunMode mode);
239
240    static const char *
241    StopReasonAsCString (lldb::StopReason reason);
242
243    virtual const char *
244    GetInfo ()
245    {
246        return NULL;
247    }
248
249    virtual const char *
250    GetName ()
251    {
252        return NULL;
253    }
254
255    virtual const char *
256    GetQueueName ()
257    {
258        return NULL;
259    }
260
261    virtual uint32_t
262    GetStackFrameCount()
263    {
264        return GetStackFrameList()->GetNumFrames();
265    }
266
267    virtual lldb::StackFrameSP
268    GetStackFrameAtIndex (uint32_t idx)
269    {
270        return GetStackFrameList()->GetFrameAtIndex(idx);
271    }
272
273    virtual lldb::StackFrameSP
274    GetFrameWithConcreteFrameIndex (uint32_t unwind_idx);
275
276    bool
277    DecrementCurrentInlinedDepth()
278    {
279        return GetStackFrameList()->DecrementCurrentInlinedDepth();
280    }
281
282    uint32_t
283    GetCurrentInlinedDepth()
284    {
285        return GetStackFrameList()->GetCurrentInlinedDepth();
286    }
287
288    virtual lldb::StackFrameSP
289    GetFrameWithStackID (const StackID &stack_id)
290    {
291        return GetStackFrameList()->GetFrameWithStackID (stack_id);
292    }
293
294    uint32_t
295    GetSelectedFrameIndex ()
296    {
297        return GetStackFrameList()->GetSelectedFrameIndex();
298    }
299
300    lldb::StackFrameSP
301    GetSelectedFrame ()
302    {
303        lldb::StackFrameListSP stack_frame_list_sp(GetStackFrameList());
304        return stack_frame_list_sp->GetFrameAtIndex (stack_frame_list_sp->GetSelectedFrameIndex());
305    }
306
307    uint32_t
308    SetSelectedFrame (lldb_private::StackFrame *frame)
309    {
310        return GetStackFrameList()->SetSelectedFrame(frame);
311    }
312
313    bool
314    SetSelectedFrameByIndex (uint32_t frame_idx)
315    {
316        return GetStackFrameList()->SetSelectedFrameByIndex(frame_idx);
317    }
318
319    void
320    SetDefaultFileAndLineToSelectedFrame()
321    {
322        GetStackFrameList()->SetDefaultFileAndLineToSelectedFrame();
323    }
324
325    virtual lldb::RegisterContextSP
326    GetRegisterContext () = 0;
327
328    virtual lldb::RegisterContextSP
329    CreateRegisterContextForFrame (StackFrame *frame) = 0;
330
331    virtual void
332    ClearStackFrames ();
333
334    void
335    DumpUsingSettingsFormat (Stream &strm, uint32_t frame_idx);
336
337    //------------------------------------------------------------------
338    // Thread Plan Providers:
339    // This section provides the basic thread plans that the Process control
340    // machinery uses to run the target.  ThreadPlan.h provides more details on
341    // how this mechanism works.
342    // The thread provides accessors to a set of plans that perform basic operations.
343    // The idea is that particular Platform plugins can override these methods to
344    // provide the implementation of these basic operations appropriate to their
345    // environment.
346    //------------------------------------------------------------------
347
348    //------------------------------------------------------------------
349    /// Queues the base plan for a thread.
350    /// The version returned by Process does some things that are useful,
351    /// like handle breakpoints and signals, so if you return a plugin specific
352    /// one you probably want to call through to the Process one for anything
353    /// your plugin doesn't explicitly handle.
354    ///
355    /// @param[in] abort_other_plans
356    ///    \b true if we discard the currently queued plans and replace them with this one.
357    ///    Otherwise this plan will go on the end of the plan stack.
358    ///
359    /// @return
360    ///     A pointer to the newly queued thread plan, or NULL if the plan could not be queued.
361    //------------------------------------------------------------------
362    virtual ThreadPlan *
363    QueueFundamentalPlan (bool abort_other_plans);
364
365    //------------------------------------------------------------------
366    /// Queues the plan used to step over a breakpoint at the current PC of \a thread.
367    /// The default version returned by Process handles trap based breakpoints, and
368    /// will disable the breakpoint, single step over it, then re-enable it.
369    ///
370    /// @param[in] abort_other_plans
371    ///    \b true if we discard the currently queued plans and replace them with this one.
372    ///    Otherwise this plan will go on the end of the plan stack.
373    ///
374    /// @return
375    ///     A pointer to the newly queued thread plan, or NULL if the plan could not be queued.
376    //------------------------------------------------------------------
377    virtual ThreadPlan *
378    QueueThreadPlanForStepOverBreakpointPlan (bool abort_other_plans);
379
380    //------------------------------------------------------------------
381    /// Queues the plan used to step one instruction from the current PC of \a thread.
382    ///
383    /// @param[in] step_over
384    ///    \b true if we step over calls to functions, false if we step in.
385    ///
386    /// @param[in] abort_other_plans
387    ///    \b true if we discard the currently queued plans and replace them with this one.
388    ///    Otherwise this plan will go on the end of the plan stack.
389    ///
390    /// @param[in] stop_other_threads
391    ///    \b true if we will stop other threads while we single step this one.
392    ///
393    /// @return
394    ///     A pointer to the newly queued thread plan, or NULL if the plan could not be queued.
395    //------------------------------------------------------------------
396    virtual ThreadPlan *
397    QueueThreadPlanForStepSingleInstruction (bool step_over,
398                                             bool abort_other_plans,
399                                             bool stop_other_threads);
400
401    //------------------------------------------------------------------
402    /// Queues the plan used to step through an address range, stepping into or over
403    /// function calls depending on the value of StepType.
404    ///
405    /// @param[in] abort_other_plans
406    ///    \b true if we discard the currently queued plans and replace them with this one.
407    ///    Otherwise this plan will go on the end of the plan stack.
408    ///
409    /// @param[in] type
410    ///    Type of step to do, only eStepTypeInto and eStepTypeOver are supported by this plan.
411    ///
412    /// @param[in] range
413    ///    The address range to step through.
414    ///
415    /// @param[in] addr_context
416    ///    When dealing with stepping through inlined functions the current PC is not enough information to know
417    ///    what "step" means.  For instance a series of nested inline functions might start at the same address.
418    //     The \a addr_context provides the current symbol context the step
419    ///    is supposed to be out of.
420    //   FIXME: Currently unused.
421    ///
422    /// @param[in] stop_other_threads
423    ///    \b true if we will stop other threads while we single step this one.
424    ///
425    /// @return
426    ///     A pointer to the newly queued thread plan, or NULL if the plan could not be queued.
427    //------------------------------------------------------------------
428    virtual ThreadPlan *
429    QueueThreadPlanForStepRange (bool abort_other_plans,
430                                 StepType type,
431                                 const AddressRange &range,
432                                 const SymbolContext &addr_context,
433                                 lldb::RunMode stop_other_threads,
434                                 bool avoid_code_without_debug_info);
435
436    //------------------------------------------------------------------
437    /// Queue the plan used to step out of the function at the current PC of
438    /// \a thread.
439    ///
440    /// @param[in] abort_other_plans
441    ///    \b true if we discard the currently queued plans and replace them with this one.
442    ///    Otherwise this plan will go on the end of the plan stack.
443    ///
444    /// @param[in] addr_context
445    ///    When dealing with stepping through inlined functions the current PC is not enough information to know
446    ///    what "step" means.  For instance a series of nested inline functions might start at the same address.
447    //     The \a addr_context provides the current symbol context the step
448    ///    is supposed to be out of.
449    //   FIXME: Currently unused.
450    ///
451    /// @param[in] first_insn
452    ///     \b true if this is the first instruction of a function.
453    ///
454    /// @param[in] stop_other_threads
455    ///    \b true if we will stop other threads while we single step this one.
456    ///
457    /// @param[in] stop_vote
458    /// @param[in] run_vote
459    ///    See standard meanings for the stop & run votes in ThreadPlan.h.
460    ///
461    /// @return
462    ///     A pointer to the newly queued thread plan, or NULL if the plan could not be queued.
463    //------------------------------------------------------------------
464    virtual ThreadPlan *
465    QueueThreadPlanForStepOut (bool abort_other_plans,
466                               SymbolContext *addr_context,
467                               bool first_insn,
468                               bool stop_other_threads,
469                               Vote stop_vote, // = eVoteYes,
470                               Vote run_vote, // = eVoteNoOpinion);
471                               uint32_t frame_idx);
472
473    //------------------------------------------------------------------
474    /// Gets the plan used to step through the code that steps from a function
475    /// call site at the current PC into the actual function call.
476    ///
477    ///
478    /// @param[in] return_stack_id
479    ///    The stack id that we will return to (by setting backstop breakpoints on the return
480    ///    address to that frame) if we fail to step through.
481    ///
482    /// @param[in] abort_other_plans
483    ///    \b true if we discard the currently queued plans and replace them with this one.
484    ///    Otherwise this plan will go on the end of the plan stack.
485    ///
486    /// @param[in] stop_other_threads
487    ///    \b true if we will stop other threads while we single step this one.
488    ///
489    /// @return
490    ///     A pointer to the newly queued thread plan, or NULL if the plan could not be queued.
491    //------------------------------------------------------------------
492    virtual ThreadPlan *
493    QueueThreadPlanForStepThrough (StackID &return_stack_id,
494                                   bool abort_other_plans,
495                                   bool stop_other_threads);
496
497    //------------------------------------------------------------------
498    /// Gets the plan used to continue from the current PC.
499    /// This is a simple plan, mostly useful as a backstop when you are continuing
500    /// for some particular purpose.
501    ///
502    /// @param[in] abort_other_plans
503    ///    \b true if we discard the currently queued plans and replace them with this one.
504    ///    Otherwise this plan will go on the end of the plan stack.
505    ///
506    /// @param[in] target_addr
507    ///    The address to which we're running.
508    ///
509    /// @param[in] stop_other_threads
510    ///    \b true if we will stop other threads while we single step this one.
511    ///
512    /// @return
513    ///     A pointer to the newly queued thread plan, or NULL if the plan could not be queued.
514    //------------------------------------------------------------------
515    virtual ThreadPlan *
516    QueueThreadPlanForRunToAddress (bool abort_other_plans,
517                                    Address &target_addr,
518                                    bool stop_other_threads);
519
520    virtual ThreadPlan *
521    QueueThreadPlanForStepUntil (bool abort_other_plans,
522                                 lldb::addr_t *address_list,
523                                 size_t num_addresses,
524                                 bool stop_others,
525                                 uint32_t frame_idx);
526
527    virtual ThreadPlan *
528    QueueThreadPlanForCallFunction (bool abort_other_plans,
529                                    Address& function,
530                                    lldb::addr_t arg,
531                                    bool stop_other_threads,
532                                    bool discard_on_error = false);
533
534    //------------------------------------------------------------------
535    // Thread Plan accessors:
536    //------------------------------------------------------------------
537
538    //------------------------------------------------------------------
539    /// Gets the plan which will execute next on the plan stack.
540    ///
541    /// @return
542    ///     A pointer to the next executed plan.
543    //------------------------------------------------------------------
544    ThreadPlan *
545    GetCurrentPlan ();
546
547private:
548    bool
549    PlanIsBasePlan (ThreadPlan *plan_ptr);
550
551public:
552
553    //------------------------------------------------------------------
554    /// Gets the outer-most plan that was popped off the plan stack in the
555    /// most recent stop.  Useful for printing the stop reason accurately.
556    ///
557    /// @return
558    ///     A pointer to the last completed plan.
559    //------------------------------------------------------------------
560    lldb::ThreadPlanSP
561    GetCompletedPlan ();
562
563    //------------------------------------------------------------------
564    /// Gets the outer-most return value from the completed plans
565    ///
566    /// @return
567    ///     A ValueObjectSP, either empty if there is no return value,
568    ///     or containing the return value.
569    //------------------------------------------------------------------
570    lldb::ValueObjectSP
571    GetReturnValueObject ();
572
573    //------------------------------------------------------------------
574    ///  Checks whether the given plan is in the completed plans for this
575    ///  stop.
576    ///
577    /// @param[in] plan
578    ///     Pointer to the plan you're checking.
579    ///
580    /// @return
581    ///     Returns true if the input plan is in the completed plan stack,
582    ///     false otherwise.
583    //------------------------------------------------------------------
584    bool
585    IsThreadPlanDone (ThreadPlan *plan);
586
587    //------------------------------------------------------------------
588    ///  Checks whether the given plan is in the discarded plans for this
589    ///  stop.
590    ///
591    /// @param[in] plan
592    ///     Pointer to the plan you're checking.
593    ///
594    /// @return
595    ///     Returns true if the input plan is in the discarded plan stack,
596    ///     false otherwise.
597    //------------------------------------------------------------------
598    bool
599    WasThreadPlanDiscarded (ThreadPlan *plan);
600
601    //------------------------------------------------------------------
602    /// Queues a generic thread plan.
603    ///
604    /// @param[in] plan_sp
605    ///    The plan to queue.
606    ///
607    /// @param[in] abort_other_plans
608    ///    \b true if we discard the currently queued plans and replace them with this one.
609    ///    Otherwise this plan will go on the end of the plan stack.
610    ///
611    /// @return
612    ///     A pointer to the last completed plan.
613    //------------------------------------------------------------------
614    void
615    QueueThreadPlan (lldb::ThreadPlanSP &plan_sp, bool abort_other_plans);
616
617
618    //------------------------------------------------------------------
619    /// Discards the plans queued on the plan stack of the current thread.  This is
620    /// arbitrated by the "Master" ThreadPlans, using the "OkayToDiscard" call.
621    //  But if \a force is true, all thread plans are discarded.
622    //------------------------------------------------------------------
623    void
624    DiscardThreadPlans (bool force);
625
626    //------------------------------------------------------------------
627    /// Discards the plans queued on the plan stack of the current thread up to and
628    /// including up_to_plan_sp.
629    //
630    // @param[in] up_to_plan_sp
631    //   Discard all plans up to and including this one.
632    //------------------------------------------------------------------
633    void
634    DiscardThreadPlansUpToPlan (lldb::ThreadPlanSP &up_to_plan_sp);
635
636    void
637    DiscardThreadPlansUpToPlan (ThreadPlan *up_to_plan_ptr);
638
639    //------------------------------------------------------------------
640    /// Prints the current plan stack.
641    ///
642    /// @param[in] s
643    ///    The stream to which to dump the plan stack info.
644    ///
645    //------------------------------------------------------------------
646    void
647    DumpThreadPlans (Stream *s) const;
648
649    virtual bool
650    CheckpointThreadState (ThreadStateCheckpoint &saved_state);
651
652    virtual bool
653    RestoreThreadStateFromCheckpoint (ThreadStateCheckpoint &saved_state);
654
655    void
656    EnableTracer (bool value, bool single_step);
657
658    void
659    SetTracer (lldb::ThreadPlanTracerSP &tracer_sp);
660
661    // Get the thread index ID. The index ID that is guaranteed to not be
662    // re-used by a process. They start at 1 and increase with each new thread.
663    // This allows easy command line access by a unique ID that is easier to
664    // type than the actual system thread ID.
665    uint32_t
666    GetIndexID () const;
667
668    //------------------------------------------------------------------
669    // lldb::ExecutionContextScope pure virtual functions
670    //------------------------------------------------------------------
671    virtual lldb::TargetSP
672    CalculateTarget ();
673
674    virtual lldb::ProcessSP
675    CalculateProcess ();
676
677    virtual lldb::ThreadSP
678    CalculateThread ();
679
680    virtual lldb::StackFrameSP
681    CalculateStackFrame ();
682
683    virtual void
684    CalculateExecutionContext (ExecutionContext &exe_ctx);
685
686    lldb::StackFrameSP
687    GetStackFrameSPForStackFramePtr (StackFrame *stack_frame_ptr);
688
689    size_t
690    GetStatus (Stream &strm,
691               uint32_t start_frame,
692               uint32_t num_frames,
693               uint32_t num_frames_with_source);
694
695    size_t
696    GetStackFrameStatus (Stream& strm,
697                         uint32_t first_frame,
698                         uint32_t num_frames,
699                         bool show_frame_info,
700                         uint32_t num_frames_with_source);
701
702    // We need a way to verify that even though we have a thread in a shared
703    // pointer that the object itself is still valid. Currently this won't be
704    // the case if DestroyThread() was called. DestroyThread is called when
705    // a thread has been removed from the Process' thread list.
706    bool
707    IsValid () const
708    {
709        return !m_destroy_called;
710    }
711
712    // When you implement this method, make sure you don't overwrite the m_actual_stop_info if it claims to be
713    // valid.  The stop info may be a "checkpointed and restored" stop info, so if it is still around it is right
714    // even if you have not calculated this yourself, or if it disagrees with what you might have calculated.
715    virtual lldb::StopInfoSP
716    GetPrivateStopReason () = 0;
717
718protected:
719
720    friend class ThreadPlan;
721    friend class ThreadList;
722    friend class StackFrameList;
723    friend class StackFrame;
724
725    // This is necessary to make sure thread assets get destroyed while the thread is still in good shape
726    // to call virtual thread methods.  This must be called by classes that derive from Thread in their destructor.
727    virtual void DestroyThread ();
728
729    void
730    PushPlan (lldb::ThreadPlanSP &plan_sp);
731
732    void
733    PopPlan ();
734
735    void
736    DiscardPlan ();
737
738    ThreadPlan *GetPreviousPlan (ThreadPlan *plan);
739
740    typedef std::vector<lldb::ThreadPlanSP> plan_stack;
741
742    void
743    SetStopInfo (const lldb::StopInfoSP &stop_info_sp);
744
745    virtual bool
746    SaveFrameZeroState (RegisterCheckpoint &checkpoint);
747
748    virtual bool
749    RestoreSaveFrameZero (const RegisterCheckpoint &checkpoint);
750
751    virtual lldb_private::Unwind *
752    GetUnwinder ();
753
754    lldb::StackFrameListSP
755    GetStackFrameList ();
756
757    lldb::StateType GetTemporaryResumeState()
758    {
759        return m_temporary_resume_state;
760    }
761
762    lldb::StateType SetTemporaryResumeState(lldb::StateType resume_state)
763    {
764        lldb::StateType old_temp_resume_state = m_temporary_resume_state;
765        m_temporary_resume_state = resume_state;
766        return old_temp_resume_state;
767    }
768
769    struct ThreadState
770    {
771        uint32_t           orig_stop_id;
772        lldb::StopInfoSP   stop_info_sp;
773        RegisterCheckpoint register_backup;
774    };
775
776    //------------------------------------------------------------------
777    // Classes that inherit from Process can see and modify these
778    //------------------------------------------------------------------
779    lldb::ProcessWP     m_process_wp;           ///< The process that owns this thread.
780    lldb::StopInfoSP    m_actual_stop_info_sp;  ///< The private stop reason for this thread
781    const uint32_t      m_index_id;             ///< A unique 1 based index assigned to each thread for easy UI/command line access.
782    lldb::RegisterContextSP m_reg_context_sp;   ///< The register context for this thread's current register state.
783    lldb::StateType     m_state;                ///< The state of our process.
784    mutable Mutex       m_state_mutex;          ///< Multithreaded protection for m_state.
785    plan_stack          m_plan_stack;           ///< The stack of plans this thread is executing.
786    plan_stack          m_completed_plan_stack; ///< Plans that have been completed by this stop.  They get deleted when the thread resumes.
787    plan_stack          m_discarded_plan_stack; ///< Plans that have been discarded by this stop.  They get deleted when the thread resumes.
788    mutable Mutex       m_frame_mutex;          ///< Multithreaded protection for m_state.
789    lldb::StackFrameListSP m_curr_frames_sp;    ///< The stack frames that get lazily populated after a thread stops.
790    lldb::StackFrameListSP m_prev_frames_sp;    ///< The previous stack frames from the last time this thread stopped.
791    int                 m_resume_signal;        ///< The signal that should be used when continuing this thread.
792    lldb::StateType     m_resume_state;         ///< This state is used to force a thread to be suspended from outside the ThreadPlan logic.
793    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.
794                                                  /// It gets set in Thread::WillResume.
795    std::auto_ptr<lldb_private::Unwind> m_unwinder_ap;
796    bool                m_destroy_called;       // This is used internally to make sure derived Thread classes call DestroyThread.
797    uint32_t m_thread_stop_reason_stop_id;      // This is the stop id for which the StopInfo is valid.  Can use this so you know that
798                                                // the thread's m_actual_stop_info_sp is current and you don't have to fetch it again
799
800private:
801    //------------------------------------------------------------------
802    // For Thread only
803    //------------------------------------------------------------------
804
805    DISALLOW_COPY_AND_ASSIGN (Thread);
806
807};
808
809} // namespace lldb_private
810
811#endif  // liblldb_Thread_h_
812