1 //===-- RegisterContextLinux_i386.cpp --------------------------*- 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 "RegisterContextPOSIX_x86.h"
11 #include "RegisterContextLinux_i386.h"
13 using namespace lldb_private;
39 GPR regs; // General purpose registers.
40 int32_t fpvalid; // True if FPU is being used.
41 FXSAVE i387; // FPU registers.
42 uint32_t tsize; // Text segment size.
43 uint32_t dsize; // Data segment size.
44 uint32_t ssize; // Stack segment size.
45 uint32_t start_code; // VM address of text.
46 uint32_t start_stack; // VM address of stack bottom (top in rsp).
47 int32_t signal; // Signal causing core dump.
48 int32_t reserved; // Unused.
49 uint32_t ar0; // Location of GPR's.
50 uint32_t fpstate; // Location of FPR's. Should be a FXSTATE *, but this
51 // has to be 32-bits even on 64-bit systems.
52 uint32_t magic; // Identifier for core dumps.
53 char u_comm[32]; // Command causing core dump.
54 uint32_t u_debugreg[8]; // Debug registers (DR0 - DR7).
57 #define DR_SIZE sizeof(UserArea::u_debugreg[0])
58 #define DR_OFFSET(reg_index) \
59 (LLVM_EXTENSION offsetof(UserArea, u_debugreg[reg_index]))
61 //---------------------------------------------------------------------------
62 // Include RegisterInfos_i386 to declare our g_register_infos_i386 structure.
63 //---------------------------------------------------------------------------
64 #define DECLARE_REGISTER_INFOS_I386_STRUCT
65 #include "RegisterInfos_i386.h"
66 #undef DECLARE_REGISTER_INFOS_I386_STRUCT
68 RegisterContextLinux_i386::RegisterContextLinux_i386(const ArchSpec &target_arch) :
69 RegisterInfoInterface(target_arch)
73 RegisterContextLinux_i386::~RegisterContextLinux_i386()
78 RegisterContextLinux_i386::GetGPRSize()
84 RegisterContextLinux_i386::GetRegisterInfo()
86 switch (m_target_arch.GetCore())
88 case ArchSpec::eCore_x86_32_i386:
89 case ArchSpec::eCore_x86_32_i486:
90 case ArchSpec::eCore_x86_32_i486sx:
91 return g_register_infos_i386;
93 assert(false && "Unhandled target architecture.");