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
10#include "RegisterContext_x86.h"
12#include "lldb/lldb-defines.h"
13
14using namespace lldb_private;
15using namespace lldb;
16
17// https://cgit.freebsd.org/src/tree/sys/x86/include/reg.h?h=stable/14
18struct GPR {
19 uint32_t fs;
20 uint32_t es;
21 uint32_t ds;
22 uint32_t edi;
23 uint32_t esi;
24 uint32_t ebp;
25 uint32_t isp;
26 uint32_t ebx;
27 uint32_t edx;
28 uint32_t ecx;
29 uint32_t eax;
30 uint32_t trapno;
31 uint32_t err;
32 uint32_t eip;
33 uint32_t cs;
34 uint32_t eflags;
35 uint32_t esp;
36 uint32_t ss;
37 uint32_t gs;
38};
39
40struct DBG {
41 uint32_t dr[8]; /* debug registers */
42 /* Index 0-3: debug address registers */
43 /* Index 4-5: reserved */
44 /* Index 6: debug status */
45 /* Index 7: debug control */
46};
47
49
50struct UserArea {
54};
55
56#define DR_SIZE sizeof(uint32_t)
57#define DR_OFFSET(reg_index) \
58 (LLVM_EXTENSION offsetof(UserArea, dbg) + \
59 LLVM_EXTENSION offsetof(DBG, dr[reg_index]))
60
61// Include RegisterInfos_i386 to declare our g_register_infos_i386 structure.
62#define DECLARE_REGISTER_INFOS_I386_STRUCT
63#include "RegisterInfos_i386.h"
64#undef DECLARE_REGISTER_INFOS_I386_STRUCT
65
69
70size_t RegisterContextFreeBSD_i386::GetGPRSize() const { return sizeof(GPR); }
71
73 switch (GetTargetArchitecture().GetMachine()) {
74 case llvm::Triple::x86:
75 return g_register_infos_i386;
76 default:
77 assert(false && "Unhandled target architecture.");
78 return nullptr;
79 }
80}
81
83 return static_cast<uint32_t>(sizeof(g_register_infos_i386) /
84 sizeof(g_register_infos_i386[0]));
85}
struct _GPR GPR
RegisterContextFreeBSD_i386(const lldb_private::ArchSpec &target_arch)
uint32_t GetRegisterCount() const override
const lldb_private::RegisterInfo * GetRegisterInfo() const override
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),...