[Lldb-commits] [lldb] r140416 - /lldb/trunk/source/Target/ThreadPlanStepRange.cpp

Jim Ingham jingham at apple.com
Fri Sep 23 14:08:11 PDT 2011


Author: jingham
Date: Fri Sep 23 16:08:11 2011
New Revision: 140416

URL: http://llvm.org/viewvc/llvm-project?rev=140416&view=rev
Log:
If stepping takes us from the line range we were stepping through into the MIDDLE of another line, then continue till we get to the real beginning of a line.  This is mostly to work around debug information bugs.

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

Modified: lldb/trunk/source/Target/ThreadPlanStepRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepRange.cpp?rev=140416&r1=140415&r2=140416&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepRange.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepRange.cpp Fri Sep 23 16:08:11 2011
@@ -115,20 +115,44 @@
         SymbolContext new_context(frame->GetSymbolContext(eSymbolContextEverything));
         if (m_addr_context.line_entry.IsValid() && new_context.line_entry.IsValid())
         {
-           if ((m_addr_context.line_entry.file == new_context.line_entry.file)
-               && (m_addr_context.line_entry.line == new_context.line_entry.line))
+            if (m_addr_context.line_entry.file == new_context.line_entry.file)
             {
-                m_addr_context = new_context;
-                m_address_range = m_addr_context.line_entry.range;
-                ret_value = true;
-                if (log)
+                if (m_addr_context.line_entry.line == new_context.line_entry.line)
                 {
-                    StreamString s;
-                    m_address_range.Dump (&s, &m_thread.GetProcess().GetTarget(), Address::DumpStyleLoadAddress);
+                    m_addr_context = new_context;
+                    m_address_range = m_addr_context.line_entry.range;
+                    ret_value = true;
+                    if (log)
+                    {
+                        StreamString s;
+                        m_address_range.Dump (&s, &m_thread.GetProcess().GetTarget(), Address::DumpStyleLoadAddress);
 
-                    log->Printf ("Step range plan stepped to another range of same line: %s", s.GetData());
+                        log->Printf ("Step range plan stepped to another range of same line: %s", s.GetData());
+                    }
+                }
+                else if (new_context.line_entry.range.GetBaseAddress().GetLoadAddress(&m_thread.GetProcess().GetTarget())
+                         != pc_load_addr)
+                {
+                    // Another thing that sometimes happens here is that we step out of one line into the MIDDLE of another
+                    // line.  So far I mostly see this due to bugs in the debug information.
+                    // But we probably don't want to be in the middle of a line range, so in that case reset the stepping
+                    // range to the line we've stepped into the middle of and continue.
+                    m_addr_context = new_context;
+                    m_address_range = m_addr_context.line_entry.range;
+                    ret_value = true;
+                    if (log)
+                    {
+                        StreamString s;
+                        m_address_range.Dump (&s, &m_thread.GetProcess().GetTarget(), Address::DumpStyleLoadAddress);
+
+                        log->Printf ("Step range plan stepped to the middle of new line(%d): %s, continuing to clear this line.", 
+                                     new_context.line_entry.line, 
+                                     s.GetData());
+                    }
+                
                 }
             }
+            
         }
         
     }





More information about the lldb-commits mailing list