[Lldb-commits] [lldb] r256888 - Addresses an unsigned underflow situation that can occur when dumping an empty command history.

Kate Stone via lldb-commits lldb-commits at lists.llvm.org
Tue Jan 5 16:33:07 PST 2016


Author: kate
Date: Tue Jan  5 18:33:07 2016
New Revision: 256888

URL: http://llvm.org/viewvc/llvm-project?rev=256888&view=rev
Log:
Addresses an unsigned underflow situation that can occur when dumping an empty command history.

One example where this occurs in practice is starting the Swift REPL and typing ":command history" since REPL commands aren't stored in the LLDB command prompt history.


Modified:
    lldb/trunk/source/Interpreter/CommandHistory.cpp

Modified: lldb/trunk/source/Interpreter/CommandHistory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandHistory.cpp?rev=256888&r1=256887&r2=256888&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandHistory.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandHistory.cpp Tue Jan  5 18:33:07 2016
@@ -130,9 +130,9 @@ CommandHistory::Dump (Stream& stream,
                       size_t stop_idx) const
 {
     Mutex::Locker locker(m_mutex);
-    stop_idx = std::min(stop_idx, m_history.size() - 1);
+    stop_idx = std::min(stop_idx + 1, m_history.size());
     for (size_t counter = start_idx;
-         counter <= stop_idx;
+         counter < stop_idx;
          counter++)
     {
         const std::string hist_item = m_history[counter];




More information about the lldb-commits mailing list