[lldb-dev] win64 "patch"

Carlo Kok via lldb-dev lldb-dev at lists.llvm.org
Thu Jun 2 01:40:38 PDT 2016


Seems win64 almost works fine out of the box. 1 minor thing is needed:


diff --git 
a/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp 
b/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp
index 103cff4..4b37c3f 100644
--- 
a/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp
+++ 
b/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp
@@ -136,6 +136,8 @@ RegisterInfo g_register_infos[] = {
       nullptr},
  };

+static size_t k_num_register_infos = 
llvm::array_lengthof(g_register_infos);
+
  // Array of lldb register numbers used to define the set of all 
General Purpose Registers
  uint32_t g_gpr_reg_indices[] = {eRegisterIndexRax, eRegisterIndexRbx, 
  eRegisterIndexRcx, eRegisterIndexRdx,
                                  eRegisterIndexRdi, eRegisterIndexRsi, 
  eRegisterIndexR8,  eRegisterIndexR9,
@@ -169,7 +171,9 @@ RegisterContextWindows_x64::GetRegisterCount()
  const RegisterInfo *
  RegisterContextWindows_x64::GetRegisterInfoAtIndex(size_t reg)
  {
-    return &g_register_infos[reg];
+       if (reg < k_num_register_infos)
+               return &g_register_infos[reg];
+       return NULL;
  }

  size_t


The unwind logic asks for the "return address register" which doesn't 
exist; returns -1 and goes out of the bounds for g_register_infos.

-- 
Carlo Kok
RemObjects Software


More information about the lldb-dev mailing list