1 //===-- RegisterContextFreeBSD_x86_64.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 #include "RegisterContextFreeBSD_x86_64.h"
13 using namespace lldb_private;
15 // Computes the offset of the given GPR in the user data area.
16 #define GPR_OFFSET(regname) \
17 (offsetof(GPR, regname))
19 // Update the FreeBSD specific information (offset and size).
20 #define UPDATE_GPR_INFO(reg) \
22 GetRegisterContext()[gpr_##reg].byte_size = sizeof(GPR::reg); \
23 GetRegisterContext()[gpr_##reg].byte_offset = GPR_OFFSET(reg); \
26 #define UPDATE_I386_GPR_INFO(i386_reg, reg) \
28 GetRegisterContext()[gpr_##i386_reg].byte_offset = GPR_OFFSET(reg); \
61 // Use a singleton function to avoid global constructors in shared libraries.
62 static std::vector<RegisterInfo> & GetRegisterContext () {
63 static std::vector<RegisterInfo> g_register_infos;
64 return g_register_infos;
68 RegisterContextFreeBSD_x86_64::RegisterContextFreeBSD_x86_64(Thread &thread, uint32_t concrete_frame_idx):
69 RegisterContext_x86_64(thread, concrete_frame_idx)
74 RegisterContextFreeBSD_x86_64::GetGPRSize()
80 RegisterContextFreeBSD_x86_64::GetRegisterInfo()
82 // Allocate RegisterInfo only once
83 if (GetRegisterContext().empty())
85 // Copy the register information from base class
86 const RegisterInfo *base_info = RegisterContext_x86_64::GetRegisterInfo();
89 GetRegisterContext().insert(GetRegisterContext().end(), &base_info[0], &base_info[k_num_registers]);
90 // Update the FreeBSD specific register information (offset and size).
94 return &GetRegisterContext()[0];
98 RegisterContextFreeBSD_x86_64::UpdateRegisterInfo()
100 UPDATE_GPR_INFO(rax);
101 UPDATE_GPR_INFO(rbx);
102 UPDATE_GPR_INFO(rcx);
103 UPDATE_GPR_INFO(rdx);
104 UPDATE_GPR_INFO(rdi);
105 UPDATE_GPR_INFO(rsi);
106 UPDATE_GPR_INFO(rbp);
107 UPDATE_GPR_INFO(rsp);
110 UPDATE_GPR_INFO(r10);
111 UPDATE_GPR_INFO(r11);
112 UPDATE_GPR_INFO(r12);
113 UPDATE_GPR_INFO(r13);
114 UPDATE_GPR_INFO(r14);
115 UPDATE_GPR_INFO(r15);
116 UPDATE_GPR_INFO(rip);
117 UPDATE_GPR_INFO(rflags);
125 UPDATE_I386_GPR_INFO(eax, rax);
126 UPDATE_I386_GPR_INFO(ebx, rbx);
127 UPDATE_I386_GPR_INFO(ecx, rcx);
128 UPDATE_I386_GPR_INFO(edx, rdx);
129 UPDATE_I386_GPR_INFO(edi, rdi);
130 UPDATE_I386_GPR_INFO(esi, rsi);
131 UPDATE_I386_GPR_INFO(ebp, rbp);
132 UPDATE_I386_GPR_INFO(esp, rsp);
133 UPDATE_I386_GPR_INFO(eip, rip);
134 UPDATE_I386_GPR_INFO(eflags, rflags);