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