LLDB  mainline
RegisterContextFreeBSD_i386.cpp
Go to the documentation of this file.
1 //===-- RegisterContextFreeBSD_i386.cpp -----------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===---------------------------------------------------------------------===//
8 
11 
12 using namespace lldb_private;
13 using namespace lldb;
14 
15 // http://svnweb.freebsd.org/base/head/sys/x86/include/reg.h
16 struct GPR {
36 };
37 
38 struct DBG {
39  uint32_t dr[8]; /* debug registers */
40  /* Index 0-3: debug address registers */
41  /* Index 4-5: reserved */
42  /* Index 6: debug status */
43  /* Index 7: debug control */
44 };
45 
46 using FPR_i386 = FXSAVE;
47 
48 struct UserArea {
52 };
53 
54 #define DR_SIZE sizeof(uint32_t)
55 #define DR_OFFSET(reg_index) \
56  (LLVM_EXTENSION offsetof(UserArea, dbg) + \
57  LLVM_EXTENSION offsetof(DBG, dr[reg_index]))
58 
59 // Include RegisterInfos_i386 to declare our g_register_infos_i386 structure.
60 #define DECLARE_REGISTER_INFOS_I386_STRUCT
61 #include "RegisterInfos_i386.h"
62 #undef DECLARE_REGISTER_INFOS_I386_STRUCT
63 
65  const ArchSpec &target_arch)
66  : RegisterInfoInterface(target_arch) {}
67 
68 size_t RegisterContextFreeBSD_i386::GetGPRSize() const { return sizeof(GPR); }
69 
70 const RegisterInfo *RegisterContextFreeBSD_i386::GetRegisterInfo() const {
71  switch (m_target_arch.GetMachine()) {
72  case llvm::Triple::x86:
73  return g_register_infos_i386;
74  default:
75  assert(false && "Unhandled target architecture.");
76  return nullptr;
77  }
78 }
79 
81  return static_cast<uint32_t>(sizeof(g_register_infos_i386) /
82  sizeof(g_register_infos_i386[0]));
83 }
lldb_private::RegisterInfoInterface::m_target_arch
lldb_private::ArchSpec m_target_arch
Definition: RegisterInfoInterface.h:65
GPR::cs
uint32_t cs
Definition: RegisterContextFreeBSD_i386.cpp:31
DBG
Definition: RegisterContextFreeBSD_i386.cpp:38
lldb_private::ArchSpec
Definition: ArchSpec.h:33
lldb_private::ArchSpec::GetMachine
llvm::Triple::ArchType GetMachine() const
Returns a machine family for the current architecture.
Definition: ArchSpec.cpp:667
UserArea::i387
FPR_i386 i387
Definition: RegisterContextFreeBSD_i386.cpp:50
lldb_private::RegisterInfoInterface
Definition: RegisterInfoInterface.h:21
GPR::esp
uint32_t esp
Definition: RegisterContextFreeBSD_i386.cpp:33
UserArea::gpr
GPR gpr
Definition: RegisterContextFreeBSD_i386.cpp:49
RegisterContextFreeBSD_i386::RegisterContextFreeBSD_i386
RegisterContextFreeBSD_i386(const lldb_private::ArchSpec &target_arch)
Definition: RegisterContextFreeBSD_i386.cpp:64
GPR::isp
uint32_t isp
Definition: RegisterContextFreeBSD_i386.cpp:23
GPR::eip
uint32_t eip
Definition: RegisterContextFreeBSD_i386.cpp:30
UserArea
Definition: RegisterContext_mips.h:368
GPR::edx
uint32_t edx
Definition: RegisterContextFreeBSD_i386.cpp:25
RegisterContextPOSIX_x86.h
GPR::es
uint32_t es
Definition: RegisterContextFreeBSD_i386.cpp:18
GPR::ebx
uint32_t ebx
Definition: RegisterContextFreeBSD_i386.cpp:24
GPR::eflags
uint32_t eflags
Definition: RegisterContextFreeBSD_i386.cpp:32
lldb_private::FXSAVE
Definition: RegisterContext_x86.h:266
GPR::edi
uint32_t edi
Definition: RegisterContextFreeBSD_i386.cpp:20
GPR::esi
uint32_t esi
Definition: RegisterContextFreeBSD_i386.cpp:21
UserArea::dbg
DBG dbg
Definition: RegisterContextFreeBSD_i386.cpp:51
GPR::fs
uint32_t fs
Definition: RegisterContextFreeBSD_i386.cpp:17
GPR::ds
uint32_t ds
Definition: RegisterContextFreeBSD_i386.cpp:19
GPR
Definition: RegisterContextFreeBSD_i386.cpp:16
GPR
#define GPR(r16)
Definition: ABIX86.cpp:144
GPR::trapno
uint32_t trapno
Definition: RegisterContextFreeBSD_i386.cpp:28
uint32_t
RegisterContextFreeBSD_i386::GetRegisterInfo
const lldb_private::RegisterInfo * GetRegisterInfo() const override
Definition: RegisterContextFreeBSD_i386.cpp:70
RegisterContextFreeBSD_i386::GetRegisterCount
uint32_t GetRegisterCount() const override
Definition: RegisterContextFreeBSD_i386.cpp:80
RegisterContextFreeBSD_i386.h
RegisterContextFreeBSD_i386::GetGPRSize
size_t GetGPRSize() const override
Definition: RegisterContextFreeBSD_i386.cpp:68
GPR::err
uint32_t err
Definition: RegisterContextFreeBSD_i386.cpp:29
GPR::gs
uint32_t gs
Definition: RegisterContextFreeBSD_i386.cpp:35
GPR::ebp
uint32_t ebp
Definition: RegisterContextFreeBSD_i386.cpp:22
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
GPR::ss
uint32_t ss
Definition: RegisterContextFreeBSD_i386.cpp:34
RegisterInfos_i386.h
GPR::ecx
uint32_t ecx
Definition: RegisterContextFreeBSD_i386.cpp:26
GPR::eax
uint32_t eax
Definition: RegisterContextFreeBSD_i386.cpp:27
lldb
Definition: SBAddress.h:15
FPR_i386
Definition: RegisterContextLinux_i386.cpp:35