[Lldb-commits] [lldb] [lldb][NativeRegisterContext] Rename to x86 for shared files (PR #180624)
Minsoo Choo via lldb-commits
lldb-commits at lists.llvm.org
Mon Feb 9 13:46:05 PST 2026
https://github.com/mchoo7 updated https://github.com/llvm/llvm-project/pull/180624
>From de9bf88a2893771b801d90d6722b1a6cf581db7c Mon Sep 17 00:00:00 2001
From: Minsoo Choo <minsoochoo0122 at proton.me>
Date: Mon, 9 Feb 2026 16:01:51 -0500
Subject: [PATCH] [lldb][NativeRegisterContext] Rename to x86 for shared files
Signed-off-by: Minsoo Choo <minsoochoo0122 at proton.me>
---
.../Plugins/Process/FreeBSD/CMakeLists.txt | 2 +-
...p => NativeRegisterContextFreeBSD_x86.cpp} | 56 ++--
...4.h => NativeRegisterContextFreeBSD_x86.h} | 19 +-
.../Plugins/Process/Linux/CMakeLists.txt | 2 +-
...cpp => NativeRegisterContextLinux_x86.cpp} | 265 +++++++++++-------
..._64.h => NativeRegisterContextLinux_x86.h} | 13 +-
.../Plugins/Process/NetBSD/CMakeLists.txt | 2 +-
...pp => NativeRegisterContextNetBSD_x86.cpp} | 60 ++--
...64.h => NativeRegisterContextNetBSD_x86.h} | 21 +-
.../Plugins/Process/elf-core/CMakeLists.txt | 4 +-
...4.cpp => RegisterContextLinuxCore_x86.cpp} | 12 +-
...86_64.h => RegisterContextLinuxCore_x86.h} | 14 +-
...4.cpp => RegisterContextPOSIXCore_x86.cpp} | 32 +--
...86_64.h => RegisterContextPOSIXCore_x86.h} | 12 +-
.../Process/elf-core/ThreadElfCore.cpp | 12 +-
.../Process/minidump/ThreadMinidump.cpp | 6 +-
16 files changed, 288 insertions(+), 244 deletions(-)
rename lldb/source/Plugins/Process/FreeBSD/{NativeRegisterContextFreeBSD_x86_64.cpp => NativeRegisterContextFreeBSD_x86.cpp} (92%)
rename lldb/source/Plugins/Process/FreeBSD/{NativeRegisterContextFreeBSD_x86_64.h => NativeRegisterContextFreeBSD_x86.h} (81%)
rename lldb/source/Plugins/Process/Linux/{NativeRegisterContextLinux_x86_64.cpp => NativeRegisterContextLinux_x86.cpp} (81%)
rename lldb/source/Plugins/Process/Linux/{NativeRegisterContextLinux_x86_64.h => NativeRegisterContextLinux_x86.h} (91%)
rename lldb/source/Plugins/Process/NetBSD/{NativeRegisterContextNetBSD_x86_64.cpp => NativeRegisterContextNetBSD_x86.cpp} (91%)
rename lldb/source/Plugins/Process/NetBSD/{NativeRegisterContextNetBSD_x86_64.h => NativeRegisterContextNetBSD_x86.h} (80%)
rename lldb/source/Plugins/Process/elf-core/{RegisterContextLinuxCore_x86_64.cpp => RegisterContextLinuxCore_x86.cpp} (96%)
rename lldb/source/Plugins/Process/elf-core/{RegisterContextLinuxCore_x86_64.h => RegisterContextLinuxCore_x86.h} (76%)
rename lldb/source/Plugins/Process/elf-core/{RegisterContextPOSIXCore_x86_64.cpp => RegisterContextPOSIXCore_x86.cpp} (69%)
rename lldb/source/Plugins/Process/elf-core/{RegisterContextPOSIXCore_x86_64.h => RegisterContextPOSIXCore_x86.h} (87%)
diff --git a/lldb/source/Plugins/Process/FreeBSD/CMakeLists.txt b/lldb/source/Plugins/Process/FreeBSD/CMakeLists.txt
index 8574df58b4ada..559e6ff0dd570 100644
--- a/lldb/source/Plugins/Process/FreeBSD/CMakeLists.txt
+++ b/lldb/source/Plugins/Process/FreeBSD/CMakeLists.txt
@@ -4,7 +4,7 @@ add_lldb_library(lldbPluginProcessFreeBSD
NativeRegisterContextFreeBSD_arm.cpp
NativeRegisterContextFreeBSD_arm64.cpp
NativeRegisterContextFreeBSD_powerpc.cpp
- NativeRegisterContextFreeBSD_x86_64.cpp
+ NativeRegisterContextFreeBSD_x86.cpp
NativeThreadFreeBSD.cpp
LINK_COMPONENTS
diff --git a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.cpp b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86.cpp
similarity index 92%
rename from lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.cpp
rename to lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86.cpp
index f4cbd705ff1ee..0167a3fb7746a 100644
--- a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.cpp
+++ b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86.cpp
@@ -1,4 +1,4 @@
-//===-- NativeRegisterContextFreeBSD_x86_64.cpp ---------------------------===//
+//===-- NativeRegisterContextFreeBSD_x86.cpp ------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -8,7 +8,7 @@
#if defined(__i386__) || defined(__x86_64__)
-#include "NativeRegisterContextFreeBSD_x86_64.h"
+#include "NativeRegisterContextFreeBSD_x86.h"
// clang-format off
#include <x86/fpu.h>
@@ -238,10 +238,10 @@ static const RegisterSet g_reg_sets_x86_64[k_num_register_sets] = {
NativeRegisterContextFreeBSD *
NativeRegisterContextFreeBSD::CreateHostNativeRegisterContextFreeBSD(
const ArchSpec &target_arch, NativeThreadFreeBSD &native_thread) {
- return new NativeRegisterContextFreeBSD_x86_64(target_arch, native_thread);
+ return new NativeRegisterContextFreeBSD_x86(target_arch, native_thread);
}
-// NativeRegisterContextFreeBSD_x86_64 members.
+// NativeRegisterContextFreeBSD_x86 members.
static RegisterInfoInterface *
CreateRegisterInfoInterface(const ArchSpec &target_arch) {
@@ -257,7 +257,7 @@ CreateRegisterInfoInterface(const ArchSpec &target_arch) {
}
}
-NativeRegisterContextFreeBSD_x86_64::NativeRegisterContextFreeBSD_x86_64(
+NativeRegisterContextFreeBSD_x86::NativeRegisterContextFreeBSD_x86(
const ArchSpec &target_arch, NativeThreadFreeBSD &native_thread)
: NativeRegisterContextRegisterInfo(
native_thread, CreateRegisterInfoInterface(target_arch)),
@@ -284,12 +284,12 @@ NativeRegisterContextFreeBSD_x86_64::NativeRegisterContextFreeBSD_x86_64(
.byte_offset;
}
-uint32_t NativeRegisterContextFreeBSD_x86_64::GetRegisterSetCount() const {
+uint32_t NativeRegisterContextFreeBSD_x86::GetRegisterSetCount() const {
return k_num_register_sets;
}
const RegisterSet *
-NativeRegisterContextFreeBSD_x86_64::GetRegisterSet(uint32_t set_index) const {
+NativeRegisterContextFreeBSD_x86::GetRegisterSet(uint32_t set_index) const {
switch (GetRegisterInfoInterface().GetTargetArchitecture().GetMachine()) {
case llvm::Triple::x86:
return &g_reg_sets_i386[set_index];
@@ -300,8 +300,8 @@ NativeRegisterContextFreeBSD_x86_64::GetRegisterSet(uint32_t set_index) const {
}
}
-std::optional<NativeRegisterContextFreeBSD_x86_64::RegSetKind>
-NativeRegisterContextFreeBSD_x86_64::GetSetForNativeRegNum(
+std::optional<NativeRegisterContextFreeBSD_x86::RegSetKind>
+NativeRegisterContextFreeBSD_x86::GetSetForNativeRegNum(
uint32_t reg_num) const {
switch (GetRegisterInfoInterface().GetTargetArchitecture().GetMachine()) {
case llvm::Triple::x86:
@@ -339,7 +339,7 @@ NativeRegisterContextFreeBSD_x86_64::GetSetForNativeRegNum(
llvm_unreachable("Register does not belong to any register set");
}
-Status NativeRegisterContextFreeBSD_x86_64::ReadRegisterSet(RegSetKind set) {
+Status NativeRegisterContextFreeBSD_x86::ReadRegisterSet(RegSetKind set) {
switch (set) {
case GPRegSet:
return NativeProcessFreeBSD::PtraceWrapper(PT_GETREGS, m_thread.GetID(),
@@ -377,10 +377,10 @@ Status NativeRegisterContextFreeBSD_x86_64::ReadRegisterSet(RegSetKind set) {
m_xsave.data(), m_xsave.size());
}
}
- llvm_unreachable("NativeRegisterContextFreeBSD_x86_64::ReadRegisterSet");
+ llvm_unreachable("NativeRegisterContextFreeBSD_x86::ReadRegisterSet");
}
-Status NativeRegisterContextFreeBSD_x86_64::WriteRegisterSet(RegSetKind set) {
+Status NativeRegisterContextFreeBSD_x86::WriteRegisterSet(RegSetKind set) {
switch (set) {
case GPRegSet:
return NativeProcessFreeBSD::PtraceWrapper(PT_SETREGS, m_thread.GetID(),
@@ -403,12 +403,12 @@ Status NativeRegisterContextFreeBSD_x86_64::WriteRegisterSet(RegSetKind set) {
return NativeProcessFreeBSD::PtraceWrapper(PT_SETXSTATE, GetProcessPid(),
m_xsave.data(), m_xsave.size());
}
- llvm_unreachable("NativeRegisterContextFreeBSD_x86_64::WriteRegisterSet");
+ llvm_unreachable("NativeRegisterContextFreeBSD_x86::WriteRegisterSet");
}
Status
-NativeRegisterContextFreeBSD_x86_64::ReadRegister(const RegisterInfo *reg_info,
- RegisterValue ®_value) {
+NativeRegisterContextFreeBSD_x86::ReadRegister(const RegisterInfo *reg_info,
+ RegisterValue ®_value) {
Status error;
if (!reg_info) {
@@ -473,7 +473,7 @@ NativeRegisterContextFreeBSD_x86_64::ReadRegister(const RegisterInfo *reg_info,
return error;
}
-Status NativeRegisterContextFreeBSD_x86_64::WriteRegister(
+Status NativeRegisterContextFreeBSD_x86::WriteRegister(
const RegisterInfo *reg_info, const RegisterValue ®_value) {
Status error;
@@ -539,7 +539,7 @@ Status NativeRegisterContextFreeBSD_x86_64::WriteRegister(
return WriteRegisterSet(set);
}
-Status NativeRegisterContextFreeBSD_x86_64::ReadAllRegisterValues(
+Status NativeRegisterContextFreeBSD_x86::ReadAllRegisterValues(
lldb::WritableDataBufferSP &data_sp) {
Status error;
@@ -555,20 +555,20 @@ Status NativeRegisterContextFreeBSD_x86_64::ReadAllRegisterValues(
return error;
}
-Status NativeRegisterContextFreeBSD_x86_64::WriteAllRegisterValues(
+Status NativeRegisterContextFreeBSD_x86::WriteAllRegisterValues(
const lldb::DataBufferSP &data_sp) {
Status error;
if (!data_sp) {
error = Status::FromErrorStringWithFormat(
- "NativeRegisterContextFreeBSD_x86_64::%s invalid data_sp provided",
+ "NativeRegisterContextFreeBSD_x86::%s invalid data_sp provided",
__FUNCTION__);
return error;
}
if (data_sp->GetByteSize() != REG_CONTEXT_SIZE) {
error = Status::FromErrorStringWithFormat(
- "NativeRegisterContextFreeBSD_x86_64::%s data_sp contained mismatched "
+ "NativeRegisterContextFreeBSD_x86::%s data_sp contained mismatched "
"data size, expected %zu, actual %" PRIu64,
__FUNCTION__, REG_CONTEXT_SIZE, data_sp->GetByteSize());
return error;
@@ -577,7 +577,7 @@ Status NativeRegisterContextFreeBSD_x86_64::WriteAllRegisterValues(
const uint8_t *src = data_sp->GetBytes();
if (src == nullptr) {
error = Status::FromErrorStringWithFormat(
- "NativeRegisterContextFreeBSD_x86_64::%s "
+ "NativeRegisterContextFreeBSD_x86::%s "
"DataBuffer::GetBytes() returned a null "
"pointer",
__FUNCTION__);
@@ -593,9 +593,9 @@ Status NativeRegisterContextFreeBSD_x86_64::WriteAllRegisterValues(
return error;
}
-llvm::Error NativeRegisterContextFreeBSD_x86_64::CopyHardwareWatchpointsFrom(
+llvm::Error NativeRegisterContextFreeBSD_x86::CopyHardwareWatchpointsFrom(
NativeRegisterContextFreeBSD &source) {
- auto &r_source = static_cast<NativeRegisterContextFreeBSD_x86_64 &>(source);
+ auto &r_source = static_cast<NativeRegisterContextFreeBSD_x86 &>(source);
// NB: This implicitly reads the whole dbreg set.
RegisterValue dr7;
Status res = r_source.ReadRegister(GetDR(7), dr7);
@@ -611,8 +611,8 @@ llvm::Error NativeRegisterContextFreeBSD_x86_64::CopyHardwareWatchpointsFrom(
}
uint8_t *
-NativeRegisterContextFreeBSD_x86_64::GetOffsetRegSetData(RegSetKind set,
- size_t reg_offset) {
+NativeRegisterContextFreeBSD_x86::GetOffsetRegSetData(RegSetKind set,
+ size_t reg_offset) {
uint8_t *base;
switch (set) {
case GPRegSet:
@@ -633,8 +633,8 @@ NativeRegisterContextFreeBSD_x86_64::GetOffsetRegSetData(RegSetKind set,
return base + (reg_offset - m_regset_offsets[set]);
}
-std::optional<NativeRegisterContextFreeBSD_x86_64::YMMSplitPtr>
-NativeRegisterContextFreeBSD_x86_64::GetYMMSplitReg(uint32_t reg) {
+std::optional<NativeRegisterContextFreeBSD_x86::YMMSplitPtr>
+NativeRegisterContextFreeBSD_x86::GetYMMSplitReg(uint32_t reg) {
uint32_t offset = m_xsave_offsets[YMMRegSet];
if (offset == LLDB_INVALID_XSAVE_OFFSET)
return std::nullopt;
@@ -657,4 +657,4 @@ NativeRegisterContextFreeBSD_x86_64::GetYMMSplitReg(uint32_t reg) {
return YMMSplitPtr{&fpreg->sv_xmm[reg_index], &ymmreg[reg_index]};
}
-#endif // defined(__x86_64__)
+#endif // defined(__i386__) || defined(__x86_64__)
diff --git a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.h b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86.h
similarity index 81%
rename from lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.h
rename to lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86.h
index 8546bcb7a378b..0d8b6c3c9dcf6 100644
--- a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.h
+++ b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86.h
@@ -1,4 +1,4 @@
-//===-- NativeRegisterContextFreeBSD_x86_64.h -------------------*- C++ -*-===//
+//===-- NativeRegisterContextFreeBSD_x86.h ----------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -8,8 +8,8 @@
#if defined(__i386__) || defined(__x86_64__)
-#ifndef lldb_NativeRegisterContextFreeBSD_x86_64_h
-#define lldb_NativeRegisterContextFreeBSD_x86_64_h
+#ifndef lldb_NativeRegisterContextFreeBSD_x86_h
+#define lldb_NativeRegisterContextFreeBSD_x86_h
// clang-format off
#include <sys/param.h>
@@ -33,12 +33,11 @@ namespace process_freebsd {
class NativeProcessFreeBSD;
-class NativeRegisterContextFreeBSD_x86_64
- : public NativeRegisterContextFreeBSD,
- public NativeRegisterContextDBReg_x86 {
+class NativeRegisterContextFreeBSD_x86 : public NativeRegisterContextFreeBSD,
+ public NativeRegisterContextDBReg_x86 {
public:
- NativeRegisterContextFreeBSD_x86_64(const ArchSpec &target_arch,
- NativeThreadFreeBSD &native_thread);
+ NativeRegisterContextFreeBSD_x86(const ArchSpec &target_arch,
+ NativeThreadFreeBSD &native_thread);
uint32_t GetRegisterSetCount() const override;
const RegisterSet *GetRegisterSet(uint32_t set_index) const override;
@@ -92,6 +91,6 @@ class NativeRegisterContextFreeBSD_x86_64
} // namespace process_freebsd
} // namespace lldb_private
-#endif // #ifndef lldb_NativeRegisterContextFreeBSD_x86_64_h
+#endif // #ifndef lldb_NativeRegisterContextFreeBSD_x86_h
-#endif // defined(__x86_64__)
+#endif // defined(__i386__) || defined(__x86_64__)
diff --git a/lldb/source/Plugins/Process/Linux/CMakeLists.txt b/lldb/source/Plugins/Process/Linux/CMakeLists.txt
index bb69016702cdf..ce624a5211b05 100644
--- a/lldb/source/Plugins/Process/Linux/CMakeLists.txt
+++ b/lldb/source/Plugins/Process/Linux/CMakeLists.txt
@@ -13,7 +13,7 @@ add_lldb_library(lldbPluginProcessLinux
NativeRegisterContextLinux_ppc64le.cpp
NativeRegisterContextLinux_riscv64.cpp
NativeRegisterContextLinux_s390x.cpp
- NativeRegisterContextLinux_x86_64.cpp
+ NativeRegisterContextLinux_x86.cpp
NativeThreadLinux.cpp
Perf.cpp
Procfs.cpp
diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86.cpp
similarity index 81%
rename from lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
rename to lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86.cpp
index 77260c7382cf7..773e730949c2e 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86.cpp
@@ -1,4 +1,4 @@
-//===-- NativeRegisterContextLinux_x86_64.cpp -----------------------------===//
+//===-- NativeRegisterContextLinux_x86.cpp --------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -8,7 +8,7 @@
#if defined(__i386__) || defined(__x86_64__)
-#include "NativeRegisterContextLinux_x86_64.h"
+#include "NativeRegisterContextLinux_x86.h"
#include "Plugins/Process/Linux/NativeThreadLinux.h"
#include "Plugins/Process/Utility/RegisterContextLinux_i386.h"
#include "Plugins/Process/Utility/RegisterContextLinux_x86_64.h"
@@ -24,11 +24,9 @@
// Newer toolchains define __get_cpuid_count in cpuid.h, but some
// older-but-still-supported ones (e.g. gcc 5.4.0) don't, so we
// define it locally here, following the definition in clang/lib/Headers.
-static inline int get_cpuid_count(unsigned int __leaf,
- unsigned int __subleaf,
+static inline int get_cpuid_count(unsigned int __leaf, unsigned int __subleaf,
unsigned int *__eax, unsigned int *__ebx,
- unsigned int *__ecx, unsigned int *__edx)
-{
+ unsigned int *__ecx, unsigned int *__edx) {
unsigned int __max_leaf = __get_cpuid_max(__leaf & 0x80000000, nullptr);
if (__max_leaf == 0 || __max_leaf < __leaf)
@@ -89,8 +87,8 @@ static_assert((sizeof(g_avx_regnums_i386) / sizeof(g_avx_regnums_i386[0])) -
// x64 32-bit MPX registers.
static const uint32_t g_mpx_regnums_i386[] = {
- lldb_bnd0_i386, lldb_bnd1_i386, lldb_bnd2_i386, lldb_bnd3_i386,
- lldb_bndcfgu_i386, lldb_bndstatus_i386,
+ lldb_bnd0_i386, lldb_bnd1_i386, lldb_bnd2_i386,
+ lldb_bnd3_i386, lldb_bndcfgu_i386, lldb_bndstatus_i386,
LLDB_INVALID_REGNUM // register sets need to end with this flag
};
static_assert((sizeof(g_mpx_regnums_i386) / sizeof(g_mpx_regnums_i386[0])) -
@@ -100,15 +98,40 @@ static_assert((sizeof(g_mpx_regnums_i386) / sizeof(g_mpx_regnums_i386[0])) -
// x86 64-bit general purpose registers.
static const uint32_t g_gpr_regnums_x86_64[] = {
- x86_64_with_base::lldb_rax, x86_64_with_base::lldb_rbx, x86_64_with_base::lldb_rcx, x86_64_with_base::lldb_rdx,
- x86_64_with_base::lldb_rdi, x86_64_with_base::lldb_rsi, x86_64_with_base::lldb_rbp, x86_64_with_base::lldb_rsp,
- x86_64_with_base::lldb_r8, x86_64_with_base::lldb_r9, x86_64_with_base::lldb_r10, x86_64_with_base::lldb_r11,
- x86_64_with_base::lldb_r12, x86_64_with_base::lldb_r13, x86_64_with_base::lldb_r14, x86_64_with_base::lldb_r15,
- x86_64_with_base::lldb_rip, x86_64_with_base::lldb_rflags, x86_64_with_base::lldb_cs, x86_64_with_base::lldb_fs,
- x86_64_with_base::lldb_gs, x86_64_with_base::lldb_ss, x86_64_with_base::lldb_fs_base, x86_64_with_base::lldb_gs_base,
- x86_64_with_base::lldb_ds, x86_64_with_base::lldb_es,
- x86_64_with_base::lldb_eax, x86_64_with_base::lldb_ebx, x86_64_with_base::lldb_ecx, x86_64_with_base::lldb_edx,
- x86_64_with_base::lldb_edi, x86_64_with_base::lldb_esi, x86_64_with_base::lldb_ebp, x86_64_with_base::lldb_esp,
+ x86_64_with_base::lldb_rax,
+ x86_64_with_base::lldb_rbx,
+ x86_64_with_base::lldb_rcx,
+ x86_64_with_base::lldb_rdx,
+ x86_64_with_base::lldb_rdi,
+ x86_64_with_base::lldb_rsi,
+ x86_64_with_base::lldb_rbp,
+ x86_64_with_base::lldb_rsp,
+ x86_64_with_base::lldb_r8,
+ x86_64_with_base::lldb_r9,
+ x86_64_with_base::lldb_r10,
+ x86_64_with_base::lldb_r11,
+ x86_64_with_base::lldb_r12,
+ x86_64_with_base::lldb_r13,
+ x86_64_with_base::lldb_r14,
+ x86_64_with_base::lldb_r15,
+ x86_64_with_base::lldb_rip,
+ x86_64_with_base::lldb_rflags,
+ x86_64_with_base::lldb_cs,
+ x86_64_with_base::lldb_fs,
+ x86_64_with_base::lldb_gs,
+ x86_64_with_base::lldb_ss,
+ x86_64_with_base::lldb_fs_base,
+ x86_64_with_base::lldb_gs_base,
+ x86_64_with_base::lldb_ds,
+ x86_64_with_base::lldb_es,
+ x86_64_with_base::lldb_eax,
+ x86_64_with_base::lldb_ebx,
+ x86_64_with_base::lldb_ecx,
+ x86_64_with_base::lldb_edx,
+ x86_64_with_base::lldb_edi,
+ x86_64_with_base::lldb_esi,
+ x86_64_with_base::lldb_ebp,
+ x86_64_with_base::lldb_esp,
x86_64_with_base::lldb_r8d, // Low 32 bits or r8
x86_64_with_base::lldb_r9d, // Low 32 bits or r9
x86_64_with_base::lldb_r10d, // Low 32 bits or r10
@@ -117,8 +140,14 @@ static const uint32_t g_gpr_regnums_x86_64[] = {
x86_64_with_base::lldb_r13d, // Low 32 bits or r13
x86_64_with_base::lldb_r14d, // Low 32 bits or r14
x86_64_with_base::lldb_r15d, // Low 32 bits or r15
- x86_64_with_base::lldb_ax, x86_64_with_base::lldb_bx, x86_64_with_base::lldb_cx, x86_64_with_base::lldb_dx,
- x86_64_with_base::lldb_di, x86_64_with_base::lldb_si, x86_64_with_base::lldb_bp, x86_64_with_base::lldb_sp,
+ x86_64_with_base::lldb_ax,
+ x86_64_with_base::lldb_bx,
+ x86_64_with_base::lldb_cx,
+ x86_64_with_base::lldb_dx,
+ x86_64_with_base::lldb_di,
+ x86_64_with_base::lldb_si,
+ x86_64_with_base::lldb_bp,
+ x86_64_with_base::lldb_sp,
x86_64_with_base::lldb_r8w, // Low 16 bits or r8
x86_64_with_base::lldb_r9w, // Low 16 bits or r9
x86_64_with_base::lldb_r10w, // Low 16 bits or r10
@@ -127,18 +156,27 @@ static const uint32_t g_gpr_regnums_x86_64[] = {
x86_64_with_base::lldb_r13w, // Low 16 bits or r13
x86_64_with_base::lldb_r14w, // Low 16 bits or r14
x86_64_with_base::lldb_r15w, // Low 16 bits or r15
- x86_64_with_base::lldb_ah, x86_64_with_base::lldb_bh, x86_64_with_base::lldb_ch, x86_64_with_base::lldb_dh,
- x86_64_with_base::lldb_al, x86_64_with_base::lldb_bl, x86_64_with_base::lldb_cl, x86_64_with_base::lldb_dl,
- x86_64_with_base::lldb_dil, x86_64_with_base::lldb_sil, x86_64_with_base::lldb_bpl, x86_64_with_base::lldb_spl,
- x86_64_with_base::lldb_r8l, // Low 8 bits or r8
- x86_64_with_base::lldb_r9l, // Low 8 bits or r9
- x86_64_with_base::lldb_r10l, // Low 8 bits or r10
- x86_64_with_base::lldb_r11l, // Low 8 bits or r11
- x86_64_with_base::lldb_r12l, // Low 8 bits or r12
- x86_64_with_base::lldb_r13l, // Low 8 bits or r13
- x86_64_with_base::lldb_r14l, // Low 8 bits or r14
- x86_64_with_base::lldb_r15l, // Low 8 bits or r15
- LLDB_INVALID_REGNUM // register sets need to end with this flag
+ x86_64_with_base::lldb_ah,
+ x86_64_with_base::lldb_bh,
+ x86_64_with_base::lldb_ch,
+ x86_64_with_base::lldb_dh,
+ x86_64_with_base::lldb_al,
+ x86_64_with_base::lldb_bl,
+ x86_64_with_base::lldb_cl,
+ x86_64_with_base::lldb_dl,
+ x86_64_with_base::lldb_dil,
+ x86_64_with_base::lldb_sil,
+ x86_64_with_base::lldb_bpl,
+ x86_64_with_base::lldb_spl,
+ x86_64_with_base::lldb_r8l, // Low 8 bits or r8
+ x86_64_with_base::lldb_r9l, // Low 8 bits or r9
+ x86_64_with_base::lldb_r10l, // Low 8 bits or r10
+ x86_64_with_base::lldb_r11l, // Low 8 bits or r11
+ x86_64_with_base::lldb_r12l, // Low 8 bits or r12
+ x86_64_with_base::lldb_r13l, // Low 8 bits or r13
+ x86_64_with_base::lldb_r14l, // Low 8 bits or r14
+ x86_64_with_base::lldb_r15l, // Low 8 bits or r15
+ LLDB_INVALID_REGNUM // register sets need to end with this flag
};
static_assert((sizeof(g_gpr_regnums_x86_64) / sizeof(g_gpr_regnums_x86_64[0])) -
1 ==
@@ -147,21 +185,28 @@ static_assert((sizeof(g_gpr_regnums_x86_64) / sizeof(g_gpr_regnums_x86_64[0])) -
// x86 64-bit floating point registers.
static const uint32_t g_fpu_regnums_x86_64[] = {
- x86_64_with_base::lldb_fctrl, x86_64_with_base::lldb_fstat, x86_64_with_base::lldb_ftag,
- x86_64_with_base::lldb_fop, x86_64_with_base::lldb_fiseg, x86_64_with_base::lldb_fioff,
- x86_64_with_base::lldb_fip, x86_64_with_base::lldb_foseg, x86_64_with_base::lldb_fooff,
- x86_64_with_base::lldb_fdp, x86_64_with_base::lldb_mxcsr, x86_64_with_base::lldb_mxcsrmask,
- x86_64_with_base::lldb_st0, x86_64_with_base::lldb_st1, x86_64_with_base::lldb_st2,
- x86_64_with_base::lldb_st3, x86_64_with_base::lldb_st4, x86_64_with_base::lldb_st5,
- x86_64_with_base::lldb_st6, x86_64_with_base::lldb_st7, x86_64_with_base::lldb_mm0,
- x86_64_with_base::lldb_mm1, x86_64_with_base::lldb_mm2, x86_64_with_base::lldb_mm3,
- x86_64_with_base::lldb_mm4, x86_64_with_base::lldb_mm5, x86_64_with_base::lldb_mm6,
- x86_64_with_base::lldb_mm7, x86_64_with_base::lldb_xmm0, x86_64_with_base::lldb_xmm1,
- x86_64_with_base::lldb_xmm2, x86_64_with_base::lldb_xmm3, x86_64_with_base::lldb_xmm4,
- x86_64_with_base::lldb_xmm5, x86_64_with_base::lldb_xmm6, x86_64_with_base::lldb_xmm7,
- x86_64_with_base::lldb_xmm8, x86_64_with_base::lldb_xmm9, x86_64_with_base::lldb_xmm10,
- x86_64_with_base::lldb_xmm11, x86_64_with_base::lldb_xmm12, x86_64_with_base::lldb_xmm13,
- x86_64_with_base::lldb_xmm14, x86_64_with_base::lldb_xmm15,
+ x86_64_with_base::lldb_fctrl, x86_64_with_base::lldb_fstat,
+ x86_64_with_base::lldb_ftag, x86_64_with_base::lldb_fop,
+ x86_64_with_base::lldb_fiseg, x86_64_with_base::lldb_fioff,
+ x86_64_with_base::lldb_fip, x86_64_with_base::lldb_foseg,
+ x86_64_with_base::lldb_fooff, x86_64_with_base::lldb_fdp,
+ x86_64_with_base::lldb_mxcsr, x86_64_with_base::lldb_mxcsrmask,
+ x86_64_with_base::lldb_st0, x86_64_with_base::lldb_st1,
+ x86_64_with_base::lldb_st2, x86_64_with_base::lldb_st3,
+ x86_64_with_base::lldb_st4, x86_64_with_base::lldb_st5,
+ x86_64_with_base::lldb_st6, x86_64_with_base::lldb_st7,
+ x86_64_with_base::lldb_mm0, x86_64_with_base::lldb_mm1,
+ x86_64_with_base::lldb_mm2, x86_64_with_base::lldb_mm3,
+ x86_64_with_base::lldb_mm4, x86_64_with_base::lldb_mm5,
+ x86_64_with_base::lldb_mm6, x86_64_with_base::lldb_mm7,
+ x86_64_with_base::lldb_xmm0, x86_64_with_base::lldb_xmm1,
+ x86_64_with_base::lldb_xmm2, x86_64_with_base::lldb_xmm3,
+ x86_64_with_base::lldb_xmm4, x86_64_with_base::lldb_xmm5,
+ x86_64_with_base::lldb_xmm6, x86_64_with_base::lldb_xmm7,
+ x86_64_with_base::lldb_xmm8, x86_64_with_base::lldb_xmm9,
+ x86_64_with_base::lldb_xmm10, x86_64_with_base::lldb_xmm11,
+ x86_64_with_base::lldb_xmm12, x86_64_with_base::lldb_xmm13,
+ x86_64_with_base::lldb_xmm14, x86_64_with_base::lldb_xmm15,
LLDB_INVALID_REGNUM // register sets need to end with this flag
};
static_assert((sizeof(g_fpu_regnums_x86_64) / sizeof(g_fpu_regnums_x86_64[0])) -
@@ -171,10 +216,14 @@ static_assert((sizeof(g_fpu_regnums_x86_64) / sizeof(g_fpu_regnums_x86_64[0])) -
// x86 64-bit AVX registers.
static const uint32_t g_avx_regnums_x86_64[] = {
- x86_64_with_base::lldb_ymm0, x86_64_with_base::lldb_ymm1, x86_64_with_base::lldb_ymm2, x86_64_with_base::lldb_ymm3,
- x86_64_with_base::lldb_ymm4, x86_64_with_base::lldb_ymm5, x86_64_with_base::lldb_ymm6, x86_64_with_base::lldb_ymm7,
- x86_64_with_base::lldb_ymm8, x86_64_with_base::lldb_ymm9, x86_64_with_base::lldb_ymm10, x86_64_with_base::lldb_ymm11,
- x86_64_with_base::lldb_ymm12, x86_64_with_base::lldb_ymm13, x86_64_with_base::lldb_ymm14, x86_64_with_base::lldb_ymm15,
+ x86_64_with_base::lldb_ymm0, x86_64_with_base::lldb_ymm1,
+ x86_64_with_base::lldb_ymm2, x86_64_with_base::lldb_ymm3,
+ x86_64_with_base::lldb_ymm4, x86_64_with_base::lldb_ymm5,
+ x86_64_with_base::lldb_ymm6, x86_64_with_base::lldb_ymm7,
+ x86_64_with_base::lldb_ymm8, x86_64_with_base::lldb_ymm9,
+ x86_64_with_base::lldb_ymm10, x86_64_with_base::lldb_ymm11,
+ x86_64_with_base::lldb_ymm12, x86_64_with_base::lldb_ymm13,
+ x86_64_with_base::lldb_ymm14, x86_64_with_base::lldb_ymm15,
LLDB_INVALID_REGNUM // register sets need to end with this flag
};
static_assert((sizeof(g_avx_regnums_x86_64) / sizeof(g_avx_regnums_x86_64[0])) -
@@ -184,8 +233,12 @@ static_assert((sizeof(g_avx_regnums_x86_64) / sizeof(g_avx_regnums_x86_64[0])) -
// x86 64-bit MPX registers.
static const uint32_t g_mpx_regnums_x86_64[] = {
- x86_64_with_base::lldb_bnd0, x86_64_with_base::lldb_bnd1, x86_64_with_base::lldb_bnd2,
- x86_64_with_base::lldb_bnd3, x86_64_with_base::lldb_bndcfgu, x86_64_with_base::lldb_bndstatus,
+ x86_64_with_base::lldb_bnd0,
+ x86_64_with_base::lldb_bnd1,
+ x86_64_with_base::lldb_bnd2,
+ x86_64_with_base::lldb_bnd3,
+ x86_64_with_base::lldb_bndcfgu,
+ x86_64_with_base::lldb_bndstatus,
LLDB_INVALID_REGNUM // register sets need to end with this flag
};
static_assert((sizeof(g_mpx_regnums_x86_64) / sizeof(g_mpx_regnums_x86_64[0])) -
@@ -204,7 +257,7 @@ static const RegisterSet g_reg_sets_i386[k_num_register_sets] = {
g_fpu_regnums_i386},
{"Advanced Vector Extensions", "avx", k_num_avx_registers_i386,
g_avx_regnums_i386},
- { "Memory Protection Extensions", "mpx", k_num_mpx_registers_i386,
+ {"Memory Protection Extensions", "mpx", k_num_mpx_registers_i386,
g_mpx_regnums_i386}};
// Register sets for x86 64-bit.
@@ -215,8 +268,8 @@ static const RegisterSet g_reg_sets_x86_64[k_num_register_sets] = {
g_fpu_regnums_x86_64},
{"Advanced Vector Extensions", "avx", x86_64_with_base::k_num_avx_registers,
g_avx_regnums_x86_64},
- { "Memory Protection Extensions", "mpx", x86_64_with_base::k_num_mpx_registers,
- g_mpx_regnums_x86_64}};
+ {"Memory Protection Extensions", "mpx",
+ x86_64_with_base::k_num_mpx_registers, g_mpx_regnums_x86_64}};
#define REG_CONTEXT_SIZE (GetRegisterInfoInterface().GetGPRSize() + sizeof(FPR))
@@ -253,7 +306,7 @@ std::unique_ptr<NativeRegisterContextLinux>
NativeRegisterContextLinux::CreateHostNativeRegisterContextLinux(
const ArchSpec &target_arch, NativeThreadLinux &native_thread) {
return std::unique_ptr<NativeRegisterContextLinux>(
- new NativeRegisterContextLinux_x86_64(target_arch, native_thread));
+ new NativeRegisterContextLinux_x86(target_arch, native_thread));
}
llvm::Expected<ArchSpec>
@@ -262,7 +315,7 @@ NativeRegisterContextLinux::DetermineArchitecture(lldb::tid_t tid) {
tid, RegisterContextLinux_x86_64::GetGPRSizeStatic());
}
-// NativeRegisterContextLinux_x86_64 members.
+// NativeRegisterContextLinux_x86 members.
static std::unique_ptr<RegisterContextLinux_x86>
CreateRegisterInfoInterface(const ArchSpec &target_arch) {
@@ -295,7 +348,7 @@ static std::size_t GetXSTATESize() {
return std::max<std::size_t>(ecx, sizeof(FPR));
}
-NativeRegisterContextLinux_x86_64::NativeRegisterContextLinux_x86_64(
+NativeRegisterContextLinux_x86::NativeRegisterContextLinux_x86(
const ArchSpec &target_arch, NativeThreadProtocol &native_thread)
: NativeRegisterContextRegisterInfo(
native_thread, CreateRegisterInfoInterface(target_arch).release()),
@@ -375,7 +428,7 @@ NativeRegisterContextLinux_x86_64::NativeRegisterContextLinux_x86_64(
// CONSIDER after local and llgs debugging are merged, register set support can
// be moved into a base x86-64 class with IsRegisterSetAvailable made virtual.
-uint32_t NativeRegisterContextLinux_x86_64::GetRegisterSetCount() const {
+uint32_t NativeRegisterContextLinux_x86::GetRegisterSetCount() const {
uint32_t sets = 0;
for (uint32_t set_index = 0; set_index < k_num_register_sets; ++set_index) {
if (IsRegisterSetAvailable(set_index))
@@ -385,7 +438,7 @@ uint32_t NativeRegisterContextLinux_x86_64::GetRegisterSetCount() const {
return sets;
}
-uint32_t NativeRegisterContextLinux_x86_64::GetUserRegisterCount() const {
+uint32_t NativeRegisterContextLinux_x86::GetUserRegisterCount() const {
uint32_t count = 0;
for (uint32_t set_index = 0; set_index < k_num_register_sets; ++set_index) {
const RegisterSet *set = GetRegisterSet(set_index);
@@ -396,7 +449,7 @@ uint32_t NativeRegisterContextLinux_x86_64::GetUserRegisterCount() const {
}
const RegisterSet *
-NativeRegisterContextLinux_x86_64::GetRegisterSet(uint32_t set_index) const {
+NativeRegisterContextLinux_x86::GetRegisterSet(uint32_t set_index) const {
if (!IsRegisterSetAvailable(set_index))
return nullptr;
@@ -414,8 +467,8 @@ NativeRegisterContextLinux_x86_64::GetRegisterSet(uint32_t set_index) const {
}
Status
-NativeRegisterContextLinux_x86_64::ReadRegister(const RegisterInfo *reg_info,
- RegisterValue ®_value) {
+NativeRegisterContextLinux_x86::ReadRegister(const RegisterInfo *reg_info,
+ RegisterValue ®_value) {
Status error;
if (!reg_info) {
@@ -566,8 +619,7 @@ NativeRegisterContextLinux_x86_64::ReadRegister(const RegisterInfo *reg_info,
return error;
}
-void NativeRegisterContextLinux_x86_64::UpdateXSTATEforWrite(
- uint32_t reg_index) {
+void NativeRegisterContextLinux_x86::UpdateXSTATEforWrite(uint32_t reg_index) {
XSAVE_HDR::XFeature &xstate_bv = m_xstate->xsave.header.xstate_bv;
if (IsFPR(reg_index)) {
// IsFPR considers both %st and %xmm registers as floating point, but these
@@ -582,8 +634,9 @@ void NativeRegisterContextLinux_x86_64::UpdateXSTATEforWrite(
}
}
-Status NativeRegisterContextLinux_x86_64::WriteRegister(
- const RegisterInfo *reg_info, const RegisterValue ®_value) {
+Status
+NativeRegisterContextLinux_x86::WriteRegister(const RegisterInfo *reg_info,
+ const RegisterValue ®_value) {
assert(reg_info && "reg_info is null");
const uint32_t reg_index = reg_info->kinds[lldb::eRegisterKindLLDB];
@@ -697,7 +750,7 @@ Status NativeRegisterContextLinux_x86_64::WriteRegister(
"write strategy unknown");
}
-Status NativeRegisterContextLinux_x86_64::ReadAllRegisterValues(
+Status NativeRegisterContextLinux_x86::ReadAllRegisterValues(
lldb::WritableDataBufferSP &data_sp) {
Status error;
@@ -724,7 +777,7 @@ Status NativeRegisterContextLinux_x86_64::ReadAllRegisterValues(
++reg) {
if (!CopyXSTATEtoYMM(reg, byte_order)) {
error = Status::FromErrorStringWithFormat(
- "NativeRegisterContextLinux_x86_64::%s "
+ "NativeRegisterContextLinux_x86::%s "
"CopyXSTATEtoYMM() failed for reg num "
"%" PRIu32,
__FUNCTION__, reg);
@@ -738,7 +791,7 @@ Status NativeRegisterContextLinux_x86_64::ReadAllRegisterValues(
++reg) {
if (!CopyXSTATEtoMPX(reg)) {
error = Status::FromErrorStringWithFormat(
- "NativeRegisterContextLinux_x86_64::%s "
+ "NativeRegisterContextLinux_x86::%s "
"CopyXSTATEtoMPX() failed for reg num "
"%" PRIu32,
__FUNCTION__, reg);
@@ -767,13 +820,13 @@ Status NativeRegisterContextLinux_x86_64::ReadAllRegisterValues(
return error;
}
-Status NativeRegisterContextLinux_x86_64::WriteAllRegisterValues(
+Status NativeRegisterContextLinux_x86::WriteAllRegisterValues(
const lldb::DataBufferSP &data_sp) {
Status error;
if (!data_sp) {
error = Status::FromErrorStringWithFormat(
- "NativeRegisterContextLinux_x86_64::%s invalid data_sp provided",
+ "NativeRegisterContextLinux_x86::%s invalid data_sp provided",
__FUNCTION__);
return error;
}
@@ -788,7 +841,7 @@ Status NativeRegisterContextLinux_x86_64::WriteAllRegisterValues(
const uint8_t *src = data_sp->GetBytes();
if (src == nullptr) {
error = Status::FromErrorStringWithFormat(
- "NativeRegisterContextLinux_x86_64::%s "
+ "NativeRegisterContextLinux_x86::%s "
"DataBuffer::GetBytes() returned a null "
"pointer",
__FUNCTION__);
@@ -819,7 +872,7 @@ Status NativeRegisterContextLinux_x86_64::WriteAllRegisterValues(
++reg) {
if (!CopyYMMtoXSTATE(reg, byte_order)) {
error = Status::FromErrorStringWithFormat(
- "NativeRegisterContextLinux_x86_64::%s "
+ "NativeRegisterContextLinux_x86::%s "
"CopyYMMtoXSTATE() failed for reg num "
"%" PRIu32,
__FUNCTION__, reg);
@@ -833,7 +886,7 @@ Status NativeRegisterContextLinux_x86_64::WriteAllRegisterValues(
++reg) {
if (!CopyMPXtoXSTATE(reg)) {
error = Status::FromErrorStringWithFormat(
- "NativeRegisterContextLinux_x86_64::%s "
+ "NativeRegisterContextLinux_x86::%s "
"CopyMPXtoXSTATE() failed for reg num "
"%" PRIu32,
__FUNCTION__, reg);
@@ -846,10 +899,10 @@ Status NativeRegisterContextLinux_x86_64::WriteAllRegisterValues(
return error;
}
-bool NativeRegisterContextLinux_x86_64::IsCPUFeatureAvailable(
+bool NativeRegisterContextLinux_x86::IsCPUFeatureAvailable(
RegSet feature_code) const {
if (m_xstate_type == XStateType::Invalid) {
- if (const_cast<NativeRegisterContextLinux_x86_64 *>(this)->ReadFPR().Fail())
+ if (const_cast<NativeRegisterContextLinux_x86 *>(this)->ReadFPR().Fail())
return false;
}
switch (feature_code) {
@@ -860,7 +913,7 @@ bool NativeRegisterContextLinux_x86_64::IsCPUFeatureAvailable(
// reading in the XCR0 area of XSAVE.
if ((m_xstate->xsave.i387.xcr0 & mask_XSTATE_AVX) == mask_XSTATE_AVX)
return true;
- break;
+ break;
case RegSet::mpx: // Check if CPU has MPX and if there is kernel support, by
// reading in the XCR0 area of XSAVE.
if ((m_xstate->xsave.i387.xcr0 & mask_XSTATE_MPX) == mask_XSTATE_MPX)
@@ -870,7 +923,7 @@ bool NativeRegisterContextLinux_x86_64::IsCPUFeatureAvailable(
return false;
}
-bool NativeRegisterContextLinux_x86_64::IsRegisterSetAvailable(
+bool NativeRegisterContextLinux_x86::IsRegisterSetAvailable(
uint32_t set_index) const {
uint32_t num_sets = k_num_register_sets - k_num_extended_register_sets;
@@ -886,22 +939,21 @@ bool NativeRegisterContextLinux_x86_64::IsRegisterSetAvailable(
return false;
}
-bool NativeRegisterContextLinux_x86_64::IsGPR(uint32_t reg_index) const {
+bool NativeRegisterContextLinux_x86::IsGPR(uint32_t reg_index) const {
// GPRs come first.
return reg_index <= m_reg_info.last_gpr;
}
-bool NativeRegisterContextLinux_x86_64::IsFPR(uint32_t reg_index) const {
+bool NativeRegisterContextLinux_x86::IsFPR(uint32_t reg_index) const {
return (m_reg_info.first_fpr <= reg_index &&
reg_index <= m_reg_info.last_fpr);
}
-bool NativeRegisterContextLinux_x86_64::IsDR(uint32_t reg_index) const {
- return (m_reg_info.first_dr <= reg_index &&
- reg_index <= m_reg_info.last_dr);
+bool NativeRegisterContextLinux_x86::IsDR(uint32_t reg_index) const {
+ return (m_reg_info.first_dr <= reg_index && reg_index <= m_reg_info.last_dr);
}
-Status NativeRegisterContextLinux_x86_64::WriteFPR() {
+Status NativeRegisterContextLinux_x86::WriteFPR() {
switch (m_xstate_type) {
case XStateType::FXSAVE:
return WriteRegisterSet(
@@ -914,46 +966,44 @@ Status NativeRegisterContextLinux_x86_64::WriteFPR() {
}
}
-bool NativeRegisterContextLinux_x86_64::IsAVX(uint32_t reg_index) const {
+bool NativeRegisterContextLinux_x86::IsAVX(uint32_t reg_index) const {
if (!IsCPUFeatureAvailable(RegSet::avx))
return false;
return (m_reg_info.first_ymm <= reg_index &&
reg_index <= m_reg_info.last_ymm);
}
-bool NativeRegisterContextLinux_x86_64::CopyXSTATEtoYMM(
+bool NativeRegisterContextLinux_x86::CopyXSTATEtoYMM(
uint32_t reg_index, lldb::ByteOrder byte_order) {
if (!IsAVX(reg_index))
return false;
if (byte_order == lldb::eByteOrderLittle) {
uint32_t reg_no = reg_index - m_reg_info.first_ymm;
- m_ymm_set.ymm[reg_no] = XStateToYMM(
- m_xstate->fxsave.xmm[reg_no].bytes,
- m_xstate->xsave.ymmh[reg_no].bytes);
+ m_ymm_set.ymm[reg_no] = XStateToYMM(m_xstate->fxsave.xmm[reg_no].bytes,
+ m_xstate->xsave.ymmh[reg_no].bytes);
return true;
}
return false; // unsupported or invalid byte order
}
-bool NativeRegisterContextLinux_x86_64::CopyYMMtoXSTATE(
+bool NativeRegisterContextLinux_x86::CopyYMMtoXSTATE(
uint32_t reg, lldb::ByteOrder byte_order) {
if (!IsAVX(reg))
return false;
if (byte_order == lldb::eByteOrderLittle) {
uint32_t reg_no = reg - m_reg_info.first_ymm;
- YMMToXState(m_ymm_set.ymm[reg_no],
- m_xstate->fxsave.xmm[reg_no].bytes,
- m_xstate->xsave.ymmh[reg_no].bytes);
+ YMMToXState(m_ymm_set.ymm[reg_no], m_xstate->fxsave.xmm[reg_no].bytes,
+ m_xstate->xsave.ymmh[reg_no].bytes);
return true;
}
return false; // unsupported or invalid byte order
}
-void *NativeRegisterContextLinux_x86_64::GetFPRBuffer() {
+void *NativeRegisterContextLinux_x86::GetFPRBuffer() {
switch (m_xstate_type) {
case XStateType::FXSAVE:
return &m_xstate->fxsave;
@@ -964,7 +1014,7 @@ void *NativeRegisterContextLinux_x86_64::GetFPRBuffer() {
}
}
-size_t NativeRegisterContextLinux_x86_64::GetFPRSize() {
+size_t NativeRegisterContextLinux_x86::GetFPRSize() {
switch (m_xstate_type) {
case XStateType::FXSAVE:
return sizeof(m_xstate->fxsave);
@@ -975,7 +1025,7 @@ size_t NativeRegisterContextLinux_x86_64::GetFPRSize() {
}
}
-Status NativeRegisterContextLinux_x86_64::ReadFPR() {
+Status NativeRegisterContextLinux_x86::ReadFPR() {
Status error;
// Probe XSAVE and if it is not supported fall back to FXSAVE.
@@ -996,14 +1046,14 @@ Status NativeRegisterContextLinux_x86_64::ReadFPR() {
return Status::FromErrorString("Unrecognized FPR type.");
}
-bool NativeRegisterContextLinux_x86_64::IsMPX(uint32_t reg_index) const {
+bool NativeRegisterContextLinux_x86::IsMPX(uint32_t reg_index) const {
if (!IsCPUFeatureAvailable(RegSet::mpx))
return false;
return (m_reg_info.first_mpxr <= reg_index &&
reg_index <= m_reg_info.last_mpxc);
}
-bool NativeRegisterContextLinux_x86_64::CopyXSTATEtoMPX(uint32_t reg) {
+bool NativeRegisterContextLinux_x86::CopyXSTATEtoMPX(uint32_t reg) {
if (!IsMPX(reg))
return false;
@@ -1019,7 +1069,7 @@ bool NativeRegisterContextLinux_x86_64::CopyXSTATEtoMPX(uint32_t reg) {
return true;
}
-bool NativeRegisterContextLinux_x86_64::CopyMPXtoXSTATE(uint32_t reg) {
+bool NativeRegisterContextLinux_x86::CopyMPXtoXSTATE(uint32_t reg) {
if (!IsMPX(reg))
return false;
@@ -1033,15 +1083,14 @@ bool NativeRegisterContextLinux_x86_64::CopyMPXtoXSTATE(uint32_t reg) {
return true;
}
-uint32_t
-NativeRegisterContextLinux_x86_64::GetPtraceOffset(uint32_t reg_index) {
+uint32_t NativeRegisterContextLinux_x86::GetPtraceOffset(uint32_t reg_index) {
// If register is MPX, remove extra factor from gdb offset
return GetRegisterInfoAtIndex(reg_index)->byte_offset -
(IsMPX(reg_index) ? 128 : 0);
}
std::optional<NativeRegisterContextLinux::SyscallData>
-NativeRegisterContextLinux_x86_64::GetSyscallData() {
+NativeRegisterContextLinux_x86::GetSyscallData() {
switch (GetRegisterInfoInterface().GetTargetArchitecture().GetMachine()) {
case llvm::Triple::x86: {
static const uint8_t Int80[] = {0xcd, 0x80};
@@ -1053,8 +1102,10 @@ NativeRegisterContextLinux_x86_64::GetSyscallData() {
case llvm::Triple::x86_64: {
static const uint8_t Syscall[] = {0x0f, 0x05};
static const uint32_t Args[] = {
- x86_64_with_base::lldb_rax, x86_64_with_base::lldb_rdi, x86_64_with_base::lldb_rsi, x86_64_with_base::lldb_rdx,
- x86_64_with_base::lldb_r10, x86_64_with_base::lldb_r8, x86_64_with_base::lldb_r9};
+ x86_64_with_base::lldb_rax, x86_64_with_base::lldb_rdi,
+ x86_64_with_base::lldb_rsi, x86_64_with_base::lldb_rdx,
+ x86_64_with_base::lldb_r10, x86_64_with_base::lldb_r8,
+ x86_64_with_base::lldb_r9};
return SyscallData{Syscall, Args, x86_64_with_base::lldb_rax};
}
default:
@@ -1063,7 +1114,7 @@ NativeRegisterContextLinux_x86_64::GetSyscallData() {
}
std::optional<NativeRegisterContextLinux::MmapData>
-NativeRegisterContextLinux_x86_64::GetMmapData() {
+NativeRegisterContextLinux_x86::GetMmapData() {
switch (GetRegisterInfoInterface().GetTargetArchitecture().GetMachine()) {
case llvm::Triple::x86:
return MmapData{192, 91};
@@ -1074,7 +1125,7 @@ NativeRegisterContextLinux_x86_64::GetMmapData() {
}
}
-const RegisterInfo *NativeRegisterContextLinux_x86_64::GetDR(int num) const {
+const RegisterInfo *NativeRegisterContextLinux_x86::GetDR(int num) const {
assert(num >= 0 && num <= 7);
switch (GetRegisterInfoInterface().GetTargetArchitecture().GetMachine()) {
case llvm::Triple::x86:
diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86.h
similarity index 91%
rename from lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h
rename to lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86.h
index 0078f107d46a4..de5e886567a71 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86.h
@@ -1,4 +1,4 @@
-//===-- NativeRegisterContextLinux_x86_64.h ---------------------*- C++ -*-===//
+//===-- NativeRegisterContextLinux_x86.h ------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -8,8 +8,8 @@
#if defined(__i386__) || defined(__x86_64__)
-#ifndef lldb_NativeRegisterContextLinux_x86_64_h
-#define lldb_NativeRegisterContextLinux_x86_64_h
+#ifndef lldb_NativeRegisterContextLinux_x86_h
+#define lldb_NativeRegisterContextLinux_x86_h
#include "Plugins/Process/Linux/NativeRegisterContextLinux.h"
#include "Plugins/Process/Utility/NativeRegisterContextDBReg_x86.h"
@@ -24,11 +24,10 @@ namespace process_linux {
class NativeProcessLinux;
-class NativeRegisterContextLinux_x86_64
- : public NativeRegisterContextLinux,
- public NativeRegisterContextDBReg_x86 {
+class NativeRegisterContextLinux_x86 : public NativeRegisterContextLinux,
+ public NativeRegisterContextDBReg_x86 {
public:
- NativeRegisterContextLinux_x86_64(const ArchSpec &target_arch,
+ NativeRegisterContextLinux_x86(const ArchSpec &target_arch,
NativeThreadProtocol &native_thread);
uint32_t GetRegisterSetCount() const override;
diff --git a/lldb/source/Plugins/Process/NetBSD/CMakeLists.txt b/lldb/source/Plugins/Process/NetBSD/CMakeLists.txt
index f48ea86fb0a3e..438e6b6c2a3c7 100644
--- a/lldb/source/Plugins/Process/NetBSD/CMakeLists.txt
+++ b/lldb/source/Plugins/Process/NetBSD/CMakeLists.txt
@@ -1,7 +1,7 @@
add_lldb_library(lldbPluginProcessNetBSD
NativeProcessNetBSD.cpp
NativeRegisterContextNetBSD.cpp
- NativeRegisterContextNetBSD_x86_64.cpp
+ NativeRegisterContextNetBSD_x86.cpp
NativeThreadNetBSD.cpp
LINK_COMPONENTS
diff --git a/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp b/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86.cpp
similarity index 91%
rename from lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
rename to lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86.cpp
index c5c53a9c86401..79f6a9ab1267f 100644
--- a/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
+++ b/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86.cpp
@@ -1,4 +1,4 @@
-//===-- NativeRegisterContextNetBSD_x86_64.cpp ----------------------------===//
+//===-- NativeRegisterContextNetBSD_x86.cpp -------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -8,7 +8,7 @@
#if defined(__i386__) || defined(__x86_64__)
-#include "NativeRegisterContextNetBSD_x86_64.h"
+#include "NativeRegisterContextNetBSD_x86.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Utility/DataBufferHeap.h"
@@ -245,10 +245,10 @@ static const RegisterSet g_reg_sets_x86_64[k_num_register_sets] = {
NativeRegisterContextNetBSD *
NativeRegisterContextNetBSD::CreateHostNativeRegisterContextNetBSD(
const ArchSpec &target_arch, NativeThreadProtocol &native_thread) {
- return new NativeRegisterContextNetBSD_x86_64(target_arch, native_thread);
+ return new NativeRegisterContextLinux_x86(target_arch, native_thread);
}
-// NativeRegisterContextNetBSD_x86_64 members.
+// NativeRegisterContextLinux_x86 members.
static RegisterInfoInterface *
CreateRegisterInfoInterface(const ArchSpec &target_arch) {
@@ -264,7 +264,7 @@ CreateRegisterInfoInterface(const ArchSpec &target_arch) {
}
}
-NativeRegisterContextNetBSD_x86_64::NativeRegisterContextNetBSD_x86_64(
+NativeRegisterContextLinux_x86::NativeRegisterContextLinux_x86(
const ArchSpec &target_arch, NativeThreadProtocol &native_thread)
: NativeRegisterContextRegisterInfo(
native_thread, CreateRegisterInfoInterface(target_arch)),
@@ -291,12 +291,12 @@ NativeRegisterContextNetBSD_x86_64::NativeRegisterContextNetBSD_x86_64(
.byte_offset;
}
-uint32_t NativeRegisterContextNetBSD_x86_64::GetRegisterSetCount() const {
+uint32_t NativeRegisterContextLinux_x86::GetRegisterSetCount() const {
return k_num_register_sets;
}
const RegisterSet *
-NativeRegisterContextNetBSD_x86_64::GetRegisterSet(uint32_t set_index) const {
+NativeRegisterContextLinux_x86::GetRegisterSet(uint32_t set_index) const {
switch (GetRegisterInfoInterface().GetTargetArchitecture().GetMachine()) {
case llvm::Triple::x86:
return &g_reg_sets_i386[set_index];
@@ -307,9 +307,8 @@ NativeRegisterContextNetBSD_x86_64::GetRegisterSet(uint32_t set_index) const {
}
}
-std::optional<NativeRegisterContextNetBSD_x86_64::RegSetKind>
-NativeRegisterContextNetBSD_x86_64::GetSetForNativeRegNum(
- uint32_t reg_num) const {
+std::optional<NativeRegisterContextLinux_x86::RegSetKind>
+NativeRegisterContextLinux_x86::GetSetForNativeRegNum(uint32_t reg_num) const {
switch (GetRegisterInfoInterface().GetTargetArchitecture().GetMachine()) {
case llvm::Triple::x86:
if (reg_num >= k_first_gpr_i386 && reg_num <= k_last_gpr_i386)
@@ -346,7 +345,7 @@ NativeRegisterContextNetBSD_x86_64::GetSetForNativeRegNum(
llvm_unreachable("Register does not belong to any register set");
}
-Status NativeRegisterContextNetBSD_x86_64::ReadRegisterSet(RegSetKind set) {
+Status NativeRegisterContextLinux_x86::ReadRegisterSet(RegSetKind set) {
switch (set) {
case GPRegSet:
return DoRegisterSet(PT_GETREGS, m_gpr.data());
@@ -361,10 +360,10 @@ Status NativeRegisterContextNetBSD_x86_64::ReadRegisterSet(RegSetKind set) {
return ret;
}
}
- llvm_unreachable("NativeRegisterContextNetBSD_x86_64::ReadRegisterSet");
+ llvm_unreachable("NativeRegisterContextLinux_x86::ReadRegisterSet");
}
-Status NativeRegisterContextNetBSD_x86_64::WriteRegisterSet(RegSetKind set) {
+Status NativeRegisterContextLinux_x86::WriteRegisterSet(RegSetKind set) {
switch (set) {
case GPRegSet:
return DoRegisterSet(PT_SETREGS, m_gpr.data());
@@ -377,12 +376,12 @@ Status NativeRegisterContextNetBSD_x86_64::WriteRegisterSet(RegSetKind set) {
return DoRegisterSet(PT_SETXSTATE, &iov);
}
}
- llvm_unreachable("NativeRegisterContextNetBSD_x86_64::WriteRegisterSet");
+ llvm_unreachable("NativeRegisterContextLinux_x86::WriteRegisterSet");
}
Status
-NativeRegisterContextNetBSD_x86_64::ReadRegister(const RegisterInfo *reg_info,
- RegisterValue ®_value) {
+NativeRegisterContextLinux_x86::ReadRegister(const RegisterInfo *reg_info,
+ RegisterValue ®_value) {
Status error;
if (!reg_info) {
@@ -448,8 +447,9 @@ NativeRegisterContextNetBSD_x86_64::ReadRegister(const RegisterInfo *reg_info,
return error;
}
-Status NativeRegisterContextNetBSD_x86_64::WriteRegister(
- const RegisterInfo *reg_info, const RegisterValue ®_value) {
+Status
+NativeRegisterContextLinux_x86::WriteRegister(const RegisterInfo *reg_info,
+ const RegisterValue ®_value) {
Status error;
@@ -529,7 +529,7 @@ Status NativeRegisterContextNetBSD_x86_64::WriteRegister(
return WriteRegisterSet(set);
}
-Status NativeRegisterContextNetBSD_x86_64::ReadAllRegisterValues(
+Status NativeRegisterContextLinux_x86::ReadAllRegisterValues(
lldb::WritableDataBufferSP &data_sp) {
Status error;
@@ -545,20 +545,20 @@ Status NativeRegisterContextNetBSD_x86_64::ReadAllRegisterValues(
return error;
}
-Status NativeRegisterContextNetBSD_x86_64::WriteAllRegisterValues(
+Status NativeRegisterContextLinux_x86::WriteAllRegisterValues(
const lldb::DataBufferSP &data_sp) {
Status error;
if (!data_sp) {
error = Status::FromErrorStringWithFormat(
- "NativeRegisterContextNetBSD_x86_64::%s invalid data_sp provided",
+ "NativeRegisterContextLinux_x86::%s invalid data_sp provided",
__FUNCTION__);
return error;
}
if (data_sp->GetByteSize() != REG_CONTEXT_SIZE) {
error = Status::FromErrorStringWithFormat(
- "NativeRegisterContextNetBSD_x86_64::%s data_sp contained mismatched "
+ "NativeRegisterContextLinux_x86::%s data_sp contained mismatched "
"data size, expected %zu, actual %" PRIu64,
__FUNCTION__, REG_CONTEXT_SIZE, data_sp->GetByteSize());
return error;
@@ -567,7 +567,7 @@ Status NativeRegisterContextNetBSD_x86_64::WriteAllRegisterValues(
const uint8_t *src = data_sp->GetBytes();
if (src == nullptr) {
error = Status::FromErrorStringWithFormat(
- "NativeRegisterContextNetBSD_x86_64::%s "
+ "NativeRegisterContextLinux_x86::%s "
"DataBuffer::GetBytes() returned a null "
"pointer",
__FUNCTION__);
@@ -583,9 +583,9 @@ Status NativeRegisterContextNetBSD_x86_64::WriteAllRegisterValues(
return error;
}
-llvm::Error NativeRegisterContextNetBSD_x86_64::CopyHardwareWatchpointsFrom(
+llvm::Error NativeRegisterContextLinux_x86::CopyHardwareWatchpointsFrom(
NativeRegisterContextNetBSD &source) {
- auto &r_source = static_cast<NativeRegisterContextNetBSD_x86_64 &>(source);
+ auto &r_source = static_cast<NativeRegisterContextLinux_x86 &>(source);
// NB: This implicitly reads the whole dbreg set.
RegisterValue dr7;
Status res = r_source.ReadRegister(GetDR(7), dr7);
@@ -601,8 +601,8 @@ llvm::Error NativeRegisterContextNetBSD_x86_64::CopyHardwareWatchpointsFrom(
}
uint8_t *
-NativeRegisterContextNetBSD_x86_64::GetOffsetRegSetData(RegSetKind set,
- size_t reg_offset) {
+NativeRegisterContextLinux_x86::GetOffsetRegSetData(RegSetKind set,
+ size_t reg_offset) {
uint8_t *base;
switch (set) {
case GPRegSet:
@@ -623,8 +623,8 @@ NativeRegisterContextNetBSD_x86_64::GetOffsetRegSetData(RegSetKind set,
return base + (reg_offset - m_regset_offsets[set]);
}
-std::optional<NativeRegisterContextNetBSD_x86_64::YMMSplitPtr>
-NativeRegisterContextNetBSD_x86_64::GetYMMSplitReg(uint32_t reg) {
+std::optional<NativeRegisterContextLinux_x86::YMMSplitPtr>
+NativeRegisterContextLinux_x86::GetYMMSplitReg(uint32_t reg) {
auto xst = reinterpret_cast<xstate *>(m_xstate.data());
if (!(xst->xs_rfbm & XCR0_SSE) || !(xst->xs_rfbm & XCR0_YMM_Hi128))
return std::nullopt;
@@ -645,4 +645,4 @@ NativeRegisterContextNetBSD_x86_64::GetYMMSplitReg(uint32_t reg) {
&xst->xs_ymm_hi128.xs_ymm[reg_index]};
}
-#endif // defined(__x86_64__)
+#endif // defined(__i386__) || defined(__x86_64__)
diff --git a/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h b/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86.h
similarity index 80%
rename from lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h
rename to lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86.h
index e4597b2f69c6c..bb939eca478db 100644
--- a/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h
+++ b/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86.h
@@ -1,4 +1,4 @@
-//===-- NativeRegisterContextNetBSD_x86_64.h --------------------*- C++ -*-===//
+//===-- NativeRegisterContextNetBSD_x86.h -----------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -8,8 +8,8 @@
#if defined(__i386__) || defined(__x86_64__)
-#ifndef lldb_NativeRegisterContextNetBSD_x86_64_h
-#define lldb_NativeRegisterContextNetBSD_x86_64_h
+#ifndef lldb_NativeRegisterContextNetBSD_x86_h
+#define lldb_NativeRegisterContextNetBSD_x86_h
// clang-format off
#include <sys/param.h>
@@ -22,8 +22,8 @@
#include <optional>
#include "Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h"
-#include "Plugins/Process/Utility/RegisterContext_x86.h"
#include "Plugins/Process/Utility/NativeRegisterContextDBReg_x86.h"
+#include "Plugins/Process/Utility/RegisterContext_x86.h"
#include "Plugins/Process/Utility/lldb-x86-register-enums.h"
namespace lldb_private {
@@ -31,12 +31,11 @@ namespace process_netbsd {
class NativeProcessNetBSD;
-class NativeRegisterContextNetBSD_x86_64
- : public NativeRegisterContextNetBSD,
- public NativeRegisterContextDBReg_x86 {
+class NativeRegisterContextNetBSD_x86 : public NativeRegisterContextNetBSD,
+ public NativeRegisterContextDBReg_x86 {
public:
- NativeRegisterContextNetBSD_x86_64(const ArchSpec &target_arch,
- NativeThreadProtocol &native_thread);
+ NativeRegisterContextNetBSD_x86(const ArchSpec &target_arch,
+ NativeThreadProtocol &native_thread);
uint32_t GetRegisterSetCount() const override;
const RegisterSet *GetRegisterSet(uint32_t set_index) const override;
@@ -89,6 +88,6 @@ class NativeRegisterContextNetBSD_x86_64
} // namespace process_netbsd
} // namespace lldb_private
-#endif // #ifndef lldb_NativeRegisterContextNetBSD_x86_64_h
+#endif // #ifndef lldb_NativeRegisterContextNetBSD_x86_h
-#endif // defined(__x86_64__)
+#endif // defined(__i386__) || defined(__x86_64__)
diff --git a/lldb/source/Plugins/Process/elf-core/CMakeLists.txt b/lldb/source/Plugins/Process/elf-core/CMakeLists.txt
index 73d2b9ac9957b..6bf295f0ad2e2 100644
--- a/lldb/source/Plugins/Process/elf-core/CMakeLists.txt
+++ b/lldb/source/Plugins/Process/elf-core/CMakeLists.txt
@@ -1,13 +1,13 @@
add_lldb_library(lldbPluginProcessElfCore PLUGIN
ProcessElfCore.cpp
ThreadElfCore.cpp
- RegisterContextLinuxCore_x86_64.cpp
+ RegisterContextLinuxCore_x86.cpp
RegisterContextPOSIXCore_arm.cpp
RegisterContextPOSIXCore_arm64.cpp
RegisterContextPOSIXCore_powerpc.cpp
RegisterContextPOSIXCore_ppc64le.cpp
RegisterContextPOSIXCore_s390x.cpp
- RegisterContextPOSIXCore_x86_64.cpp
+ RegisterContextPOSIXCore_x86.cpp
RegisterContextPOSIXCore_riscv32.cpp
RegisterContextPOSIXCore_riscv64.cpp
RegisterContextPOSIXCore_loongarch64.cpp
diff --git a/lldb/source/Plugins/Process/elf-core/RegisterContextLinuxCore_x86_64.cpp b/lldb/source/Plugins/Process/elf-core/RegisterContextLinuxCore_x86.cpp
similarity index 96%
rename from lldb/source/Plugins/Process/elf-core/RegisterContextLinuxCore_x86_64.cpp
rename to lldb/source/Plugins/Process/elf-core/RegisterContextLinuxCore_x86.cpp
index b806292c7a1a2..5df360f86f09b 100644
--- a/lldb/source/Plugins/Process/elf-core/RegisterContextLinuxCore_x86_64.cpp
+++ b/lldb/source/Plugins/Process/elf-core/RegisterContextLinuxCore_x86.cpp
@@ -1,4 +1,4 @@
-//===-- RegisterContextLinuxCore_x86_64.cpp -------------------------------===//
+//===-- RegisterContextLinuxCore_x86.cpp ----------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "RegisterContextLinuxCore_x86_64.h"
+#include "RegisterContextLinuxCore_x86.h"
#include "lldb/Target/Thread.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/RegisterValue.h"
@@ -210,12 +210,12 @@ static const RegisterSet g_reg_sets_x86_64[] = {
{"Advanced Vector Extensions", "avx", x86_64_with_base::k_num_avx_registers,
g_avx_regnums_x86_64}};
-RegisterContextLinuxCore_x86_64::RegisterContextLinuxCore_x86_64(
+RegisterContextLinuxCore_x86::RegisterContextLinuxCore_x86(
Thread &thread, RegisterInfoInterface *register_info,
const DataExtractor &gpregset, llvm::ArrayRef<CoreNote> notes)
- : RegisterContextCorePOSIX_x86_64(thread, register_info, gpregset, notes) {}
+ : RegisterContextCorePOSIX_x86(thread, register_info, gpregset, notes) {}
-const RegisterSet *RegisterContextLinuxCore_x86_64::GetRegisterSet(size_t set) {
+const RegisterSet *RegisterContextLinuxCore_x86::GetRegisterSet(size_t set) {
if (IsRegisterSetAvailable(set)) {
switch (m_register_info_up->GetTargetArchitecture().GetMachine()) {
case llvm::Triple::x86:
@@ -230,7 +230,7 @@ const RegisterSet *RegisterContextLinuxCore_x86_64::GetRegisterSet(size_t set) {
return nullptr;
}
-RegInfo &RegisterContextLinuxCore_x86_64::GetRegInfo() {
+RegInfo &RegisterContextLinuxCore_x86::GetRegInfo() {
return GetRegInfoShared(
m_register_info_up->GetTargetArchitecture().GetMachine(),
/*with_base=*/true);
diff --git a/lldb/source/Plugins/Process/elf-core/RegisterContextLinuxCore_x86_64.h b/lldb/source/Plugins/Process/elf-core/RegisterContextLinuxCore_x86.h
similarity index 76%
rename from lldb/source/Plugins/Process/elf-core/RegisterContextLinuxCore_x86_64.h
rename to lldb/source/Plugins/Process/elf-core/RegisterContextLinuxCore_x86.h
index a68ed82d718c3..68126f959fc6e 100644
--- a/lldb/source/Plugins/Process/elf-core/RegisterContextLinuxCore_x86_64.h
+++ b/lldb/source/Plugins/Process/elf-core/RegisterContextLinuxCore_x86.h
@@ -1,4 +1,4 @@
-//===-- RegisterContextLinuxCore_x86_64.h -----------------------*- C++ -*-===//
+//===-- RegisterContextLinuxCore_x86.h --------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -6,15 +6,15 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SOURCE_PLUGINS_PROCESS_ELF_CORE_REGISTERCONTEXTLINUXCORE_X86_64_H
-#define LLDB_SOURCE_PLUGINS_PROCESS_ELF_CORE_REGISTERCONTEXTLINUXCORE_X86_64_H
+#ifndef LLDB_SOURCE_PLUGINS_PROCESS_ELF_CORE_REGISTERCONTEXTLINUXCORE_X86_H
+#define LLDB_SOURCE_PLUGINS_PROCESS_ELF_CORE_REGISTERCONTEXTLINUXCORE_X86_H
#include "Plugins/Process/elf-core/RegisterUtilities.h"
-#include "RegisterContextPOSIXCore_x86_64.h"
+#include "RegisterContextPOSIXCore_x86.h"
-class RegisterContextLinuxCore_x86_64 : public RegisterContextCorePOSIX_x86_64 {
+class RegisterContextLinuxCore_x86 : public RegisterContextCorePOSIX_x86 {
public:
- RegisterContextLinuxCore_x86_64(
+ RegisterContextLinuxCore_x86(
lldb_private::Thread &thread,
lldb_private::RegisterInfoInterface *register_info,
const lldb_private::DataExtractor &gpregset,
@@ -25,4 +25,4 @@ class RegisterContextLinuxCore_x86_64 : public RegisterContextCorePOSIX_x86_64 {
lldb_private::RegInfo &GetRegInfo() override;
};
-#endif // LLDB_SOURCE_PLUGINS_PROCESS_ELF_CORE_REGISTERCONTEXTLINUXCORE_X86_64_H
+#endif // LLDB_SOURCE_PLUGINS_PROCESS_ELF_CORE_REGISTERCONTEXTLINUXCORE_X86_H
diff --git a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86.cpp
similarity index 69%
rename from lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp
rename to lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86.cpp
index 845312f4c1edd..e5dbf4cd09d52 100644
--- a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp
+++ b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86.cpp
@@ -1,4 +1,4 @@
-//===-- RegisterContextPOSIXCore_x86_64.cpp -------------------------------===//
+//===-- RegisterContextPOSIXCore_x86.cpp ----------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -6,14 +6,14 @@
//
//===----------------------------------------------------------------------===//
-#include "RegisterContextPOSIXCore_x86_64.h"
+#include "RegisterContextPOSIXCore_x86.h"
#include "lldb/Target/Thread.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/RegisterValue.h"
using namespace lldb_private;
-RegisterContextCorePOSIX_x86_64::RegisterContextCorePOSIX_x86_64(
+RegisterContextCorePOSIX_x86::RegisterContextCorePOSIX_x86(
Thread &thread, RegisterInfoInterface *register_info,
const DataExtractor &gpregset, llvm::ArrayRef<CoreNote> notes)
: RegisterContextPOSIX_x86(thread, 0, register_info) {
@@ -36,26 +36,22 @@ RegisterContextCorePOSIX_x86_64::RegisterContextCorePOSIX_x86_64(
m_fpregset.reset();
}
-bool RegisterContextCorePOSIX_x86_64::ReadGPR() {
- return m_gpregset != nullptr;
-}
+bool RegisterContextCorePOSIX_x86::ReadGPR() { return m_gpregset != nullptr; }
-bool RegisterContextCorePOSIX_x86_64::ReadFPR() {
- return m_fpregset != nullptr;
-}
+bool RegisterContextCorePOSIX_x86::ReadFPR() { return m_fpregset != nullptr; }
-bool RegisterContextCorePOSIX_x86_64::WriteGPR() {
+bool RegisterContextCorePOSIX_x86::WriteGPR() {
assert(0);
return false;
}
-bool RegisterContextCorePOSIX_x86_64::WriteFPR() {
+bool RegisterContextCorePOSIX_x86::WriteFPR() {
assert(0);
return false;
}
-bool RegisterContextCorePOSIX_x86_64::ReadRegister(const RegisterInfo *reg_info,
- RegisterValue &value) {
+bool RegisterContextCorePOSIX_x86::ReadRegister(const RegisterInfo *reg_info,
+ RegisterValue &value) {
const uint8_t *src;
size_t offset;
const size_t fxsave_offset = reg_info->byte_offset - GetFXSAVEOffset();
@@ -79,21 +75,21 @@ bool RegisterContextCorePOSIX_x86_64::ReadRegister(const RegisterInfo *reg_info,
return error.Success();
}
-bool RegisterContextCorePOSIX_x86_64::ReadAllRegisterValues(
+bool RegisterContextCorePOSIX_x86::ReadAllRegisterValues(
lldb::WritableDataBufferSP &data_sp) {
return false;
}
-bool RegisterContextCorePOSIX_x86_64::WriteRegister(
- const RegisterInfo *reg_info, const RegisterValue &value) {
+bool RegisterContextCorePOSIX_x86::WriteRegister(const RegisterInfo *reg_info,
+ const RegisterValue &value) {
return false;
}
-bool RegisterContextCorePOSIX_x86_64::WriteAllRegisterValues(
+bool RegisterContextCorePOSIX_x86::WriteAllRegisterValues(
const lldb::DataBufferSP &data_sp) {
return false;
}
-bool RegisterContextCorePOSIX_x86_64::HardwareSingleStep(bool enable) {
+bool RegisterContextCorePOSIX_x86::HardwareSingleStep(bool enable) {
return false;
}
diff --git a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86.h
similarity index 87%
rename from lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h
rename to lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86.h
index 46416a2381dbf..56f910b18683a 100644
--- a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h
+++ b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86.h
@@ -1,4 +1,4 @@
-//===-- RegisterContextPOSIXCore_x86_64.h -----------------------*- C++ -*-===//
+//===-- RegisterContextPOSIXCore_x86.h --------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -6,15 +6,15 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SOURCE_PLUGINS_PROCESS_ELF_CORE_REGISTERCONTEXTPOSIXCORE_X86_64_H
-#define LLDB_SOURCE_PLUGINS_PROCESS_ELF_CORE_REGISTERCONTEXTPOSIXCORE_X86_64_H
+#ifndef LLDB_SOURCE_PLUGINS_PROCESS_ELF_CORE_REGISTERCONTEXTPOSIXCORE_X86_H
+#define LLDB_SOURCE_PLUGINS_PROCESS_ELF_CORE_REGISTERCONTEXTPOSIXCORE_X86_H
#include "Plugins/Process/Utility/RegisterContextPOSIX_x86.h"
#include "Plugins/Process/elf-core/RegisterUtilities.h"
-class RegisterContextCorePOSIX_x86_64 : public RegisterContextPOSIX_x86 {
+class RegisterContextCorePOSIX_x86 : public RegisterContextPOSIX_x86 {
public:
- RegisterContextCorePOSIX_x86_64(
+ RegisterContextCorePOSIX_x86(
lldb_private::Thread &thread,
lldb_private::RegisterInfoInterface *register_info,
const lldb_private::DataExtractor &gpregset,
@@ -46,4 +46,4 @@ class RegisterContextCorePOSIX_x86_64 : public RegisterContextPOSIX_x86 {
std::unique_ptr<uint8_t[]> m_fpregset;
};
-#endif // LLDB_SOURCE_PLUGINS_PROCESS_ELF_CORE_REGISTERCONTEXTPOSIXCORE_X86_64_H
+#endif // LLDB_SOURCE_PLUGINS_PROCESS_ELF_CORE_REGISTERCONTEXTPOSIXCORE_X86_H
diff --git a/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp b/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp
index b51d34a2614f1..95655bad2894b 100644
--- a/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp
+++ b/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp
@@ -30,7 +30,7 @@
#include "Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h"
#include "Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.h"
#include "ProcessElfCore.h"
-#include "RegisterContextLinuxCore_x86_64.h"
+#include "RegisterContextLinuxCore_x86.h"
#include "RegisterContextPOSIXCore_arm.h"
#include "RegisterContextPOSIXCore_arm64.h"
#include "RegisterContextPOSIXCore_loongarch64.h"
@@ -39,7 +39,7 @@
#include "RegisterContextPOSIXCore_riscv32.h"
#include "RegisterContextPOSIXCore_riscv64.h"
#include "RegisterContextPOSIXCore_s390x.h"
-#include "RegisterContextPOSIXCore_x86_64.h"
+#include "RegisterContextPOSIXCore_x86.h"
#include "ThreadElfCore.h"
#include <memory>
@@ -216,11 +216,11 @@ ThreadElfCore::CreateRegisterContextForFrame(StackFrame *frame) {
case llvm::Triple::x86:
case llvm::Triple::x86_64:
if (is_linux) {
- m_thread_reg_ctx_sp = std::make_shared<RegisterContextLinuxCore_x86_64>(
- *this, reg_interface, m_gpregset_data, m_notes);
+ m_thread_reg_ctx_sp = std::make_shared<RegisterContextLinuxCore_x86>(
+ *this, reg_interface, m_gpregset_data, m_notes);
} else {
- m_thread_reg_ctx_sp = std::make_shared<RegisterContextCorePOSIX_x86_64>(
- *this, reg_interface, m_gpregset_data, m_notes);
+ m_thread_reg_ctx_sp = std::make_shared<RegisterContextCorePOSIX_x86>(
+ *this, reg_interface, m_gpregset_data, m_notes);
}
break;
default:
diff --git a/lldb/source/Plugins/Process/minidump/ThreadMinidump.cpp b/lldb/source/Plugins/Process/minidump/ThreadMinidump.cpp
index 1fbc52815238b..fe62f89a3ac0e 100644
--- a/lldb/source/Plugins/Process/minidump/ThreadMinidump.cpp
+++ b/lldb/source/Plugins/Process/minidump/ThreadMinidump.cpp
@@ -17,7 +17,7 @@
#include "Plugins/Process/Utility/RegisterContextLinux_i386.h"
#include "Plugins/Process/Utility/RegisterContextLinux_x86_64.h"
-#include "Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h"
+#include "Plugins/Process/elf-core/RegisterContextPOSIXCore_x86.h"
#include "Plugins/Process/elf-core/RegisterUtilities.h"
#include "lldb/Target/RegisterContext.h"
@@ -73,7 +73,7 @@ ThreadMinidump::CreateRegisterContextForFrame(StackFrame *frame) {
lldb::DataBufferSP buf =
ConvertMinidumpContext_x86_32(m_gpregset_data, reg_interface);
DataExtractor gpregset(buf, lldb::eByteOrderLittle, 4);
- m_thread_reg_ctx_sp = std::make_shared<RegisterContextCorePOSIX_x86_64>(
+ m_thread_reg_ctx_sp = std::make_shared<RegisterContextCorePOSIX_x86>(
*this, reg_interface, gpregset,
llvm::ArrayRef<lldb_private::CoreNote>());
break;
@@ -83,7 +83,7 @@ ThreadMinidump::CreateRegisterContextForFrame(StackFrame *frame) {
lldb::DataBufferSP buf =
ConvertMinidumpContext_x86_64(m_gpregset_data, reg_interface);
DataExtractor gpregset(buf, lldb::eByteOrderLittle, 8);
- m_thread_reg_ctx_sp = std::make_shared<RegisterContextCorePOSIX_x86_64>(
+ m_thread_reg_ctx_sp = std::make_shared<RegisterContextCorePOSIX_x86>(
*this, reg_interface, gpregset,
llvm::ArrayRef<lldb_private::CoreNote>());
break;
More information about the lldb-commits
mailing list