[Lldb-commits] [lldb] r307636 - NativeProcessLinux: Fix some compiler warnings

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Jul 11 02:03:38 PDT 2017


Author: labath
Date: Tue Jul 11 02:03:38 2017
New Revision: 307636

URL: http://llvm.org/viewvc/llvm-project?rev=307636&view=rev
Log:
NativeProcessLinux: Fix some compiler warnings

Modified:
    lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
    lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp

Modified: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp?rev=307636&r1=307635&r2=307636&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp Tue Jul 11 02:03:38 2017
@@ -680,7 +680,7 @@ Status NativeRegisterContextLinux_arm64:
     return error;
 
   lldb::addr_t tempAddr = 0;
-  uint32_t tempControl = 0, tempRefCount = 0;
+  uint32_t tempControl = 0;
 
   for (uint32_t i = 0; i < m_max_hwp_supported; i++) {
     if (m_hwp_regs[i].control & 0x01) {
@@ -858,7 +858,7 @@ Status NativeRegisterContextLinux_arm64:
     RegisterValue &value) {
   Status error;
   if (offset > sizeof(struct user_pt_regs)) {
-    uintptr_t offset = offset - sizeof(struct user_pt_regs);
+    offset -= sizeof(struct user_pt_regs);
     if (offset > sizeof(struct user_fpsimd_state)) {
       error.SetErrorString("invalid offset value");
       return error;
@@ -905,7 +905,7 @@ Status NativeRegisterContextLinux_arm64:
   Status error;
   ::pid_t tid = m_thread.GetID();
   if (offset > sizeof(struct user_pt_regs)) {
-    uintptr_t offset = offset - sizeof(struct user_pt_regs);
+    offset -= sizeof(struct user_pt_regs);
     if (offset > sizeof(struct user_fpsimd_state)) {
       error.SetErrorString("invalid offset value");
       return error;

Modified: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp?rev=307636&r1=307635&r2=307636&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp Tue Jul 11 02:03:38 2017
@@ -646,13 +646,6 @@ Status NativeRegisterContextLinux_x86_64
   Status error;
 
   data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0));
-  if (!data_sp) {
-    error.SetErrorStringWithFormat(
-        "failed to allocate DataBufferHeap instance of size %" PRIu64,
-        REG_CONTEXT_SIZE);
-    return error;
-  }
-
   error = ReadGPR();
   if (error.Fail())
     return error;
@@ -662,13 +655,6 @@ Status NativeRegisterContextLinux_x86_64
     return error;
 
   uint8_t *dst = data_sp->GetBytes();
-  if (dst == nullptr) {
-    error.SetErrorStringWithFormat("DataBufferHeap instance of size %" PRIu64
-                                   " returned a null pointer",
-                                   REG_CONTEXT_SIZE);
-    return error;
-  }
-
   ::memcpy(dst, &m_gpr_x86_64, GetRegisterInfoInterface().GetGPRSize());
   dst += GetRegisterInfoInterface().GetGPRSize();
   if (m_xstate_type == XStateType::FXSAVE)
@@ -741,10 +727,9 @@ Status NativeRegisterContextLinux_x86_64
   }
 
   if (data_sp->GetByteSize() != REG_CONTEXT_SIZE) {
-    error.SetErrorStringWithFormat(
-        "NativeRegisterContextLinux_x86_64::%s data_sp contained mismatched "
-        "data size, expected %" PRIu64 ", actual %" PRIu64,
-        __FUNCTION__, REG_CONTEXT_SIZE, data_sp->GetByteSize());
+    error.SetErrorStringWithFormatv(
+        "data_sp contained mismatched data size, expected {0}, actual {1}",
+        REG_CONTEXT_SIZE, data_sp->GetByteSize());
     return error;
   }
 




More information about the lldb-commits mailing list