Home | History | Annotate | Download | only in mach-core
      1 //===-- ThreadMachCore.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_ThreadMachCore_h_
     11 #define liblldb_ThreadMachCore_h_
     12 
     13 #include <string>
     14 
     15 #include "lldb/Target/Thread.h"
     16 
     17 class ProcessMachCore;
     18 
     19 class ThreadMachCore : public lldb_private::Thread
     20 {
     21 public:
     22     ThreadMachCore (lldb_private::Process &process,
     23                     lldb::tid_t tid);
     24 
     25     virtual
     26     ~ThreadMachCore ();
     27 
     28     virtual void
     29     RefreshStateAfterStop();
     30 
     31     virtual const char *
     32     GetName ();
     33 
     34     virtual lldb::RegisterContextSP
     35     GetRegisterContext ();
     36 
     37     virtual lldb::RegisterContextSP
     38     CreateRegisterContextForFrame (lldb_private::StackFrame *frame);
     39 
     40     static bool
     41     ThreadIDIsValid (lldb::tid_t thread);
     42 
     43     bool
     44     ShouldStop (bool &step_more);
     45 
     46     const char *
     47     GetBasicInfoAsString ();
     48 
     49     void
     50     SetName (const char *name)
     51     {
     52         if (name && name[0])
     53             m_thread_name.assign (name);
     54         else
     55             m_thread_name.clear();
     56     }
     57 
     58     lldb::addr_t
     59     GetThreadDispatchQAddr ()
     60     {
     61         return m_thread_dispatch_qaddr;
     62     }
     63 
     64     void
     65     SetThreadDispatchQAddr (lldb::addr_t thread_dispatch_qaddr)
     66     {
     67         m_thread_dispatch_qaddr = thread_dispatch_qaddr;
     68     }
     69 
     70 protected:
     71 
     72     friend class ProcessMachCore;
     73 
     74     //------------------------------------------------------------------
     75     // Member variables.
     76     //------------------------------------------------------------------
     77     std::string m_thread_name;
     78     std::string m_dispatch_queue_name;
     79     lldb::addr_t m_thread_dispatch_qaddr;
     80     lldb::RegisterContextSP m_thread_reg_ctx_sp;
     81     //------------------------------------------------------------------
     82     // Protected member functions.
     83     //------------------------------------------------------------------
     84     virtual bool
     85     CalculateStopInfo ();
     86 };
     87 
     88 #endif  // liblldb_ThreadMachCore_h_
     89