[Lldb-commits] [lldb] r131472 - /lldb/trunk/source/Target/SectionLoadList.cpp

Greg Clayton gclayton at apple.com
Tue May 17 11:13:59 PDT 2011


Author: gclayton
Date: Tue May 17 13:13:59 2011
New Revision: 131472

URL: http://llvm.org/viewvc/llvm-project?rev=131472&view=rev
Log:
Fixed an issue where addresses would not get resolved for the last 
loaded section in the section load list.


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

Modified: lldb/trunk/source/Target/SectionLoadList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/SectionLoadList.cpp?rev=131472&r1=131471&r2=131472&view=diff
==============================================================================
--- lldb/trunk/source/Target/SectionLoadList.cpp (original)
+++ lldb/trunk/source/Target/SectionLoadList.cpp Tue May 17 13:13:59 2011
@@ -174,19 +174,36 @@
 {
     // First find the top level section that this load address exists in    
     Mutex::Locker locker(m_mutex);
-    addr_to_sect_collection::const_iterator pos = m_addr_to_sect.lower_bound (load_addr);
-    if (pos != m_addr_to_sect.end())
+    if (!m_addr_to_sect.empty())
     {
-        if (load_addr != pos->first && pos != m_addr_to_sect.begin())
-            --pos;
-        if (load_addr >= pos->first)
+        addr_to_sect_collection::const_iterator pos = m_addr_to_sect.lower_bound (load_addr);
+        if (pos != m_addr_to_sect.end())
         {
-            addr_t offset = load_addr - pos->first;
-            if (offset < pos->second->GetByteSize())
+            if (load_addr != pos->first && pos != m_addr_to_sect.begin())
+                --pos;
+            if (load_addr >= pos->first)
             {
-                // We have found the top level section, now we need to find the
-                // deepest child section.
-                return pos->second->ResolveContainedAddress (offset, so_addr);
+                addr_t offset = load_addr - pos->first;
+                if (offset < pos->second->GetByteSize())
+                {
+                    // We have found the top level section, now we need to find the
+                    // deepest child section.
+                    return pos->second->ResolveContainedAddress (offset, so_addr);
+                }
+            }
+        }
+        else
+        {
+            pos = m_addr_to_sect.begin();
+            if (load_addr >= pos->first)
+            {
+                addr_t offset = load_addr - pos->first;
+                if (offset < pos->second->GetByteSize())
+                {
+                    // We have found the top level section, now we need to find the
+                    // deepest child section.
+                    return pos->second->ResolveContainedAddress (offset, so_addr);
+                }
             }
         }
     }





More information about the lldb-commits mailing list