[Lldb-commits] [lldb] r185054 - Fixed IRExecutionUnit so that it looks up addresses

Sean Callanan scallanan at apple.com
Wed Jun 26 18:42:47 PDT 2013


Author: spyffe
Date: Wed Jun 26 20:42:47 2013
New Revision: 185054

URL: http://llvm.org/viewvc/llvm-project?rev=185054&view=rev
Log:
Fixed IRExecutionUnit so that it looks up addresses
correctly.  We have been getting lucky since most
expressions generate only one section (or the first
code section contains all the code), but sometimes
it actually matters.

<rdar://problem/14180236>

Modified:
    lldb/trunk/source/Expression/IRExecutionUnit.cpp

Modified: lldb/trunk/source/Expression/IRExecutionUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRExecutionUnit.cpp?rev=185054&r1=185053&r2=185054&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRExecutionUnit.cpp (original)
+++ lldb/trunk/source/Expression/IRExecutionUnit.cpp Wed Jun 26 20:42:47 2013
@@ -564,6 +564,8 @@ IRExecutionUnit::MemoryManager::dealloca
 lldb::addr_t
 IRExecutionUnit::GetRemoteAddressForLocal (lldb::addr_t local_address)
 {
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+
     for (AllocationRecord &record : m_records)
     {
         if (local_address >= record.m_host_address &&
@@ -571,9 +573,22 @@ IRExecutionUnit::GetRemoteAddressForLoca
         {
             if (record.m_process_address == LLDB_INVALID_ADDRESS)
                 return LLDB_INVALID_ADDRESS;
+            
+            lldb::addr_t ret = record.m_process_address + (local_address - record.m_host_address);
+            
+            if (log)
+            {
+                log->Printf("IRExecutionUnit::GetRemoteAddressForLocal() found 0x%" PRIx64 " in [0x%" PRIx64 "..0x%" PRIx64 "], and returned 0x%" PRIx64 " from [0x%" PRIx64 "..0x%" PRIx64 "].",
+                            local_address,
+                            (unsigned long long)record.m_host_address,
+                            (unsigned long long)record.m_host_address + (unsigned long long)record.m_size,
+                            ret,
+                            record.m_process_address,
+                            record.m_process_address + record.m_size);
+            }
+            
+            return ret;
         }
-        
-        return record.m_process_address + (local_address - record.m_host_address);
     }
 
     return LLDB_INVALID_ADDRESS;





More information about the lldb-commits mailing list