LLDB mainline
RegisterContextOpenBSD_i386.cpp
Go to the documentation of this file.
1//===-- RegisterContextOpenBSD_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
10#include "RegisterContext_x86.h"
12#include "lldb/lldb-defines.h"
13
14using namespace lldb_private;
15using namespace lldb;
16
17// /usr/include/machine/reg.h
18struct GPR {
19 uint32_t eax;
20 uint32_t ecx;
21 uint32_t edx;
22 uint32_t ebx;
23 uint32_t esp;
24 uint32_t ebp;
25 uint32_t esi;
26 uint32_t edi;
27 uint32_t eip;
28 uint32_t eflags;
29 uint32_t cs;
30 uint32_t ss;
31 uint32_t ds;
32 uint32_t es;
33 uint32_t fs;
34 uint32_t gs;
35};
36
37struct dbreg {
38 uint32_t dr[8]; /* debug registers */
39 /* Index 0-3: debug address registers */
40 /* Index 4-5: reserved */
41 /* Index 6: debug status */
42 /* Index 7: debug control */
43};
44
45using FPR_i386 = FXSAVE;
46
47struct UserArea {
48 GPR gpr;
50};
51
52#define DR_SIZE sizeof(uint32_t)
53#define DR_OFFSET(reg_index) (LLVM_EXTENSION offsetof(dbreg, dr[reg_index]))
54
55// Include RegisterInfos_i386 to declare our g_register_infos_i386 structure.
56#define DECLARE_REGISTER_INFOS_I386_STRUCT
57#include "RegisterInfos_i386.h"
58#undef DECLARE_REGISTER_INFOS_I386_STRUCT
59
63
64size_t RegisterContextOpenBSD_i386::GetGPRSize() const { return sizeof(GPR); }
65
67 switch (GetTargetArchitecture().GetMachine()) {
68 case llvm::Triple::x86:
69 return g_register_infos_i386;
70 default:
71 assert(false && "Unhandled target architecture.");
72 return nullptr;
73 }
74}
75
77 return static_cast<uint32_t>(sizeof(g_register_infos_i386) /
78 sizeof(g_register_infos_i386[0]));
79}
#define GPR(r16)
Definition ABIX86.cpp:145
uint32_t GetRegisterCount() const override
const lldb_private::RegisterInfo * GetRegisterInfo() const override
RegisterContextOpenBSD_i386(const lldb_private::ArchSpec &target_arch)
An architecture specification class.
Definition ArchSpec.h:32
const lldb_private::ArchSpec & GetTargetArchitecture() const
RegisterInfoInterface(const lldb_private::ArchSpec &target_arch)
A class that represents a running process on the host machine.
GPR_linux_mips gpr
Every register is described in detail including its name, alternate name (optional),...