<rdar://problem/9958446>
<rdar://problem/10561406>

Stopped the SymbolFileDWARF::FindFunctions (...) from always calculating
the line table entry for all functions that were found. This can slow down
the expression parser if it ends up finding a bunch of matches. Fixed the 
places that were relying on the line table entry being filled in.

Discovered a recursive stack blowout that happened when "main" didn't have
line info for it and there was no line information for "main"

llvm-svn: 146330
diff --git a/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp
index 89131ca..2ea3bb1 100644
--- a/lldb/source/Core/Address.cpp
+++ b/lldb/source/Core/Address.cpp
@@ -729,7 +729,7 @@
 }
 
 uint32_t
-Address::CalculateSymbolContext (SymbolContext *sc, uint32_t resolve_scope)
+Address::CalculateSymbolContext (SymbolContext *sc, uint32_t resolve_scope) const
 {
     sc->Clear();
     // Absolute addresses don't have enough information to reconstruct even their target.
@@ -747,7 +747,7 @@
 }
 
 Module *
-Address::CalculateSymbolContextModule ()
+Address::CalculateSymbolContextModule () const
 {
     if (m_section)
         return m_section->GetModule();
@@ -755,7 +755,7 @@
 }
 
 CompileUnit *
-Address::CalculateSymbolContextCompileUnit ()
+Address::CalculateSymbolContextCompileUnit () const
 {
     if (m_section)
     {
@@ -771,7 +771,7 @@
 }
 
 Function *
-Address::CalculateSymbolContextFunction ()
+Address::CalculateSymbolContextFunction () const
 {
     if (m_section)
     {
@@ -787,7 +787,7 @@
 }
 
 Block *
-Address::CalculateSymbolContextBlock ()
+Address::CalculateSymbolContextBlock () const
 {
     if (m_section)
     {
@@ -803,7 +803,7 @@
 }
 
 Symbol *
-Address::CalculateSymbolContextSymbol ()
+Address::CalculateSymbolContextSymbol () const
 {
     if (m_section)
     {
@@ -819,7 +819,7 @@
 }
 
 bool
-Address::CalculateSymbolContextLineEntry (LineEntry &line_entry)
+Address::CalculateSymbolContextLineEntry (LineEntry &line_entry) const
 {
     if (m_section)
     {
diff --git a/lldb/source/Core/SourceManager.cpp b/lldb/source/Core/SourceManager.cpp
index 482ccbb..3e4a78a 100644
--- a/lldb/source/Core/SourceManager.cpp
+++ b/lldb/source/Core/SourceManager.cpp
@@ -250,19 +250,22 @@
             {
                 SymbolContext sc;
                 sc_list.GetContextAtIndex(idx, sc);
-                if (sc.line_entry.file)
+                if (sc.function)
                 {
-                    SetDefaultFileAndLine(sc.line_entry.file, sc.line_entry.line);
-                    break;
+                    lldb_private::LineEntry line_entry;
+                    if (sc.function->GetAddressRange().GetBaseAddress().CalculateSymbolContextLineEntry (line_entry))
+                    {
+                        SetDefaultFileAndLine (line_entry.file, 
+                                               line_entry.line);
+                        file_spec = m_last_file_sp->GetFileSpec();
+                        line = m_last_file_line;
+                        return true;
+                    }
                 }
             }
-            return GetDefaultFileAndLine (file_spec, line);
         }
-        else
-            return false;
     }
-    else
-        return false;
+    return false;
 }
 
 void