[Lldb-commits] [lldb] r184451 - Fixed a problem with materialization and

Sean Callanan scallanan at apple.com
Thu Jun 20 11:42:16 PDT 2013


Author: spyffe
Date: Thu Jun 20 13:42:16 2013
New Revision: 184451

URL: http://llvm.org/viewvc/llvm-project?rev=184451&view=rev
Log:
Fixed a problem with materialization and
dematerialization of registers that caused
conditional breakpoint expressions not to
work properly.  Also added a testcase.

<rdar://problem/14129252>

Modified:
    lldb/trunk/include/lldb/Expression/Materializer.h
    lldb/trunk/source/Expression/Materializer.cpp
    lldb/trunk/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
    lldb/trunk/test/functionalities/breakpoint/breakpoint_conditions/main.c

Modified: lldb/trunk/include/lldb/Expression/Materializer.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/Materializer.h?rev=184451&r1=184450&r2=184451&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/Materializer.h (original)
+++ lldb/trunk/include/lldb/Expression/Materializer.h Thu Jun 20 13:42:16 2013
@@ -15,6 +15,7 @@
 #include "lldb/Expression/IRMemoryMap.h"
 #include "lldb/Host/Mutex.h"
 #include "lldb/Symbol/SymbolContext.h"
+#include "lldb/Target/StackFrame.h"
 
 #include <vector>
 
@@ -61,14 +62,19 @@ public:
                         IRMemoryMap &map,
                         lldb::addr_t process_address) :
             m_materializer(&materializer),
-            m_frame_wp(frame_sp),
             m_map(&map),
             m_process_address(process_address)
         {
+            if (frame_sp)
+            {
+                m_thread_wp = frame_sp->GetThread();
+                m_stack_id = frame_sp->GetStackID();
+            }
         }
         
         Materializer       *m_materializer;
-        lldb::StackFrameWP  m_frame_wp;
+        lldb::ThreadWP      m_thread_wp;
+        StackID             m_stack_id;
         IRMemoryMap        *m_map;
         lldb::addr_t        m_process_address;
     };

Modified: lldb/trunk/source/Expression/Materializer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/Materializer.cpp?rev=184451&r1=184450&r2=184451&view=diff
==============================================================================
--- lldb/trunk/source/Expression/Materializer.cpp (original)
+++ lldb/trunk/source/Expression/Materializer.cpp Thu Jun 20 13:42:16 2013
@@ -21,6 +21,7 @@
 #include "lldb/Target/RegisterContext.h"
 #include "lldb/Target/StackFrame.h"
 #include "lldb/Target/Target.h"
+#include "lldb/Target/Thread.h"
 
 using namespace lldb_private;
 
@@ -1288,7 +1289,11 @@ Materializer::Materialize (lldb::StackFr
 void
 Materializer::Dematerializer::Dematerialize (Error &error, lldb::ClangExpressionVariableSP &result_sp, lldb::addr_t frame_bottom, lldb::addr_t frame_top)
 {
-    lldb::StackFrameSP frame_sp = m_frame_wp.lock();
+    lldb::StackFrameSP frame_sp;
+
+    lldb::ThreadSP thread_sp = m_thread_wp.lock();
+    if (thread_sp)
+        frame_sp = thread_sp->GetFrameWithStackID(m_stack_id);
     
     ExecutionContextScope *exe_scope = m_map->GetBestExecutionContextScope();
     

Modified: lldb/trunk/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py?rev=184451&r1=184450&r2=184451&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py (original)
+++ lldb/trunk/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py Thu Jun 20 13:42:16 2013
@@ -117,6 +117,20 @@ class BreakpointConditionsTestCase(TestB
         self.expect("frame variable --show-types val", VARIABLES_DISPLAYED_CORRECTLY,
             startstr = '(int) val = 1')
 
+        self.runCmd("process kill")
+        self.runCmd("breakpoint disable")
+
+        self.runCmd("breakpoint set -p Loop")
+        self.runCmd("breakpoint modify -c ($eax&&!i)")
+        self.runCmd("run")
+        
+        self.expect("process status", PROCESS_STOPPED,
+            patterns = ['Process .* stopped'])
+
+        self.runCmd("continue")
+
+        self.expect("process status", PROCESS_EXITED,
+            patterns = ['Process .* exited'])
 
     def breakpoint_conditions_python(self):
         """Use Python APIs to set breakpoint conditions."""

Modified: lldb/trunk/test/functionalities/breakpoint/breakpoint_conditions/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/breakpoint/breakpoint_conditions/main.c?rev=184451&r1=184450&r2=184451&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/breakpoint/breakpoint_conditions/main.c (original)
+++ lldb/trunk/test/functionalities/breakpoint/breakpoint_conditions/main.c Thu Jun 20 13:42:16 2013
@@ -46,6 +46,9 @@ int main (int argc, char const *argv[])
     
     int A3 = a(3);  // a(3) -> c(3)
     printf("a(3) returns %d\n", A3);
+
+    for (int i = 0; i < 2; ++i)
+        printf("Loop\n");
     
     return 0;
 }





More information about the lldb-commits mailing list