[Lldb-commits] [lldb] r131394 - in /lldb/trunk/source: Expression/ClangExpressionParser.cpp Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Greg Clayton gclayton at apple.com
Sun May 15 16:56:53 PDT 2011


Author: gclayton
Date: Sun May 15 18:56:52 2011
New Revision: 131394

URL: http://llvm.org/viewvc/llvm-project?rev=131394&view=rev
Log:
Dump JIT memory requirements when "log enable lldb expr" logging is enabled.

Correctly handle invalid 32-bit mmap fail return value in ProcessGDBRemote.


Modified:
    lldb/trunk/source/Expression/ClangExpressionParser.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Modified: lldb/trunk/source/Expression/ClangExpressionParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionParser.cpp?rev=131394&r1=131393&r2=131394&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionParser.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionParser.cpp Sun May 15 18:56:52 2011
@@ -620,9 +620,14 @@
     
     std::map<uint8_t *, uint8_t *>::iterator fun_pos = jit_memory_manager->m_functions.begin();
     std::map<uint8_t *, uint8_t *>::iterator fun_end = jit_memory_manager->m_functions.end();
-    
+
     for (; fun_pos != fun_end; ++fun_pos)
-        alloc_size += (*fun_pos).second - (*fun_pos).first;
+    {
+        size_t mem_size = fun_pos->second - fun_pos->first;
+        if (log)
+            log->Printf ("JIT memory: [%p - %p) size = %zu", fun_pos->first, fun_pos->second, mem_size);
+        alloc_size += mem_size;
+    }
     
     Error alloc_error;
     func_allocation_addr = exc_context.process->AllocateMemory (alloc_size, 

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=131394&r1=131393&r2=131394&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Sun May 15 18:56:52 2011
@@ -1637,7 +1637,13 @@
                                     if (result == eExecutionCompleted)
                                     {
                                         allocated_addr = return_value_sp->GetScalar().ULongLong();
-                                        m_addr_to_mmap_size[allocated_addr] = size;
+                                        if (GetAddressByteSize() == 4)
+                                        {
+                                            if (allocated_addr == UINT32_MAX)
+                                                allocated_addr = LLDB_INVALID_ADDRESS;
+                                        }
+                                        if (allocated_addr != LLDB_INVALID_ADDRESS)
+                                            m_addr_to_mmap_size[allocated_addr] = size;
                                     }
                                 }
                             }





More information about the lldb-commits mailing list