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
13using namespace lldb_private;
14using namespace lldb;
15
16namespace {
17// Declare our g_register_infos structure.
18typedef struct _GPR {
19 uint32_t eax;
20 uint32_t ebx;
21 uint32_t ecx;
22 uint32_t edx;
23 uint32_t edi;
24 uint32_t esi;
25 uint32_t ebp;
26 uint32_t esp;
27 uint32_t eip;
28 uint32_t eflags;
29 uint32_t cs;
30 uint32_t fs;
31 uint32_t gs;
32 uint32_t ss;
33 uint32_t ds;
34 uint32_t es;
35} GPR;
36
37#define GPR_OFFSET(regname) (LLVM_EXTENSION offsetof(GPR, regname))
38
39#define DEFINE_GPR(reg, alt, kind1, kind2, kind3, kind4) \
40 { \
41#reg, alt, sizeof(((GPR *)nullptr)->reg), GPR_OFFSET(reg), eEncodingUint, \
42 eFormatHex, \
43 {kind1, kind2, kind3, kind4, lldb_##reg##_i386 }, nullptr, nullptr, \
44 nullptr, \
45 }
46
47// clang-format off
48static RegisterInfo g_register_infos_i386[] = {
49// General purpose registers EH_Frame DWARF Generic Process Plugin
50// =========================== ================== ================ ========================= ====================
67};
68// clang-format on
69} // namespace
70
72 const ArchSpec &target_arch)
73 : lldb_private::RegisterInfoInterface(target_arch) {
74 assert(target_arch.GetMachine() == llvm::Triple::x86);
75}
76
78 return g_register_infos_i386;
79}
80
82 return std::size(g_register_infos_i386);
83}
84
86 return std::size(g_register_infos_i386);
87}
88
89size_t RegisterContextWindows_i386::GetGPRSize() const { return sizeof(GPR); }
#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:31
llvm::Triple::ArchType GetMachine() const
Returns a machine family for the current architecture.
Definition: ArchSpec.cpp:683
RegisterInfo interface to patch RegisterInfo structure for archs.
#define LLDB_REGNUM_GENERIC_SP
Definition: lldb-defines.h:57
#define LLDB_REGNUM_GENERIC_FLAGS
Definition: lldb-defines.h:60
#define LLDB_INVALID_REGNUM
Definition: lldb-defines.h:87
#define LLDB_REGNUM_GENERIC_PC
Definition: lldb-defines.h:56
#define LLDB_REGNUM_GENERIC_FP
Definition: lldb-defines.h:58
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),...