[Lldb-commits] [lldb] r319536 - Kill struct IOVEC

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Fri Dec 1 04:05:00 PST 2017


Author: labath
Date: Fri Dec  1 04:05:00 2017
New Revision: 319536

URL: http://llvm.org/viewvc/llvm-project?rev=319536&view=rev
Log:
Kill struct IOVEC

struct iovec is used as an interface to system (posix) api's. As such,
we shouldn't be using it in os-independent code, and we shouldn't be
defining our own iovec replacements.

Fortunately, its usage was not very widespread, so the removal was very
easy -- I simply moved a couple declarations into os-specific code.

Modified:
    lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp
    lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.h
    lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
    lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h
    lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h
    lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp
    lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h
    lldb/trunk/source/Plugins/Process/Utility/RegisterContext_mips.h
    lldb/trunk/source/Plugins/Process/Utility/RegisterContext_x86.h

Modified: lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp?rev=319536&r1=319535&r2=319536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp (original)
+++ lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp Fri Dec  1 04:05:00 2017
@@ -58,6 +58,9 @@ RegisterContextPOSIXProcessMonitor_x86_6
   // Store byte offset of fctrl (i.e. first register of FPR) wrt 'UserArea'
   const RegisterInfo *reg_info_fctrl = GetRegisterInfoByName("fctrl");
   m_fctrl_offset_in_userarea = reg_info_fctrl->byte_offset;
+
+  m_iovec.iov_base = &m_fpr.xstate.xsave;
+  m_iovec.iov_len = sizeof(m_fpr.xstate.xsave);
 }
 
 ProcessMonitor &RegisterContextPOSIXProcessMonitor_x86_64::GetMonitor() {

Modified: lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.h?rev=319536&r1=319535&r2=319536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.h (original)
+++ lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.h Fri Dec  1 04:05:00 2017
@@ -12,6 +12,7 @@
 
 #include "Plugins/Process/Utility/RegisterContextPOSIX_x86.h"
 #include "RegisterContextPOSIX.h"
+#include <sys/uio.h>
 
 class RegisterContextPOSIXProcessMonitor_x86_64
     : public RegisterContextPOSIX_x86,
@@ -75,6 +76,7 @@ private:
   ProcessMonitor &GetMonitor();
   uint32_t
       m_fctrl_offset_in_userarea; // Offset of 'fctrl' in 'UserArea' Structure
+  struct iovec m_iovec;
 };
 
 #endif

Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp?rev=319536&r1=319535&r2=319536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp Fri Dec  1 04:05:00 2017
@@ -177,7 +177,7 @@ void PtraceDisplayBytes(int &req, void *
     break;
   }
   case PTRACE_SETREGSET: {
-    // Extract iov_base from data, which is a pointer to the struct IOVEC
+    // Extract iov_base from data, which is a pointer to the struct iovec
     DisplayBytes(buf, *(void **)data, data_size);
     LLDB_LOGV(log, "PTRACE_SETREGSET {0}", buf.GetData());
     break;

Modified: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h?rev=319536&r1=319535&r2=319536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h Fri Dec  1 04:05:00 2017
@@ -15,6 +15,7 @@
 #include "Plugins/Process/Linux/NativeRegisterContextLinux.h"
 #include "Plugins/Process/Utility/RegisterContext_mips.h"
 #include "Plugins/Process/Utility/lldb-mips-linux-register-enums.h"
+#include <sys/uio.h>
 
 #define MAX_NUM_WP 8
 
@@ -128,7 +129,7 @@ private:
 
   lldb::addr_t hw_addr_map[MAX_NUM_WP];
 
-  IOVEC_mips m_iovec;
+  struct iovec m_iovec;
 };
 
 } // namespace process_linux

Modified: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h?rev=319536&r1=319535&r2=319536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h Fri Dec  1 04:05:00 2017
@@ -15,6 +15,7 @@
 #include "Plugins/Process/Linux/NativeRegisterContextLinux.h"
 #include "Plugins/Process/Utility/RegisterContext_x86.h"
 #include "Plugins/Process/Utility/lldb-x86-register-enums.h"
+#include <sys/uio.h>
 
 namespace lldb_private {
 namespace process_linux {
@@ -109,7 +110,7 @@ private:
   // Private member variables.
   mutable XStateType m_xstate_type;
   FPR m_fpr; // Extended States Area, named FPR for historical reasons.
-  IOVEC m_iovec;
+  struct iovec m_iovec;
   YMM m_ymm_set;
   MPX m_mpx_set;
   RegInfo m_reg_info;

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp?rev=319536&r1=319535&r2=319536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp Fri Dec  1 04:05:00 2017
@@ -365,12 +365,6 @@ RegisterContextPOSIX_x86::RegisterContex
     break;
   }
 
-  // Initialize m_iovec to point to the buffer and buffer size
-  // using the conventions of Berkeley style UIO structures, as required
-  // by PTRACE extensions.
-  m_iovec.iov_base = &m_fpr.xstate.xsave;
-  m_iovec.iov_len = sizeof(m_fpr.xstate.xsave);
-
   ::memset(&m_fpr, 0, sizeof(FPR));
 
   m_fpr_type = eNotValid;

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h?rev=319536&r1=319535&r2=319536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h Fri Dec  1 04:05:00 2017
@@ -151,7 +151,6 @@ protected:
       m_fpr_type; // determines the type of data stored by union FPR, if any.
   lldb_private::FPR m_fpr;     // floating-point registers including extended
                                // register sets.
-  lldb_private::IOVEC m_iovec; // wrapper for xsave.
   lldb_private::YMM m_ymm_set; // copy of ymmh and xmm register halves.
   std::unique_ptr<lldb_private::RegisterInfoInterface>
       m_register_info_ap; // Register Info Interface (FreeBSD or Linux)

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContext_mips.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContext_mips.h?rev=319536&r1=319535&r2=319536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContext_mips.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContext_mips.h Fri Dec  1 04:05:00 2017
@@ -241,11 +241,6 @@ enum {
   dwarf_config5_mips64,
 };
 
-struct IOVEC_mips {
-  void *iov_base;
-  size_t iov_len;
-};
-
 // GP registers
 struct GPR_linux_mips {
   uint64_t zero;

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContext_x86.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContext_x86.h?rev=319536&r1=319535&r2=319536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContext_x86.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContext_x86.h Fri Dec  1 04:05:00 2017
@@ -363,15 +363,6 @@ struct FPR {
   } xstate;
 };
 
-//---------------------------------------------------------------------------
-// ptrace PTRACE_GETREGSET, PTRACE_SETREGSET structure
-//---------------------------------------------------------------------------
-
-struct IOVEC {
-  void *iov_base; // pointer to XSAVE
-  size_t iov_len; // sizeof(XSAVE)
-};
-
 LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE();
 
 } // namespace lldb_private




More information about the lldb-commits mailing list