[Lldb-commits] [lldb] ed3ac6c - [lldb] [Process/NetBSD] Correct DS/ES/FS/GS register sizes

Michał Górny via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 9 13:15:07 PST 2020


Author: Michał Górny
Date: 2020-11-09T22:14:58+01:00
New Revision: ed3ac6c110a53b332f490f1c5ddcd2b7c30d5189

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

LOG: [lldb] [Process/NetBSD] Correct DS/ES/FS/GS register sizes

Fix DS/ES/FS/GS register sizes in getter/setter for NetBSD.  Apparently
only CS and SS registers are specified as 64/32-bit in LLDB, while
the others are specified as 16-bit.

Differential Revision: https://reviews.llvm.org/D91090

Added: 
    

Modified: 
    lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp b/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
index 2e2eacdfccef..f4bbaa4505e1 100644
--- a/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
+++ b/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
@@ -539,19 +539,19 @@ NativeRegisterContextNetBSD_x86_64::ReadRegister(const RegisterInfo *reg_info,
     reg_value = (uint64_t)m_gpr.regs[_REG_CS];
     break;
   case lldb_fs_x86_64:
-    reg_value = (uint64_t)m_gpr.regs[_REG_FS];
+    reg_value = (uint16_t)m_gpr.regs[_REG_FS];
     break;
   case lldb_gs_x86_64:
-    reg_value = (uint64_t)m_gpr.regs[_REG_GS];
+    reg_value = (uint16_t)m_gpr.regs[_REG_GS];
     break;
   case lldb_ss_x86_64:
     reg_value = (uint64_t)m_gpr.regs[_REG_SS];
     break;
   case lldb_ds_x86_64:
-    reg_value = (uint64_t)m_gpr.regs[_REG_DS];
+    reg_value = (uint16_t)m_gpr.regs[_REG_DS];
     break;
   case lldb_es_x86_64:
-    reg_value = (uint64_t)m_gpr.regs[_REG_ES];
+    reg_value = (uint16_t)m_gpr.regs[_REG_ES];
     break;
 #else
   case lldb_rax_x86_64:
@@ -588,19 +588,19 @@ NativeRegisterContextNetBSD_x86_64::ReadRegister(const RegisterInfo *reg_info,
     reg_value = (uint32_t)m_gpr.r_cs;
     break;
   case lldb_fs_x86_64:
-    reg_value = (uint32_t)m_gpr.r_fs;
+    reg_value = (uint16_t)m_gpr.r_fs;
     break;
   case lldb_gs_x86_64:
-    reg_value = (uint32_t)m_gpr.r_gs;
+    reg_value = (uint16_t)m_gpr.r_gs;
     break;
   case lldb_ss_x86_64:
     reg_value = (uint32_t)m_gpr.r_ss;
     break;
   case lldb_ds_x86_64:
-    reg_value = (uint32_t)m_gpr.r_ds;
+    reg_value = (uint16_t)m_gpr.r_ds;
     break;
   case lldb_es_x86_64:
-    reg_value = (uint32_t)m_gpr.r_es;
+    reg_value = (uint16_t)m_gpr.r_es;
     break;
 #endif
   case lldb_fctrl_x86_64:
@@ -830,19 +830,19 @@ Status NativeRegisterContextNetBSD_x86_64::WriteRegister(
     m_gpr.regs[_REG_CS] = reg_value.GetAsUInt64();
     break;
   case lldb_fs_x86_64:
-    m_gpr.regs[_REG_FS] = reg_value.GetAsUInt64();
+    m_gpr.regs[_REG_FS] = reg_value.GetAsUInt16();
     break;
   case lldb_gs_x86_64:
-    m_gpr.regs[_REG_GS] = reg_value.GetAsUInt64();
+    m_gpr.regs[_REG_GS] = reg_value.GetAsUInt16();
     break;
   case lldb_ss_x86_64:
     m_gpr.regs[_REG_SS] = reg_value.GetAsUInt64();
     break;
   case lldb_ds_x86_64:
-    m_gpr.regs[_REG_DS] = reg_value.GetAsUInt64();
+    m_gpr.regs[_REG_DS] = reg_value.GetAsUInt16();
     break;
   case lldb_es_x86_64:
-    m_gpr.regs[_REG_ES] = reg_value.GetAsUInt64();
+    m_gpr.regs[_REG_ES] = reg_value.GetAsUInt16();
     break;
 #else
   case lldb_rax_x86_64:
@@ -879,19 +879,19 @@ Status NativeRegisterContextNetBSD_x86_64::WriteRegister(
     m_gpr.r_cs = reg_value.GetAsUInt32();
     break;
   case lldb_fs_x86_64:
-    m_gpr.r_fs = reg_value.GetAsUInt32();
+    m_gpr.r_fs = reg_value.GetAsUInt16();
     break;
   case lldb_gs_x86_64:
-    m_gpr.r_gs = reg_value.GetAsUInt32();
+    m_gpr.r_gs = reg_value.GetAsUInt16();
     break;
   case lldb_ss_x86_64:
     m_gpr.r_ss = reg_value.GetAsUInt32();
     break;
   case lldb_ds_x86_64:
-    m_gpr.r_ds = reg_value.GetAsUInt32();
+    m_gpr.r_ds = reg_value.GetAsUInt16();
     break;
   case lldb_es_x86_64:
-    m_gpr.r_es = reg_value.GetAsUInt32();
+    m_gpr.r_es = reg_value.GetAsUInt16();
     break;
 #endif
   case lldb_fctrl_x86_64:


        


More information about the lldb-commits mailing list