LLDB mainline
RegisterContextWindows_i386.cpp
Go to the documentation of this file.
1//===-- RegisterContextWindows_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
17namespace {
18// Declare our g_register_infos structure.
19typedef struct _GPR {
20 uint32_t eax;
21 uint32_t ebx;
22 uint32_t ecx;
23 uint32_t edx;
24 uint32_t edi;
25 uint32_t esi;
26 uint32_t ebp;
27 uint32_t esp;
28 uint32_t eip;
29 uint32_t eflags;
30 uint32_t cs;
31 uint32_t fs;
32 uint32_t gs;
33 uint32_t ss;
34 uint32_t ds;
35 uint32_t es;
36} GPR;
37
38#define GPR_OFFSET(regname) (LLVM_EXTENSION offsetof(GPR, regname))
39
40#define DEFINE_GPR(reg, alt, kind1, kind2, kind3, kind4) \
41 { \
42#reg, alt, sizeof(((GPR *)nullptr)->reg), GPR_OFFSET(reg), eEncodingUint, \
43 eFormatHex, \
44 {kind1, kind2, kind3, kind4, lldb_##reg##_i386 }, nullptr, nullptr, \
45 nullptr, \
46 }
47
48// clang-format off
49static RegisterInfo g_register_infos_i386[] = {
50// General purpose registers EH_Frame DWARF Generic Process Plugin
51// =========================== ================== ================ ========================= ====================
68};
69// clang-format on
70} // namespace
71
73 const ArchSpec &target_arch)
74 : lldb_private::RegisterInfoInterface(target_arch) {
75 assert(target_arch.GetMachine() == llvm::Triple::x86);
76}
77
79 return g_register_infos_i386;
80}
81
83 return std::size(g_register_infos_i386);
84}
85
87 return std::size(g_register_infos_i386);
88}
89
90size_t RegisterContextWindows_i386::GetGPRSize() const { return sizeof(GPR); }
#define GPR(r16)
Definition ABIX86.cpp:145
#define DEFINE_GPR(reg, alt, kind1, kind2, kind3, kind4)
uint32_t GetRegisterCount() const override
uint32_t GetUserRegisterCount() const override
RegisterContextWindows_i386(const lldb_private::ArchSpec &target_arch)
const lldb_private::RegisterInfo * GetRegisterInfo() const override
An architecture specification class.
Definition ArchSpec.h:32
llvm::Triple::ArchType GetMachine() const
Returns a machine family for the current architecture.
Definition ArchSpec.cpp:673
RegisterInfoInterface(const lldb_private::ArchSpec &target_arch)
#define LLDB_REGNUM_GENERIC_SP
#define LLDB_REGNUM_GENERIC_FLAGS
#define LLDB_INVALID_REGNUM
#define LLDB_REGNUM_GENERIC_PC
#define LLDB_REGNUM_GENERIC_FP
A class that represents a running process on the host machine.
Every register is described in detail including its name, alternate name (optional),...