[Lldb-commits] [PATCH] D21164: Improve watchpoint error reporting specially for arm/aarch64 targets

Muhammad Omair Javaid via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 27 05:42:43 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL273869: Improve watchpoint error reporting specially for arm/aarch64 targets (authored by omjavaid).

Changed prior to commit:
  http://reviews.llvm.org/D21164?vs=60127&id=61959#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21164

Files:
  lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
  lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
  lldb/trunk/source/Target/Target.cpp

Index: lldb/trunk/source/Target/Target.cpp
===================================================================
--- lldb/trunk/source/Target/Target.cpp
+++ lldb/trunk/source/Target/Target.cpp
@@ -709,14 +709,13 @@
 {
     uint32_t num_supported_hardware_watchpoints;
     Error rc = target->GetProcessSP()->GetWatchpointSupportInfo(num_supported_hardware_watchpoints);
-    if (rc.Success())
+    if (num_supported_hardware_watchpoints == 0)
     {
-        uint32_t num_current_watchpoints = target->GetWatchpointList().GetSize();
-        if (num_current_watchpoints >= num_supported_hardware_watchpoints)
-            error.SetErrorStringWithFormat("number of supported hardware watchpoints (%u) has been reached",
-                                           num_supported_hardware_watchpoints);
+        error.SetErrorStringWithFormat ("Target supports (%u) hardware watchpoint slots.\n",
+                    num_supported_hardware_watchpoints);
+        return false;
     }
-    return false;
+    return true;
 }
 
 // See also Watchpoint::SetWatchpointType(uint32_t type) and
@@ -750,6 +749,9 @@
         error.SetErrorStringWithFormat ("invalid watchpoint type: %d", kind);
     }
 
+    if (!CheckIfWatchpointsExhausted (this, error))
+        return wp_sp;
+
     // Currently we only support one watchpoint per address, with total number
     // of watchpoints limited by the hardware which the inferior is running on.
 
@@ -798,11 +800,9 @@
         // Remove the said watchpoint from the list maintained by the target instance.
         m_watchpoint_list.Remove (wp_sp->GetID(), true);
         // See if we could provide more helpful error message.
-        if (!CheckIfWatchpointsExhausted(this, error))
-        {
-            if (!OptionGroupWatchpoint::IsWatchSizeSupported(size))
-                error.SetErrorStringWithFormat("watch size of %" PRIu64 " is not supported", (uint64_t)size);
-        }
+        if (!OptionGroupWatchpoint::IsWatchSizeSupported(size))
+            error.SetErrorStringWithFormat("watch size of %" PRIu64 " is not supported", (uint64_t)size);
+
         wp_sp.reset();
     }
     else
Index: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
===================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
+++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
@@ -544,7 +544,7 @@
     error = ReadHardwareDebugInfo ();
 
     if (error.Fail())
-        return LLDB_INVALID_INDEX32;
+        return 0;
 
     return m_max_hwp_supported;
 }
Index: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
===================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
+++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
@@ -592,7 +592,7 @@
     error = ReadHardwareDebugInfo ();
 
     if (error.Fail())
-        return LLDB_INVALID_INDEX32;
+        return 0;
 
     return m_max_hwp_supported;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21164.61959.patch
Type: text/x-patch
Size: 3117 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160627/4854a203/attachment-0001.bin>


More information about the lldb-commits mailing list