[Lldb-commits] [lldb] r168845 - /lldb/trunk/source/Target/StackFrame.cpp

Greg Clayton gclayton at apple.com
Wed Nov 28 16:53:06 PST 2012


Author: gclayton
Date: Wed Nov 28 18:53:06 2012
New Revision: 168845

URL: http://llvm.org/viewvc/llvm-project?rev=168845&view=rev
Log:
<rdar://problem/12445557>

Make stack frames fix up their line table entries when the target has source remappings. Also rearranged how the m_sc.target_sp was filled in so it can be used during the StackFrame::GetSymbolContext(...) function.


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

Modified: lldb/trunk/source/Target/StackFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrame.cpp?rev=168845&r1=168844&r2=168845&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackFrame.cpp (original)
+++ lldb/trunk/source/Target/StackFrame.cpp Wed Nov 28 18:53:06 2012
@@ -317,6 +317,17 @@
     // Copy our internal symbol context into "sc".
     if ((m_flags.Get() & resolve_scope) != resolve_scope)
     {
+        uint32_t resolved = 0;
+
+        // If the target was requested add that:
+        if (!m_sc.target_sp)
+        {
+            m_sc.target_sp = CalculateTarget();
+            if (m_sc.target_sp)
+                resolved |= eSymbolContextTarget;
+        }
+        
+
         // Resolve our PC to section offset if we haven't alreday done so
         // and if we don't have a module. The resolved address section will
         // contain the module to which it belongs
@@ -336,7 +347,6 @@
         }
 
 
-        uint32_t resolved = 0;
         if (m_sc.module_sp)
         {
             // We have something in our stack frame symbol context, lets check
@@ -420,9 +430,18 @@
                     m_sc.block = sc.block;
                 if ((resolved & eSymbolContextSymbol)    && m_sc.symbol == NULL)  
                     m_sc.symbol = sc.symbol;
-                if ((resolved & eSymbolContextLineEntry) && !m_sc.line_entry.IsValid()) 
+                if ((resolved & eSymbolContextLineEntry) && !m_sc.line_entry.IsValid())
+                {
                     m_sc.line_entry = sc.line_entry;
-
+                    if (m_sc.target_sp)
+                    {
+                        // Be sure to apply and file remappings to our file and line
+                        // entries when handing out a line entry
+                        FileSpec new_file_spec;
+                        if (m_sc.target_sp->GetSourcePathMap().FindFile (m_sc.line_entry.file, new_file_spec))
+                            m_sc.line_entry.file = new_file_spec;
+                    }
+                }
             }
         }
         else
@@ -430,17 +449,8 @@
             // If we don't have a module, then we can't have the compile unit,
             // function, block, line entry or symbol, so we can safely call
             // ResolveSymbolContextForAddress with our symbol context member m_sc.
-            TargetSP target_sp (CalculateTarget());
-            if (target_sp)
-                resolved |= target_sp->GetImages().ResolveSymbolContextForAddress (lookup_addr, resolve_scope, m_sc);
-        }
-
-        // If the target was requested add that:
-        if (!m_sc.target_sp)
-        {
-            m_sc.target_sp = CalculateTarget();
             if (m_sc.target_sp)
-                resolved |= eSymbolContextTarget;
+                resolved |= m_sc.target_sp->GetImages().ResolveSymbolContextForAddress (lookup_addr, resolve_scope, m_sc);
         }
 
         // Update our internal flags so we remember what we have tried to locate so





More information about the lldb-commits mailing list