1 //===-- ThreadElfCore.h ----------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_ThreadElfCore_h_
11 #define liblldb_ThreadElfCore_h_
15 #include "lldb/Target/Thread.h"
16 #include "lldb/Core/DataExtractor.h"
24 // PRSTATUS structure's size differs based on architecture.
25 // Currently parsing done only for x86-64 architecture by
26 // simply reading data from the buffer.
27 // The following macros are used to specify the size.
28 // Calculating size using sizeof() wont work because of padding.
29 #define ELFLINUXPRSTATUS64_SIZE (112)
30 #define ELFLINUXPRPSINFO64_SIZE (132)
32 struct ELFLinuxPrStatus
48 compat_timeval pr_utime;
49 compat_timeval pr_stime;
50 compat_timeval pr_cutime;
51 compat_timeval pr_cstime;
56 Parse(lldb_private::DataExtractor &data, lldb_private::ArchSpec &arch);
59 GetSize(lldb_private::ArchSpec &arch)
61 switch(arch.GetCore())
63 case lldb_private::ArchSpec::eCore_x86_64_x86_64:
64 return ELFLINUXPRSTATUS64_SIZE;
71 struct ELFLinuxPrPsInfo
90 Parse(lldb_private::DataExtractor &data, lldb_private::ArchSpec &arch);
93 GetSize(lldb_private::ArchSpec &arch)
95 switch(arch.GetCore())
97 case lldb_private::ArchSpec::eCore_x86_64_x86_64:
98 return ELFLINUXPRPSINFO64_SIZE;
108 lldb_private::DataExtractor gpregset;
109 lldb_private::DataExtractor fpregset;
114 class ThreadElfCore : public lldb_private::Thread
117 ThreadElfCore (lldb_private::Process &process, lldb::tid_t tid,
118 const ThreadData &td);
124 RefreshStateAfterStop();
126 virtual lldb::RegisterContextSP
127 GetRegisterContext ();
129 virtual lldb::RegisterContextSP
130 CreateRegisterContextForFrame (lldb_private::StackFrame *frame);
136 ThreadIDIsValid (lldb::tid_t thread)
144 if (m_thread_name.empty())
146 return m_thread_name.c_str();
150 SetName (const char *name)
153 m_thread_name.assign (name);
155 m_thread_name.clear();
159 //------------------------------------------------------------------
161 //------------------------------------------------------------------
162 std::string m_thread_name;
163 lldb::RegisterContextSP m_thread_reg_ctx_sp;
167 lldb_private::DataExtractor m_gpregset_data;
168 lldb_private::DataExtractor m_fpregset_data;
170 virtual bool CalculateStopInfo();
174 #endif // liblldb_ThreadElfCore_h_