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 
13 using namespace lldb_private;
14 using namespace lldb;
15 
16 namespace {
17 // Declare our g_register_infos structure.
18 typedef 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  }
45 
46 // clang-format off
47 static RegisterInfo g_register_infos_i386[] = {
48 // General purpose registers EH_Frame DWARF Generic Process Plugin
49 // =========================== ================== ================ ========================= ====================
66 };
67 // clang-format on
68 } // namespace
69 
71  const ArchSpec &target_arch)
72  : lldb_private::RegisterInfoInterface(target_arch) {
73  assert(target_arch.GetMachine() == llvm::Triple::x86);
74 }
75 
76 const RegisterInfo *RegisterContextWindows_i386::GetRegisterInfo() const {
77  return g_register_infos_i386;
78 }
79 
81  return llvm::array_lengthof(g_register_infos_i386);
82 }
83 
85  return llvm::array_lengthof(g_register_infos_i386);
86 }
87 
88 size_t RegisterContextWindows_i386::GetGPRSize() const { return sizeof(GPR); }
RegisterContextWindows_i386::GetRegisterInfo
const lldb_private::RegisterInfo * GetRegisterInfo() const override
Definition: RegisterContextWindows_i386.cpp:76
lldb_private::ehframe_eip_i386
@ ehframe_eip_i386
Definition: RegisterContext_x86.h:46
RegisterContextWindows_i386::GetGPRSize
size_t GetGPRSize() const override
Definition: RegisterContextWindows_i386.cpp:88
lldb_private::ArchSpec
Definition: ArchSpec.h:33
LLDB_INVALID_REGNUM
#define LLDB_INVALID_REGNUM
Definition: lldb-defines.h:91
lldb_private::dwarf_esi_i386
@ dwarf_esi_i386
Definition: RegisterContext_x86.h:84
lldb_private::ArchSpec::GetMachine
llvm::Triple::ArchType GetMachine() const
Returns a machine family for the current architecture.
Definition: ArchSpec.cpp:667
esp
@ esp
Definition: CompactUnwindInfo.cpp:978
RegisterContextWindows_i386::GetUserRegisterCount
uint32_t GetUserRegisterCount() const override
Definition: RegisterContextWindows_i386.cpp:84
lldb_private::ehframe_ecx_i386
@ ehframe_ecx_i386
Definition: RegisterContext_x86.h:27
lldb_private::ehframe_edi_i386
@ ehframe_edi_i386
Definition: RegisterContext_x86.h:45
lldb_private::RegisterInfoInterface
Definition: RegisterInfoInterface.h:21
lldb_private::dwarf_eax_i386
@ dwarf_eax_i386
Definition: RegisterContext_x86.h:78
lldb_private::dwarf_es_i386
@ dwarf_es_i386
Definition: RegisterContext_x86.h:118
lldb_private::dwarf_fs_i386
@ dwarf_fs_i386
Definition: RegisterContext_x86.h:122
ebp
@ ebp
Definition: CompactUnwindInfo.cpp:977
ebx
@ ebx
Definition: CompactUnwindInfo.cpp:976
lldb_private::ehframe_edx_i386
@ ehframe_edx_i386
Definition: RegisterContext_x86.h:28
lldb_private::dwarf_eflags_i386
@ dwarf_eflags_i386
Definition: RegisterContext_x86.h:87
edx
@ edx
Definition: CompactUnwindInfo.cpp:975
lldb_private::dwarf_ds_i386
@ dwarf_ds_i386
Definition: RegisterContext_x86.h:121
lldb_private::ehframe_eflags_i386
@ ehframe_eflags_i386
Definition: RegisterContext_x86.h:47
DEFINE_GPR
#define DEFINE_GPR(reg, alt, kind1, kind2, kind3, kind4)
Definition: RegisterContextWindows_i386.cpp:39
LLDB_REGNUM_GENERIC_FLAGS
#define LLDB_REGNUM_GENERIC_FLAGS
Definition: lldb-defines.h:67
lldb_private::dwarf_ss_i386
@ dwarf_ss_i386
Definition: RegisterContext_x86.h:120
lldb_private::dwarf_cs_i386
@ dwarf_cs_i386
Definition: RegisterContext_x86.h:119
RegisterContextWindows_i386::GetRegisterCount
uint32_t GetRegisterCount() const override
Definition: RegisterContextWindows_i386.cpp:80
RegisterContextWindows_i386.h
RegisterContextWindows_i386::RegisterContextWindows_i386
RegisterContextWindows_i386(const lldb_private::ArchSpec &target_arch)
Definition: RegisterContextWindows_i386.cpp:70
lldb_private::dwarf_edi_i386
@ dwarf_edi_i386
Definition: RegisterContext_x86.h:85
lldb_private::ehframe_esi_i386
@ ehframe_esi_i386
Definition: RegisterContext_x86.h:44
lldb_private::dwarf_edx_i386
@ dwarf_edx_i386
Definition: RegisterContext_x86.h:80
lldb_private::dwarf_gs_i386
@ dwarf_gs_i386
Definition: RegisterContext_x86.h:123
ecx
@ ecx
Definition: CompactUnwindInfo.cpp:974
GPR
#define GPR(r16)
Definition: ABIX86.cpp:144
lldb_private::dwarf_ecx_i386
@ dwarf_ecx_i386
Definition: RegisterContext_x86.h:79
lldb_private::ehframe_ebx_i386
@ ehframe_ebx_i386
Definition: RegisterContext_x86.h:29
uint32_t
lldb_private::ehframe_ebp_i386
@ ehframe_ebp_i386
Definition: RegisterContext_x86.h:43
LLDB_REGNUM_GENERIC_SP
#define LLDB_REGNUM_GENERIC_SP
Definition: lldb-defines.h:64
edi
@ edi
Definition: CompactUnwindInfo.cpp:980
eax
@ eax
Definition: CompactUnwindInfo.cpp:973
lldb-x86-register-enums.h
lldb_private::ehframe_esp_i386
@ ehframe_esp_i386
Definition: RegisterContext_x86.h:42
RegisterContext_x86.h
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
LLDB_REGNUM_GENERIC_FP
#define LLDB_REGNUM_GENERIC_FP
Definition: lldb-defines.h:65
lldb_private::dwarf_ebx_i386
@ dwarf_ebx_i386
Definition: RegisterContext_x86.h:81
lldb_private::dwarf_esp_i386
@ dwarf_esp_i386
Definition: RegisterContext_x86.h:82
LLDB_REGNUM_GENERIC_PC
#define LLDB_REGNUM_GENERIC_PC
Definition: lldb-defines.h:63
lldb_private::dwarf_ebp_i386
@ dwarf_ebp_i386
Definition: RegisterContext_x86.h:83
lldb_private::dwarf_eip_i386
@ dwarf_eip_i386
Definition: RegisterContext_x86.h:86
esi
@ esi
Definition: CompactUnwindInfo.cpp:979
lldb_private::ehframe_eax_i386
@ ehframe_eax_i386
Definition: RegisterContext_x86.h:26
lldb
Definition: SBAddress.h:15
eip
@ eip
Definition: CompactUnwindInfo.cpp:981