"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.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@139273 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandObjectFrame.cpp b/source/Commands/CommandObjectFrame.cpp
index 5b5d6c3..3852245 100644
--- a/source/Commands/CommandObjectFrame.cpp
+++ b/source/Commands/CommandObjectFrame.cpp
@@ -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