[Lldb-commits] [lldb] r123799 - /lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp

Stephen Wilson wilsons at start.ca
Tue Jan 18 17:33:33 PST 2011


Author: wilsons
Date: Tue Jan 18 19:33:33 2011
New Revision: 123799

URL: http://llvm.org/viewvc/llvm-project?rev=123799&view=rev
Log:
Fix implementation of LinuxThread::HardwareSingleStep.

Previous version simply resumed the associated thread to single step over a
single instruction which is not the intended semantics for this method.  Set the
appropriate bit in the rflags register instead.


Modified:
    lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp

Modified: lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp?rev=123799&r1=123798&r2=123799&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp Tue Jan 18 19:33:33 2011
@@ -690,7 +690,28 @@
 bool
 RegisterContextLinux_x86_64::HardwareSingleStep(bool enable)
 {
-    return GetMonitor().SingleStep(GetThreadID());
+    enum { TRACE_BIT = 0x100 };
+    uint64_t rflags;
+
+    if ((rflags = ReadRegisterAsUnsigned(gpr_rflags, -1UL)) == -1UL)
+        return false;
+    
+    if (enable)
+    {
+        if (rflags & TRACE_BIT)
+            return true;
+
+        rflags |= TRACE_BIT;
+    }
+    else
+    {
+        if (!(rflags & TRACE_BIT))
+            return false;
+
+        rflags &= ~TRACE_BIT;
+    }
+
+    return WriteRegisterFromUnsigned(gpr_rflags, rflags);
 }
 
 bool





More information about the lldb-commits mailing list