[Lldb-commits] [lldb] r113645 - /lldb/trunk/source/Symbol/SymbolContext.cpp

Greg Clayton gclayton at apple.com
Fri Sep 10 15:05:05 PDT 2010


Author: gclayton
Date: Fri Sep 10 17:05:05 2010
New Revision: 113645

URL: http://llvm.org/viewvc/llvm-project?rev=113645&view=rev
Log:
Make sure the address passed into SymbolContext::DumpStopContext() is valid before trying to calculate any offsets.

Modified:
    lldb/trunk/source/Symbol/SymbolContext.cpp

Modified: lldb/trunk/source/Symbol/SymbolContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolContext.cpp?rev=113645&r1=113644&r2=113645&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/SymbolContext.cpp (original)
+++ lldb/trunk/source/Symbol/SymbolContext.cpp Fri Sep 10 17:05:05 2010
@@ -156,9 +156,12 @@
                 return;
             }
         }
-        const addr_t function_offset = addr.GetOffset() - function->GetAddressRange().GetBaseAddress().GetOffset();
-        if (function_offset)
-            s->Printf(" + %llu", function_offset);
+        if (addr.IsValid())
+        {
+            const addr_t function_offset = addr.GetOffset() - function->GetAddressRange().GetBaseAddress().GetOffset();
+            if (function_offset)
+                s->Printf(" + %llu", function_offset);
+        }
 
         if (block != NULL)
         {
@@ -180,14 +183,14 @@
     {
         symbol->GetMangled().GetName().Dump(s);
 
-        if (symbol->GetAddressRangePtr())
+        if (addr.IsValid() && symbol->GetAddressRangePtr())
         {
             const addr_t symbol_offset = addr.GetOffset() - symbol->GetAddressRangePtr()->GetBaseAddress().GetOffset();
             if (symbol_offset)
                 s->Printf(" + %llu", symbol_offset);
         }
     }
-    else
+    else if (addr.IsValid())
     {
         addr.Dump(s, exe_scope, Address::DumpStyleModuleWithFileAddress);
     }





More information about the lldb-commits mailing list