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
12using namespace lldb_private;
13using namespace lldb;
14
15// http://svnweb.freebsd.org/base/head/sys/x86/include/reg.h
16struct GPR {
17 uint32_t fs;
18 uint32_t es;
19 uint32_t ds;
20 uint32_t edi;
21 uint32_t esi;
22 uint32_t ebp;
23 uint32_t isp;
24 uint32_t ebx;
25 uint32_t edx;
26 uint32_t ecx;
27 uint32_t eax;
28 uint32_t trapno;
29 uint32_t err;
30 uint32_t eip;
31 uint32_t cs;
32 uint32_t eflags;
33 uint32_t esp;
34 uint32_t ss;
35 uint32_t gs;
36};
37
38struct 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
47
48struct 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
68size_t RegisterContextFreeBSD_i386::GetGPRSize() const { return sizeof(GPR); }
69
71 switch (GetTargetArchitecture().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}
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:31
RegisterInfo interface to patch RegisterInfo structure for archs.
const lldb_private::ArchSpec & GetTargetArchitecture() const
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
Definition: SBAddress.h:15
Every register is described in detail including its name, alternate name (optional),...