[Lldb-commits] [lldb] 7369ad3 - [lldb] Use llvm MC as the source of dwarf/eh register numbers for X86 ABIs

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 28 01:50:47 PST 2020


Author: Pavel Labath
Date: 2020-02-28T10:49:08+01:00
New Revision: 7369ad38f8decb4a85b168bbf9a9869fa4e648ee

URL: https://github.com/llvm/llvm-project/commit/7369ad38f8decb4a85b168bbf9a9869fa4e648ee
DIFF: https://github.com/llvm/llvm-project/commit/7369ad38f8decb4a85b168bbf9a9869fa4e648ee.diff

LOG: [lldb] Use llvm MC as the source of dwarf/eh register numbers for X86 ABIs

x86_64 ABIs were converted with 07355c1c0. This does the same with i386.

Added: 
    

Modified: 
    lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.cpp
    lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.h
    lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp
    lldb/source/Plugins/ABI/X86/ABISysV_i386.h
    lldb/source/Plugins/ABI/X86/ABIX86.cpp
    lldb/source/Plugins/ABI/X86/ABIX86.h

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.cpp b/lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.cpp
index d11c1af1d259..89112deb2c4a 100644
--- a/lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.cpp
+++ b/lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.cpp
@@ -31,21 +31,6 @@ using namespace lldb_private;
 
 LLDB_PLUGIN_DEFINE(ABIMacOSX_i386)
 
-enum {
-  ehframe_eax = 0,
-  ehframe_ecx,
-  ehframe_edx,
-  ehframe_ebx,
-  ehframe_ebp, // Different from DWARF the regnums - eh_frame esp/ebp had their
-               // regnums switched on i386 darwin
-  ehframe_esp, // Different from DWARF the regnums - eh_frame esp/ebp had their
-               // regnums switched on i386 darwin
-  ehframe_esi,
-  ehframe_edi,
-  ehframe_eip,
-  ehframe_eflags
-};
-
 enum {
   dwarf_eax = 0,
   dwarf_ecx,
@@ -56,653 +41,8 @@ enum {
   dwarf_esi,
   dwarf_edi,
   dwarf_eip,
-  dwarf_eflags,
-  dwarf_stmm0 = 11,
-  dwarf_stmm1,
-  dwarf_stmm2,
-  dwarf_stmm3,
-  dwarf_stmm4,
-  dwarf_stmm5,
-  dwarf_stmm6,
-  dwarf_stmm7,
-  dwarf_xmm0 = 21,
-  dwarf_xmm1,
-  dwarf_xmm2,
-  dwarf_xmm3,
-  dwarf_xmm4,
-  dwarf_xmm5,
-  dwarf_xmm6,
-  dwarf_xmm7,
-  dwarf_ymm0 = dwarf_xmm0,
-  dwarf_ymm1 = dwarf_xmm1,
-  dwarf_ymm2 = dwarf_xmm2,
-  dwarf_ymm3 = dwarf_xmm3,
-  dwarf_ymm4 = dwarf_xmm4,
-  dwarf_ymm5 = dwarf_xmm5,
-  dwarf_ymm6 = dwarf_xmm6,
-  dwarf_ymm7 = dwarf_xmm7
 };
 
-static RegisterInfo g_register_infos[] = {
-    //  NAME      ALT      SZ OFF ENCODING         FORMAT
-    //  EH_FRAME              DWARF                 GENERIC
-    //  PROCESS PLUGIN        LLDB NATIVE
-    //  ======    =======  == === =============    ============
-    //  ===================== ===================== ============================
-    //  ====================  ======================
-    {"eax",
-     nullptr,
-     4,
-     0,
-     eEncodingUint,
-     eFormatHex,
-     {ehframe_eax, dwarf_eax, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"ebx",
-     nullptr,
-     4,
-     0,
-     eEncodingUint,
-     eFormatHex,
-     {ehframe_ebx, dwarf_ebx, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"ecx",
-     nullptr,
-     4,
-     0,
-     eEncodingUint,
-     eFormatHex,
-     {ehframe_ecx, dwarf_ecx, LLDB_REGNUM_GENERIC_ARG4, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"edx",
-     nullptr,
-     4,
-     0,
-     eEncodingUint,
-     eFormatHex,
-     {ehframe_edx, dwarf_edx, LLDB_REGNUM_GENERIC_ARG3, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"esi",
-     nullptr,
-     4,
-     0,
-     eEncodingUint,
-     eFormatHex,
-     {ehframe_esi, dwarf_esi, LLDB_REGNUM_GENERIC_ARG2, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"edi",
-     nullptr,
-     4,
-     0,
-     eEncodingUint,
-     eFormatHex,
-     {ehframe_edi, dwarf_edi, LLDB_REGNUM_GENERIC_ARG1, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"ebp",
-     "fp",
-     4,
-     0,
-     eEncodingUint,
-     eFormatHex,
-     {ehframe_ebp, dwarf_ebp, LLDB_REGNUM_GENERIC_FP, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"esp",
-     "sp",
-     4,
-     0,
-     eEncodingUint,
-     eFormatHex,
-     {ehframe_esp, dwarf_esp, LLDB_REGNUM_GENERIC_SP, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"eip",
-     "pc",
-     4,
-     0,
-     eEncodingUint,
-     eFormatHex,
-     {ehframe_eip, dwarf_eip, LLDB_REGNUM_GENERIC_PC, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"eflags",
-     nullptr,
-     4,
-     0,
-     eEncodingUint,
-     eFormatHex,
-     {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_REGNUM_GENERIC_FLAGS,
-      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"cs",
-     nullptr,
-     4,
-     0,
-     eEncodingUint,
-     eFormatHex,
-     {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"ss",
-     nullptr,
-     4,
-     0,
-     eEncodingUint,
-     eFormatHex,
-     {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"ds",
-     nullptr,
-     4,
-     0,
-     eEncodingUint,
-     eFormatHex,
-     {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"es",
-     nullptr,
-     4,
-     0,
-     eEncodingUint,
-     eFormatHex,
-     {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"fs",
-     nullptr,
-     4,
-     0,
-     eEncodingUint,
-     eFormatHex,
-     {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"gs",
-     nullptr,
-     4,
-     0,
-     eEncodingUint,
-     eFormatHex,
-     {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"stmm0",
-     nullptr,
-     10,
-     0,
-     eEncodingVector,
-     eFormatVectorOfUInt8,
-     {LLDB_INVALID_REGNUM, dwarf_stmm0, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"stmm1",
-     nullptr,
-     10,
-     0,
-     eEncodingVector,
-     eFormatVectorOfUInt8,
-     {LLDB_INVALID_REGNUM, dwarf_stmm1, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"stmm2",
-     nullptr,
-     10,
-     0,
-     eEncodingVector,
-     eFormatVectorOfUInt8,
-     {LLDB_INVALID_REGNUM, dwarf_stmm2, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"stmm3",
-     nullptr,
-     10,
-     0,
-     eEncodingVector,
-     eFormatVectorOfUInt8,
-     {LLDB_INVALID_REGNUM, dwarf_stmm3, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"stmm4",
-     nullptr,
-     10,
-     0,
-     eEncodingVector,
-     eFormatVectorOfUInt8,
-     {LLDB_INVALID_REGNUM, dwarf_stmm4, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"stmm5",
-     nullptr,
-     10,
-     0,
-     eEncodingVector,
-     eFormatVectorOfUInt8,
-     {LLDB_INVALID_REGNUM, dwarf_stmm5, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"stmm6",
-     nullptr,
-     10,
-     0,
-     eEncodingVector,
-     eFormatVectorOfUInt8,
-     {LLDB_INVALID_REGNUM, dwarf_stmm6, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"stmm7",
-     nullptr,
-     10,
-     0,
-     eEncodingVector,
-     eFormatVectorOfUInt8,
-     {LLDB_INVALID_REGNUM, dwarf_stmm7, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"fctrl",
-     nullptr,
-     4,
-     0,
-     eEncodingUint,
-     eFormatHex,
-     {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"fstat",
-     nullptr,
-     4,
-     0,
-     eEncodingUint,
-     eFormatHex,
-     {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"ftag",
-     nullptr,
-     4,
-     0,
-     eEncodingUint,
-     eFormatHex,
-     {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"fiseg",
-     nullptr,
-     4,
-     0,
-     eEncodingUint,
-     eFormatHex,
-     {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"fioff",
-     nullptr,
-     4,
-     0,
-     eEncodingUint,
-     eFormatHex,
-     {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"foseg",
-     nullptr,
-     4,
-     0,
-     eEncodingUint,
-     eFormatHex,
-     {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"fooff",
-     nullptr,
-     4,
-     0,
-     eEncodingUint,
-     eFormatHex,
-     {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"fop",
-     nullptr,
-     4,
-     0,
-     eEncodingUint,
-     eFormatHex,
-     {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"xmm0",
-     nullptr,
-     16,
-     0,
-     eEncodingVector,
-     eFormatVectorOfUInt8,
-     {LLDB_INVALID_REGNUM, dwarf_xmm0, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"xmm1",
-     nullptr,
-     16,
-     0,
-     eEncodingVector,
-     eFormatVectorOfUInt8,
-     {LLDB_INVALID_REGNUM, dwarf_xmm1, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"xmm2",
-     nullptr,
-     16,
-     0,
-     eEncodingVector,
-     eFormatVectorOfUInt8,
-     {LLDB_INVALID_REGNUM, dwarf_xmm2, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"xmm3",
-     nullptr,
-     16,
-     0,
-     eEncodingVector,
-     eFormatVectorOfUInt8,
-     {LLDB_INVALID_REGNUM, dwarf_xmm3, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"xmm4",
-     nullptr,
-     16,
-     0,
-     eEncodingVector,
-     eFormatVectorOfUInt8,
-     {LLDB_INVALID_REGNUM, dwarf_xmm4, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"xmm5",
-     nullptr,
-     16,
-     0,
-     eEncodingVector,
-     eFormatVectorOfUInt8,
-     {LLDB_INVALID_REGNUM, dwarf_xmm5, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"xmm6",
-     nullptr,
-     16,
-     0,
-     eEncodingVector,
-     eFormatVectorOfUInt8,
-     {LLDB_INVALID_REGNUM, dwarf_xmm6, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"xmm7",
-     nullptr,
-     16,
-     0,
-     eEncodingVector,
-     eFormatVectorOfUInt8,
-     {LLDB_INVALID_REGNUM, dwarf_xmm7, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"mxcsr",
-     nullptr,
-     4,
-     0,
-     eEncodingUint,
-     eFormatHex,
-     {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"ymm0",
-     nullptr,
-     32,
-     0,
-     eEncodingVector,
-     eFormatVectorOfUInt8,
-     {LLDB_INVALID_REGNUM, dwarf_ymm0, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"ymm1",
-     nullptr,
-     32,
-     0,
-     eEncodingVector,
-     eFormatVectorOfUInt8,
-     {LLDB_INVALID_REGNUM, dwarf_ymm1, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"ymm2",
-     nullptr,
-     32,
-     0,
-     eEncodingVector,
-     eFormatVectorOfUInt8,
-     {LLDB_INVALID_REGNUM, dwarf_ymm2, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"ymm3",
-     nullptr,
-     32,
-     0,
-     eEncodingVector,
-     eFormatVectorOfUInt8,
-     {LLDB_INVALID_REGNUM, dwarf_ymm3, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"ymm4",
-     nullptr,
-     32,
-     0,
-     eEncodingVector,
-     eFormatVectorOfUInt8,
-     {LLDB_INVALID_REGNUM, dwarf_ymm4, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"ymm5",
-     nullptr,
-     32,
-     0,
-     eEncodingVector,
-     eFormatVectorOfUInt8,
-     {LLDB_INVALID_REGNUM, dwarf_ymm5, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"ymm6",
-     nullptr,
-     32,
-     0,
-     eEncodingVector,
-     eFormatVectorOfUInt8,
-     {LLDB_INVALID_REGNUM, dwarf_ymm6, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0},
-    {"ymm7",
-     nullptr,
-     32,
-     0,
-     eEncodingVector,
-     eFormatVectorOfUInt8,
-     {LLDB_INVALID_REGNUM, dwarf_ymm7, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
-      LLDB_INVALID_REGNUM},
-     nullptr,
-     nullptr,
-     nullptr,
-     0}};
-
-static const uint32_t k_num_register_infos =
-    llvm::array_lengthof(g_register_infos);
-static bool g_register_info_names_constified = false;
-
-const lldb_private::RegisterInfo *
-ABIMacOSX_i386::GetRegisterInfoArray(uint32_t &count) {
-  // Make the C-string names and alt_names for the register infos into const
-  // C-string values by having the ConstString unique the names in the global
-  // constant C-string pool.
-  if (!g_register_info_names_constified) {
-    g_register_info_names_constified = true;
-    for (uint32_t i = 0; i < k_num_register_infos; ++i) {
-      if (g_register_infos[i].name)
-        g_register_infos[i].name =
-            ConstString(g_register_infos[i].name).GetCString();
-      if (g_register_infos[i].alt_name)
-        g_register_infos[i].alt_name =
-            ConstString(g_register_infos[i].alt_name).GetCString();
-    }
-  }
-  count = k_num_register_infos;
-  return g_register_infos;
-}
-
 size_t ABIMacOSX_i386::GetRedZoneSize() const { return 0; }
 
 // Static Functions

diff  --git a/lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.h b/lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.h
index b790ad8db7e1..9b263b3a7931 100644
--- a/lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.h
+++ b/lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.h
@@ -9,11 +9,11 @@
 #ifndef LLDB_SOURCE_PLUGINS_ABI_X86_ABIMACOSX_I386_H
 #define LLDB_SOURCE_PLUGINS_ABI_X86_ABIMACOSX_I386_H
 
+#include "Plugins/ABI/X86/ABIX86.h"
 #include "lldb/Core/Value.h"
-#include "lldb/Target/ABI.h"
 #include "lldb/lldb-private.h"
 
-class ABIMacOSX_i386 : public lldb_private::RegInfoBasedABI {
+class ABIMacOSX_i386 : public ABIX86 {
 public:
   ~ABIMacOSX_i386() override = default;
 
@@ -65,9 +65,6 @@ class ABIMacOSX_i386 : public lldb_private::RegInfoBasedABI {
     return pc <= UINT32_MAX;
   }
 
-  const lldb_private::RegisterInfo *
-  GetRegisterInfoArray(uint32_t &count) override;
-
   // Static Functions
 
   static void Initialize();
@@ -91,8 +88,13 @@ class ABIMacOSX_i386 : public lldb_private::RegInfoBasedABI {
 
   bool RegisterIsCalleeSaved(const lldb_private::RegisterInfo *reg_info);
 
+  std::string GetMCName(std::string name) override {
+    MapRegisterName(name, "stmm", "st");
+    return name;
+  }
+
 private:
-  using lldb_private::RegInfoBasedABI::RegInfoBasedABI; // Call CreateInstance instead.
+  using ABIX86::ABIX86; // Call CreateInstance instead.
 };
 
 #endif // LLDB_SOURCE_PLUGINS_ABI_X86_ABIMACOSX_I386_H

diff  --git a/lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp b/lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp
index 8fc22b21623c..2ac87d1512e9 100644
--- a/lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp
+++ b/lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp
@@ -65,135 +65,8 @@ enum dwarf_regnums {
   dwarf_esi,
   dwarf_edi,
   dwarf_eip,
-  dwarf_eflags,
-
-  dwarf_st0 = 11,
-  dwarf_st1,
-  dwarf_st2,
-  dwarf_st3,
-  dwarf_st4,
-  dwarf_st5,
-  dwarf_st6,
-  dwarf_st7,
-
-  dwarf_xmm0 = 21,
-  dwarf_xmm1,
-  dwarf_xmm2,
-  dwarf_xmm3,
-  dwarf_xmm4,
-  dwarf_xmm5,
-  dwarf_xmm6,
-  dwarf_xmm7,
-  dwarf_ymm0 = dwarf_xmm0,
-  dwarf_ymm1 = dwarf_xmm1,
-  dwarf_ymm2 = dwarf_xmm2,
-  dwarf_ymm3 = dwarf_xmm3,
-  dwarf_ymm4 = dwarf_xmm4,
-  dwarf_ymm5 = dwarf_xmm5,
-  dwarf_ymm6 = dwarf_xmm6,
-  dwarf_ymm7 = dwarf_xmm7,
-
-  dwarf_mm0 = 29,
-  dwarf_mm1,
-  dwarf_mm2,
-  dwarf_mm3,
-  dwarf_mm4,
-  dwarf_mm5,
-  dwarf_mm6,
-  dwarf_mm7,
-
-  dwarf_bnd0 = 101,
-  dwarf_bnd1,
-  dwarf_bnd2,
-  dwarf_bnd3
 };
 
-static RegisterInfo g_register_infos[] = {
-    // clang-format off
-    //NAME       ALT     SZ OFF  ENCODING         FORMAT                 EH_FRAME             DWARF                GENERIC                   PROCESS PLUGIN       LLDB NATIVE           VALUE    INVAL    DYN EXPR SZ
-    //========== ======= == ===  =============    ====================   ===================  ===================  ========================= ===================  ===================   =======  =======  ======== ==
-    {"eax",      nullptr, 4,  0, eEncodingUint,   eFormatHex,           {dwarf_eax,           dwarf_eax,           LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"ebx",      nullptr, 4,  0, eEncodingUint,   eFormatHex,           {dwarf_ebx,           dwarf_ebx,           LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"ecx",      nullptr, 4,  0, eEncodingUint,   eFormatHex,           {dwarf_ecx,           dwarf_ecx,           LLDB_REGNUM_GENERIC_ARG4, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"edx",      nullptr, 4,  0, eEncodingUint,   eFormatHex,           {dwarf_edx,           dwarf_edx,           LLDB_REGNUM_GENERIC_ARG3, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"esi",      nullptr, 4,  0, eEncodingUint,   eFormatHex,           {dwarf_esi,           dwarf_esi,           LLDB_REGNUM_GENERIC_ARG2, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"edi",      nullptr, 4,  0, eEncodingUint,   eFormatHex,           {dwarf_edi,           dwarf_edi,           LLDB_REGNUM_GENERIC_ARG1, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"ebp",      "fp",    4,  0, eEncodingUint,   eFormatHex,           {dwarf_ebp,           dwarf_ebp,           LLDB_REGNUM_GENERIC_FP,   LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"esp",      "sp",    4,  0, eEncodingUint,   eFormatHex,           {dwarf_esp,           dwarf_esp,           LLDB_REGNUM_GENERIC_SP,   LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"eip",      "pc",    4,  0, eEncodingUint,   eFormatHex,           {dwarf_eip,           dwarf_eip,           LLDB_REGNUM_GENERIC_PC,   LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"eflags",   nullptr, 4,  0, eEncodingUint,   eFormatHex,           {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_REGNUM_GENERIC_FLAGS,LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"cs",       nullptr, 4,  0, eEncodingUint,   eFormatHex,           {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"ss",       nullptr, 4,  0, eEncodingUint,   eFormatHex,           {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"ds",       nullptr, 4,  0, eEncodingUint,   eFormatHex,           {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"es",       nullptr, 4,  0, eEncodingUint,   eFormatHex,           {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"fs",       nullptr, 4,  0, eEncodingUint,   eFormatHex,           {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"gs",       nullptr, 4,  0, eEncodingUint,   eFormatHex,           {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"st0",      nullptr, 10, 0, eEncodingVector, eFormatVectorOfUInt8, {LLDB_INVALID_REGNUM, dwarf_st0,           LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"st1",      nullptr, 10, 0, eEncodingVector, eFormatVectorOfUInt8, {LLDB_INVALID_REGNUM, dwarf_st1,           LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"st2",      nullptr, 10, 0, eEncodingVector, eFormatVectorOfUInt8, {LLDB_INVALID_REGNUM, dwarf_st2,           LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"st3",      nullptr, 10, 0, eEncodingVector, eFormatVectorOfUInt8, {LLDB_INVALID_REGNUM, dwarf_st3,           LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"st4",      nullptr, 10, 0, eEncodingVector, eFormatVectorOfUInt8, {LLDB_INVALID_REGNUM, dwarf_st4,           LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"st5",      nullptr, 10, 0, eEncodingVector, eFormatVectorOfUInt8, {LLDB_INVALID_REGNUM, dwarf_st5,           LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"st6",      nullptr, 10, 0, eEncodingVector, eFormatVectorOfUInt8, {LLDB_INVALID_REGNUM, dwarf_st6,           LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"st7",      nullptr, 10, 0, eEncodingVector, eFormatVectorOfUInt8, {LLDB_INVALID_REGNUM, dwarf_st7,           LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"fctrl",    nullptr, 4,  0, eEncodingUint,   eFormatHex,           {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"fstat",    nullptr, 4,  0, eEncodingUint,   eFormatHex,           {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"ftag",     nullptr, 4,  0, eEncodingUint,   eFormatHex,           {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"fiseg",    nullptr, 4,  0, eEncodingUint,   eFormatHex,           {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"fioff",    nullptr, 4,  0, eEncodingUint,   eFormatHex,           {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"foseg",    nullptr, 4,  0, eEncodingUint,   eFormatHex,           {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"fooff",    nullptr, 4,  0, eEncodingUint,   eFormatHex,           {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"fop",      nullptr, 4,  0, eEncodingUint,   eFormatHex,           {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"xmm0",     nullptr, 16, 0, eEncodingVector, eFormatVectorOfUInt8, {LLDB_INVALID_REGNUM, dwarf_xmm0,          LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"xmm1",     nullptr, 16, 0, eEncodingVector, eFormatVectorOfUInt8, {LLDB_INVALID_REGNUM, dwarf_xmm1,          LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"xmm2",     nullptr, 16, 0, eEncodingVector, eFormatVectorOfUInt8, {LLDB_INVALID_REGNUM, dwarf_xmm2,          LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"xmm3",     nullptr, 16, 0, eEncodingVector, eFormatVectorOfUInt8, {LLDB_INVALID_REGNUM, dwarf_xmm3,          LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"xmm4",     nullptr, 16, 0, eEncodingVector, eFormatVectorOfUInt8, {LLDB_INVALID_REGNUM, dwarf_xmm4,          LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"xmm5",     nullptr, 16, 0, eEncodingVector, eFormatVectorOfUInt8, {LLDB_INVALID_REGNUM, dwarf_xmm5,          LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"xmm6",     nullptr, 16, 0, eEncodingVector, eFormatVectorOfUInt8, {LLDB_INVALID_REGNUM, dwarf_xmm6,          LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"xmm7",     nullptr, 16, 0, eEncodingVector, eFormatVectorOfUInt8, {LLDB_INVALID_REGNUM, dwarf_xmm7,          LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"mxcsr",    nullptr, 4,  0, eEncodingUint,   eFormatHex,           {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"ymm0",     nullptr, 32, 0, eEncodingVector, eFormatVectorOfUInt8, {LLDB_INVALID_REGNUM, dwarf_ymm0,          LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"ymm1",     nullptr, 32, 0, eEncodingVector, eFormatVectorOfUInt8, {LLDB_INVALID_REGNUM, dwarf_ymm1,          LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"ymm2",     nullptr, 32, 0, eEncodingVector, eFormatVectorOfUInt8, {LLDB_INVALID_REGNUM, dwarf_ymm2,          LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"ymm3",     nullptr, 32, 0, eEncodingVector, eFormatVectorOfUInt8, {LLDB_INVALID_REGNUM, dwarf_ymm3,          LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"ymm4",     nullptr, 32, 0, eEncodingVector, eFormatVectorOfUInt8, {LLDB_INVALID_REGNUM, dwarf_ymm4,          LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"ymm5",     nullptr, 32, 0, eEncodingVector, eFormatVectorOfUInt8, {LLDB_INVALID_REGNUM, dwarf_ymm5,          LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"ymm6",     nullptr, 32, 0, eEncodingVector, eFormatVectorOfUInt8, {LLDB_INVALID_REGNUM, dwarf_ymm6,          LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"ymm7",     nullptr, 32, 0, eEncodingVector, eFormatVectorOfUInt8, {LLDB_INVALID_REGNUM, dwarf_ymm7,          LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"bnd0",     nullptr, 16, 0, eEncodingVector, eFormatVectorOfUInt64,{dwarf_bnd0,          dwarf_bnd0,          LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"bnd1",     nullptr, 16, 0, eEncodingVector, eFormatVectorOfUInt64,{dwarf_bnd1,          dwarf_bnd1,          LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"bnd2",     nullptr, 16, 0, eEncodingVector, eFormatVectorOfUInt64,{dwarf_bnd2,          dwarf_bnd2,          LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"bnd3",     nullptr, 16, 0, eEncodingVector, eFormatVectorOfUInt64,{dwarf_bnd3,          dwarf_bnd3,          LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"bndcfgu",  nullptr, 8,  0, eEncodingVector, eFormatVectorOfUInt8, {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0},
-    {"bndstatus",nullptr, 8,  0, eEncodingVector, eFormatVectorOfUInt8, {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, nullptr, nullptr, nullptr, 0}
-    // clang-format on
-};
-
-static const uint32_t k_num_register_infos =
-    llvm::array_lengthof(g_register_infos);
-static bool g_register_info_names_constified = false;
-
-const lldb_private::RegisterInfo *
-ABISysV_i386::GetRegisterInfoArray(uint32_t &count) {
-  // Make the C-string names and alt_names for the register infos into const
-  // C-string values by having the ConstString unique the names in the global
-  // constant C-string pool.
-  if (!g_register_info_names_constified) {
-    g_register_info_names_constified = true;
-    for (uint32_t i = 0; i < k_num_register_infos; ++i) {
-      if (g_register_infos[i].name)
-        g_register_infos[i].name =
-            ConstString(g_register_infos[i].name).GetCString();
-      if (g_register_infos[i].alt_name)
-        g_register_infos[i].alt_name =
-            ConstString(g_register_infos[i].alt_name).GetCString();
-    }
-  }
-  count = k_num_register_infos;
-  return g_register_infos;
-}
-
 // Static Functions
 
 ABISP

diff  --git a/lldb/source/Plugins/ABI/X86/ABISysV_i386.h b/lldb/source/Plugins/ABI/X86/ABISysV_i386.h
index 752b94e19eea..f67aa0b73a55 100644
--- a/lldb/source/Plugins/ABI/X86/ABISysV_i386.h
+++ b/lldb/source/Plugins/ABI/X86/ABISysV_i386.h
@@ -9,10 +9,10 @@
 #ifndef LLDB_SOURCE_PLUGINS_ABI_X86_ABISYSV_I386_H
 #define LLDB_SOURCE_PLUGINS_ABI_X86_ABISYSV_I386_H
 
-#include "lldb/Target/ABI.h"
+#include "Plugins/ABI/X86/ABIX86.h"
 #include "lldb/lldb-private.h"
 
-class ABISysV_i386 : public lldb_private::RegInfoBasedABI {
+class ABISysV_i386 : public ABIX86 {
 public:
   ~ABISysV_i386() override = default;
 
@@ -73,9 +73,6 @@ class ABISysV_i386 : public lldb_private::RegInfoBasedABI {
     return (pc <= UINT32_MAX);
   }
 
-  const lldb_private::RegisterInfo *
-  GetRegisterInfoArray(uint32_t &count) override;
-
   // Static Functions
 
   static void Initialize();
@@ -100,7 +97,7 @@ class ABISysV_i386 : public lldb_private::RegInfoBasedABI {
   bool RegisterIsCalleeSaved(const lldb_private::RegisterInfo *reg_info);
 
 private:
-  using lldb_private::RegInfoBasedABI::RegInfoBasedABI; // Call CreateInstance instead.
+  using ABIX86::ABIX86; // Call CreateInstance instead.
 };
 
 #endif // LLDB_SOURCE_PLUGINS_ABI_X86_ABISYSV_I386_H

diff  --git a/lldb/source/Plugins/ABI/X86/ABIX86.cpp b/lldb/source/Plugins/ABI/X86/ABIX86.cpp
index 714bf25f482c..bf5ab669417e 100644
--- a/lldb/source/Plugins/ABI/X86/ABIX86.cpp
+++ b/lldb/source/Plugins/ABI/X86/ABIX86.cpp
@@ -28,3 +28,16 @@ void ABIX86::Terminate() {
   ABISysV_x86_64::Terminate();
   ABIWindows_x86_64::Terminate();
 }
+
+uint32_t ABIX86::GetGenericNum(llvm::StringRef name) {
+  return llvm::StringSwitch<uint32_t>(name)
+      .Case("eip", LLDB_REGNUM_GENERIC_PC)
+      .Case("esp", LLDB_REGNUM_GENERIC_SP)
+      .Case("ebp", LLDB_REGNUM_GENERIC_FP)
+      .Case("eflags", LLDB_REGNUM_GENERIC_FLAGS)
+      .Case("edi", LLDB_REGNUM_GENERIC_ARG1)
+      .Case("esi", LLDB_REGNUM_GENERIC_ARG2)
+      .Case("edx", LLDB_REGNUM_GENERIC_ARG3)
+      .Case("ecx", LLDB_REGNUM_GENERIC_ARG4)
+      .Default(LLDB_INVALID_REGNUM);
+}

diff  --git a/lldb/source/Plugins/ABI/X86/ABIX86.h b/lldb/source/Plugins/ABI/X86/ABIX86.h
index 97533948d760..22521cacf180 100644
--- a/lldb/source/Plugins/ABI/X86/ABIX86.h
+++ b/lldb/source/Plugins/ABI/X86/ABIX86.h
@@ -9,9 +9,16 @@
 #ifndef LLDB_SOURCE_PLUGINS_ABI_X86_ABIX86_H
 #define LLDB_SOURCE_PLUGINS_ABI_X86_ABIX86_H
 
-class ABIX86 {
+#include "lldb/Target/ABI.h"
+
+class ABIX86 : public lldb_private::MCBasedABI {
 public:
   static void Initialize();
   static void Terminate();
+
+  uint32_t GetGenericNum(llvm::StringRef name) override;
+
+private:
+  using lldb_private::MCBasedABI::MCBasedABI;
 };
 #endif


        


More information about the lldb-commits mailing list