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)
36 struct ELFLinuxPrStatus
52 compat_timeval pr_utime;
53 compat_timeval pr_stime;
54 compat_timeval pr_cutime;
55 compat_timeval pr_cstime;
60 Parse(lldb_private::DataExtractor &data, lldb_private::ArchSpec &arch);
63 GetSize(lldb_private::ArchSpec &arch)
65 switch(arch.GetCore())
67 case lldb_private::ArchSpec::eCore_x86_64_x86_64:
68 return ELFLINUXPRSTATUS64_SIZE;
75 struct ELFLinuxPrPsInfo
94 Parse(lldb_private::DataExtractor &data, lldb_private::ArchSpec &arch);
97 GetSize(lldb_private::ArchSpec &arch)
99 switch(arch.GetCore())
101 case lldb_private::ArchSpec::eCore_x86_64_x86_64:
102 return ELFLINUXPRPSINFO64_SIZE;
112 lldb_private::DataExtractor gpregset;
113 lldb_private::DataExtractor fpregset;
118 class ThreadElfCore : public lldb_private::Thread
121 ThreadElfCore (lldb_private::Process &process, lldb::tid_t tid,
122 const ThreadData &td);
128 RefreshStateAfterStop();
130 virtual lldb::RegisterContextSP
131 GetRegisterContext ();
133 virtual lldb::RegisterContextSP
134 CreateRegisterContextForFrame (lldb_private::StackFrame *frame);
140 ThreadIDIsValid (lldb::tid_t thread)
148 if (m_thread_name.empty())
150 return m_thread_name.c_str();
154 SetName (const char *name)
157 m_thread_name.assign (name);
159 m_thread_name.clear();
163 //------------------------------------------------------------------
165 //------------------------------------------------------------------
166 std::string m_thread_name;
167 lldb::RegisterContextSP m_thread_reg_ctx_sp;
171 lldb_private::DataExtractor m_gpregset_data;
172 lldb_private::DataExtractor m_fpregset_data;
174 virtual bool CalculateStopInfo();
178 #endif // liblldb_ThreadElfCore_h_