[Lldb-commits] [lldb] r160071 - in /lldb/trunk: include/lldb/Target/StackFrame.h include/lldb/Target/StackFrameList.h include/lldb/Target/Thread.h source/Commands/CommandObjectFrame.cpp source/Core/Debugger.cpp source/Target/StackFrame.cpp source/Target/StackFrameList.cpp source/Target/Thread.cpp

Greg Clayton gclayton at apple.com
Wed Jul 11 13:33:49 PDT 2012


Author: gclayton
Date: Wed Jul 11 15:33:48 2012
New Revision: 160071

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

The "stop-line-count-after" and "stop-line-count-before" settings are broken. This fixes them.


Modified:
    lldb/trunk/include/lldb/Target/StackFrame.h
    lldb/trunk/include/lldb/Target/StackFrameList.h
    lldb/trunk/include/lldb/Target/Thread.h
    lldb/trunk/source/Commands/CommandObjectFrame.cpp
    lldb/trunk/source/Core/Debugger.cpp
    lldb/trunk/source/Target/StackFrame.cpp
    lldb/trunk/source/Target/StackFrameList.cpp
    lldb/trunk/source/Target/Thread.cpp

Modified: lldb/trunk/include/lldb/Target/StackFrame.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/StackFrame.h?rev=160071&r1=160070&r2=160071&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/StackFrame.h (original)
+++ lldb/trunk/include/lldb/Target/StackFrame.h Wed Jul 11 15:33:48 2012
@@ -167,9 +167,7 @@
     bool
     GetStatus (Stream &strm,
                bool show_frame_info,
-               bool show_source,
-               uint32_t source_lines_before,
-               uint32_t source_lines_after);
+               bool show_source);
     
 protected:
     friend class StackFrameList;

Modified: lldb/trunk/include/lldb/Target/StackFrameList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/StackFrameList.h?rev=160071&r1=160070&r2=160071&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/StackFrameList.h (original)
+++ lldb/trunk/include/lldb/Target/StackFrameList.h Wed Jul 11 15:33:48 2012
@@ -76,9 +76,7 @@
                uint32_t first_frame,
                uint32_t num_frames,
                bool show_frame_info,
-               uint32_t num_frames_with_source,
-               uint32_t source_lines_before,
-               uint32_t source_lines_after);
+               uint32_t num_frames_with_source);
     
 protected:
 

Modified: lldb/trunk/include/lldb/Target/Thread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Thread.h?rev=160071&r1=160070&r2=160071&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Thread.h (original)
+++ lldb/trunk/include/lldb/Target/Thread.h Wed Jul 11 15:33:48 2012
@@ -762,9 +762,7 @@
                          uint32_t first_frame,
                          uint32_t num_frames,
                          bool show_frame_info,
-                         uint32_t num_frames_with_source,
-                         uint32_t source_lines_before,
-                         uint32_t source_lines_after);
+                         uint32_t num_frames_with_source);
 
     // We need a way to verify that even though we have a thread in a shared
     // pointer that the object itself is still valid. Currently this won't be

Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=160071&r1=160070&r2=160071&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Wed Jul 11 15:33:48 2012
@@ -282,14 +282,7 @@
 
                     bool show_frame_info = true;
                     bool show_source = !already_shown;
-                    Debugger &debugger = m_interpreter.GetDebugger();
-                    const uint32_t source_lines_before = debugger.GetStopSourceLineCount(true);
-                    const uint32_t source_lines_after = debugger.GetStopSourceLineCount(false);
-                    if (frame->GetStatus (result.GetOutputStream(),
-                                          show_frame_info,
-                                          show_source,
-                                          source_lines_before,
-                                          source_lines_after))
+                    if (frame->GetStatus (result.GetOutputStream(), show_frame_info, show_source))
                     {
                         result.SetStatus (eReturnStatusSuccessFinishResult);
                         return result.Succeeded();

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=160071&r1=160070&r2=160071&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Wed Jul 11 15:33:48 2012
@@ -2630,7 +2630,7 @@
         if (new_value != UINT32_MAX)
             m_stop_source_before_count = new_value;
         else
-            err.SetErrorStringWithFormat("invalid unsigned string value '%s' for the '%s' setting", value, StopSourceContextAfterName ().GetCString());
+            err.SetErrorStringWithFormat("invalid unsigned string value '%s' for the '%s' setting", value, StopSourceContextBeforeName ().GetCString());
     }
     else if (var_name == StopSourceContextAfterName ())
     {
@@ -2638,7 +2638,7 @@
         if (new_value != UINT32_MAX)
             m_stop_source_after_count = new_value;
         else
-            err.SetErrorStringWithFormat("invalid unsigned string value '%s' for the '%s' setting", value, StopSourceContextBeforeName ().GetCString());
+            err.SetErrorStringWithFormat("invalid unsigned string value '%s' for the '%s' setting", value, StopSourceContextAfterName ().GetCString());
     }
     else if (var_name == StopDisassemblyCountName ())
     {
@@ -2703,13 +2703,13 @@
     else if (var_name == StopSourceContextAfterName ())
     {
         StreamString strm;
-        strm.Printf ("%u", m_stop_source_before_count);
+        strm.Printf ("%u", m_stop_source_after_count);
         value.AppendString (strm.GetData());
     }
     else if (var_name == StopSourceContextBeforeName ())
     {
         StreamString strm;
-        strm.Printf ("%u", m_stop_source_after_count);
+        strm.Printf ("%u", m_stop_source_before_count);
         value.AppendString (strm.GetData());
     }
     else if (var_name == StopDisassemblyCountName ())

Modified: lldb/trunk/source/Target/StackFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrame.cpp?rev=160071&r1=160070&r2=160071&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackFrame.cpp (original)
+++ lldb/trunk/source/Target/StackFrame.cpp Wed Jul 11 15:33:48 2012
@@ -1296,10 +1296,9 @@
 bool
 StackFrame::GetStatus (Stream& strm,
                        bool show_frame_info,
-                       bool show_source,
-                       uint32_t source_lines_before,
-                       uint32_t source_lines_after)
+                       bool show_source)
 {
+    
     if (show_frame_info)
     {
         strm.Indent();
@@ -1312,56 +1311,62 @@
         bool have_source = false;
         DebuggerInstanceSettings::StopDisassemblyType disasm_display = DebuggerInstanceSettings::eStopDisassemblyTypeNever;
         Target *target = exe_ctx.GetTargetPtr();
-        if (target && (source_lines_before || source_lines_after))
+        if (target)
         {
-            GetSymbolContext(eSymbolContextCompUnit | eSymbolContextLineEntry);
+            Debugger &debugger = target->GetDebugger();
+            const uint32_t source_lines_before = debugger.GetStopSourceLineCount(true);
+            const uint32_t source_lines_after = debugger.GetStopSourceLineCount(false);
+            disasm_display = debugger.GetStopDisassemblyDisplay ();
 
-            if (m_sc.comp_unit && m_sc.line_entry.IsValid())
+            if (source_lines_before > 0 || source_lines_after > 0)
             {
-                if (target->GetSourceManager().DisplaySourceLinesWithLineNumbers (m_sc.line_entry.file,
-                                                                                  m_sc.line_entry.line,
-                                                                                  source_lines_before,
-                                                                                  source_lines_after,
-                                                                                  "->",
-                                                                                  &strm))
+                GetSymbolContext(eSymbolContextCompUnit | eSymbolContextLineEntry);
+
+                if (m_sc.comp_unit && m_sc.line_entry.IsValid())
                 {
-                    have_source = true;
+                    if (target->GetSourceManager().DisplaySourceLinesWithLineNumbers (m_sc.line_entry.file,
+                                                                                      m_sc.line_entry.line,
+                                                                                      source_lines_before,
+                                                                                      source_lines_after,
+                                                                                      "->",
+                                                                                      &strm))
+                    {
+                        have_source = true;
+                    }
                 }
             }
-            disasm_display = target->GetDebugger().GetStopDisassemblyDisplay ();
-        }
-        
-        switch (disasm_display)
-        {
-        case DebuggerInstanceSettings::eStopDisassemblyTypeNever:
-            break;
-
-        case DebuggerInstanceSettings::eStopDisassemblyTypeNoSource:
-            if (have_source)
-                break;
-            // Fall through to next case
-        case DebuggerInstanceSettings::eStopDisassemblyTypeAlways:
-            if (target)
+            switch (disasm_display)
             {
-                const uint32_t disasm_lines = target->GetDebugger().GetDisassemblyLineCount();
-                if (disasm_lines > 0)
+            case DebuggerInstanceSettings::eStopDisassemblyTypeNever:
+                break;
+                
+            case DebuggerInstanceSettings::eStopDisassemblyTypeNoSource:
+                if (have_source)
+                    break;
+                // Fall through to next case
+            case DebuggerInstanceSettings::eStopDisassemblyTypeAlways:
+                if (target)
                 {
-                    const ArchSpec &target_arch = target->GetArchitecture();
-                    AddressRange pc_range;
-                    pc_range.GetBaseAddress() = GetFrameCodeAddress();
-                    pc_range.SetByteSize(disasm_lines * target_arch.GetMaximumOpcodeByteSize());
-                    Disassembler::Disassemble (target->GetDebugger(),
-                                               target_arch,
-                                               NULL,
-                                               exe_ctx,
-                                               pc_range,
-                                               disasm_lines,
-                                               0,
-                                               Disassembler::eOptionMarkPCAddress,
-                                               strm);
+                    const uint32_t disasm_lines = debugger.GetDisassemblyLineCount();
+                    if (disasm_lines > 0)
+                    {
+                        const ArchSpec &target_arch = target->GetArchitecture();
+                        AddressRange pc_range;
+                        pc_range.GetBaseAddress() = GetFrameCodeAddress();
+                        pc_range.SetByteSize(disasm_lines * target_arch.GetMaximumOpcodeByteSize());
+                        Disassembler::Disassemble (target->GetDebugger(),
+                                                   target_arch,
+                                                   NULL,
+                                                   exe_ctx,
+                                                   pc_range,
+                                                   disasm_lines,
+                                                   0,
+                                                   Disassembler::eOptionMarkPCAddress,
+                                                   strm);
+                    }
                 }
+                break;
             }
-            break;
         }
     }
     return true;

Modified: lldb/trunk/source/Target/StackFrameList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrameList.cpp?rev=160071&r1=160070&r2=160071&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackFrameList.cpp (original)
+++ lldb/trunk/source/Target/StackFrameList.cpp Wed Jul 11 15:33:48 2012
@@ -587,9 +587,7 @@
                            uint32_t first_frame,
                            uint32_t num_frames,
                            bool show_frame_info,
-                           uint32_t num_frames_with_source,
-                           uint32_t source_lines_before,
-                           uint32_t source_lines_after)
+                           uint32_t num_frames_with_source)
 {
     size_t num_frames_displayed = 0;
     
@@ -614,9 +612,7 @@
         
         if (!frame_sp->GetStatus (strm,
                                   show_frame_info,
-                                  num_frames_with_source > first_frame - frame_idx,
-                                  source_lines_before,
-                                  source_lines_after))
+                                  num_frames_with_source > (first_frame - frame_idx)))
             break;
         ++num_frames_displayed;
     }

Modified: lldb/trunk/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=160071&r1=160070&r2=160071&view=diff
==============================================================================
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Wed Jul 11 15:33:48 2012
@@ -1321,16 +1321,12 @@
         strm.IndentMore();
         
         const bool show_frame_info = true;
-        const uint32_t source_lines_before = 3;
-        const uint32_t source_lines_after = 3;
         strm.IndentMore ();
         num_frames_shown = GetStackFrameList ()->GetStatus (strm,
                                                             start_frame, 
                                                             num_frames, 
                                                             show_frame_info, 
-                                                            num_frames_with_source,
-                                                            source_lines_before,
-                                                            source_lines_after);
+                                                            num_frames_with_source);
         strm.IndentLess();
         strm.IndentLess();
     }
@@ -1342,17 +1338,13 @@
                              uint32_t first_frame,
                              uint32_t num_frames,
                              bool show_frame_info,
-                             uint32_t num_frames_with_source,
-                             uint32_t source_lines_before,
-                             uint32_t source_lines_after)
+                             uint32_t num_frames_with_source)
 {
     return GetStackFrameList()->GetStatus (strm,
                                            first_frame,
                                            num_frames,
                                            show_frame_info,
-                                           num_frames_with_source,
-                                           source_lines_before,
-                                           source_lines_after);
+                                           num_frames_with_source);
 }
 
 bool





More information about the lldb-commits mailing list