9#if defined(__i386__) || defined(_M_IX86)
23#include "llvm/ADT/STLExtras.h"
28#define DEFINE_GPR(reg, alt) #reg, alt, 4, 0, eEncodingUint, eFormatHexUppercase
29#define DEFINE_GPR_BIN(reg, alt) #reg, alt, 4, 0, eEncodingUint, eFormatBinary
123 {DEFINE_GPR_BIN(eflags,
"flags"),
135uint32_t g_gpr_reg_indices[] = {eRegisterIndexEax, eRegisterIndexEbx,
136 eRegisterIndexEcx, eRegisterIndexEdx,
137 eRegisterIndexEdi, eRegisterIndexEsi,
138 eRegisterIndexEbp, eRegisterIndexEsp,
139 eRegisterIndexEip, eRegisterIndexEflags};
142 {
"General Purpose Registers",
"gpr", std::size(g_gpr_reg_indices),
148RegisterContextWindows_x86::RegisterContextWindows_x86(
149 Thread &thread, uint32_t concrete_frame_idx)
152RegisterContextWindows_x86::~RegisterContextWindows_x86() {}
154size_t RegisterContextWindows_x86::GetRegisterCount() {
159RegisterContextWindows_x86::GetRegisterInfoAtIndex(
size_t reg) {
165size_t RegisterContextWindows_x86::GetRegisterSetCount() {
166 return std::size(g_register_sets);
169const RegisterSet *RegisterContextWindows_x86::GetRegisterSet(
size_t reg_set) {
170 return &g_register_sets[reg_set];
173bool RegisterContextWindows_x86::ReadRegister(
const RegisterInfo *reg_info,
175 if (!CacheAllRegisterValues())
178 if (reg_info ==
nullptr)
184 return ReadRegisterHelper(CONTEXT_INTEGER,
"EAX", m_context.Eax, reg_value);
186 return ReadRegisterHelper(CONTEXT_INTEGER,
"EBX", m_context.Ebx, reg_value);
188 return ReadRegisterHelper(CONTEXT_INTEGER,
"ECX", m_context.Ecx, reg_value);
190 return ReadRegisterHelper(CONTEXT_INTEGER,
"EDX", m_context.Edx, reg_value);
192 return ReadRegisterHelper(CONTEXT_INTEGER,
"EDI", m_context.Edi, reg_value);
194 return ReadRegisterHelper(CONTEXT_INTEGER,
"ESI", m_context.Esi, reg_value);
196 return ReadRegisterHelper(CONTEXT_CONTROL,
"EBP", m_context.Ebp, reg_value);
198 return ReadRegisterHelper(CONTEXT_CONTROL,
"ESP", m_context.Esp, reg_value);
200 return ReadRegisterHelper(CONTEXT_CONTROL,
"EIP", m_context.Eip, reg_value);
202 return ReadRegisterHelper(CONTEXT_CONTROL,
"EFLAGS", m_context.EFlags,
205 Log *log =
GetLog(WindowsLog::Registers);
206 LLDB_LOG(log,
"Requested unknown register {0}", reg);
212bool RegisterContextWindows_x86::WriteRegister(
const RegisterInfo *reg_info,
218 if (!CacheAllRegisterValues())
221 Log *log =
GetLog(WindowsLog::Registers);
265 LLDB_LOG(log,
"Write value {0:x} to unknown register {1}",
270 return ApplyAllRegisterValues();
273bool RegisterContextWindows_x86::ReadRegisterHelper(
274 DWORD flags_required,
const char *reg_name, DWORD value,
276 Log *log =
GetLog(WindowsLog::Registers);
277 if ((m_context.ContextFlags & flags_required) != flags_required) {
278 LLDB_LOG(log,
"Thread context doesn't have {0}", reg_name);
281 LLDB_LOG(log,
"Read value {0:x} from {1}", value, reg_name);
static const uint32_t k_num_register_infos
static const RegisterInfo g_register_infos[]
#define DEFINE_GPR(reg, alt, kind1, kind2, kind3, kind4)
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
uint32_t GetAsUInt32(uint32_t fail_value=UINT32_MAX, bool *success_ptr=nullptr) const
void SetUInt32(uint32_t uint, Type t=eTypeUInt32)
#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.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
@ eRegisterKindLLDB
lldb's internal register numbers
Every register is described in detail including its name, alternate name (optional),...
uint32_t kinds[lldb::kNumRegisterKinds]
Holds all of the various register numbers for all register kinds.
Registers are grouped into register sets.