[Lldb-commits] [lldb] r139273 - /lldb/trunk/source/Commands/CommandObjectFrame.cpp

Jim Ingham jingham at apple.com
Wed Sep 7 18:15:10 PDT 2011


Author: jingham
Date: Wed Sep  7 20:15:09 2011
New Revision: 139273

URL: http://llvm.org/viewvc/llvm-project?rev=139273&view=rev
Log:
"frame select -r" should return an error if you are already at the top of the stack & try to go up or at the bottom and try to go down.

Modified:
    lldb/trunk/source/Commands/CommandObjectFrame.cpp

Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=139273&r1=139272&r2=139273&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Wed Sep  7 20:15:09 2011
@@ -205,14 +205,34 @@
                     if (frame_idx >= -m_options.relative_frame_offset)
                         frame_idx += m_options.relative_frame_offset;
                     else
-                        frame_idx = 0;
+                    {
+                        if (frame_idx == 0)
+                        {
+                            //If you are already at the bottom of the stack, then just warn and don't reset the frame.
+                            result.AppendError("Already at the bottom of the stack");
+                            result.SetStatus(eReturnStatusFailed);
+                            return false;
+                        }
+                        else
+                            frame_idx = 0;
+                    }
                 }
                 else if (m_options.relative_frame_offset > 0)
                 {
                     if (num_frames - frame_idx > m_options.relative_frame_offset)
                         frame_idx += m_options.relative_frame_offset;
                     else
-                        frame_idx = num_frames - 1;
+                    {
+                        if (frame_idx == num_frames - 1)
+                        {
+                            //If we are already at the top of the stack, just warn and don't reset the frame.
+                            result.AppendError("Already at the top of the stack");
+                            result.SetStatus(eReturnStatusFailed);
+                            return false;
+                        }
+                        else
+                            frame_idx = num_frames - 1;
+                    }
                 }
             }
             else 





More information about the lldb-commits mailing list