[Lldb-commits] [lldb] r150523 - /lldb/trunk/source/Target/Process.cpp

Sean Callanan scallanan at apple.com
Tue Feb 14 14:50:38 PST 2012


Author: spyffe
Date: Tue Feb 14 16:50:38 2012
New Revision: 150523

URL: http://llvm.org/viewvc/llvm-project?rev=150523&view=rev
Log:
Only allow expressions to use the JIT if memory
can be allocated in the process.

Modified:
    lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=150523&r1=150522&r2=150523&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Tue Feb 14 16:50:38 2012
@@ -780,7 +780,7 @@
     m_allocated_memory_cache (*this),
     m_should_detach (false),
     m_next_event_action_ap(),
-    m_can_jit(eCanJITYes)
+    m_can_jit(eCanJITDontKnow)
 {
     UpdateInstanceName();
 
@@ -2160,6 +2160,22 @@
 bool
 Process::CanJIT ()
 {
+    if (m_can_jit == eCanJITDontKnow)
+    {
+        Error err;
+        
+        uint64_t allocated_memory = AllocateMemory(8, 
+                                                   ePermissionsReadable | ePermissionsWritable | ePermissionsExecutable, 
+                                                   err);
+        
+        if (err.Success())
+            m_can_jit = eCanJITYes;
+        else
+            m_can_jit = eCanJITNo;
+        
+        DeallocateMemory (allocated_memory);
+    }
+    
     return m_can_jit == eCanJITYes;
 }
 





More information about the lldb-commits mailing list