[Lldb-commits] [lldb] 056f01f - [lldb/Reproducers] Assert when trying to get object for invalid index.

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Wed Jan 29 21:38:53 PST 2020


Author: Jonas Devlieghere
Date: 2020-01-29T21:34:54-08:00
New Revision: 056f01f895615686e63b9729096f7eb98b47223f

URL: https://github.com/llvm/llvm-project/commit/056f01f895615686e63b9729096f7eb98b47223f
DIFF: https://github.com/llvm/llvm-project/commit/056f01f895615686e63b9729096f7eb98b47223f.diff

LOG: [lldb/Reproducers] Assert when trying to get object for invalid index.

Assert when trying to get an object for an index we haven't seen before.
This will crash anyway, the assertion is just a bit more informative.

Added: 
    

Modified: 
    lldb/source/Utility/ReproducerInstrumentation.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Utility/ReproducerInstrumentation.cpp b/lldb/source/Utility/ReproducerInstrumentation.cpp
index 4109f73bfef3..f8a0d661c5a5 100644
--- a/lldb/source/Utility/ReproducerInstrumentation.cpp
+++ b/lldb/source/Utility/ReproducerInstrumentation.cpp
@@ -15,6 +15,7 @@ using namespace lldb_private;
 using namespace lldb_private::repro;
 
 void *IndexToObject::GetObjectForIndexImpl(unsigned idx) {
+  assert(m_mapping.count(idx) && "No object for index");
   return m_mapping.lookup(idx);
 }
 


        


More information about the lldb-commits mailing list