[Lldb-commits] [lldb] r146954 - in /lldb/trunk: source/API/SBValue.cpp test/python_api/value/change_values/TestChangeValueAPI.py
Johnny Chen
johnny.chen at apple.com
Mon Dec 19 17:52:44 PST 2011
Author: johnny
Date: Mon Dec 19 19:52:44 2011
New Revision: 146954
URL: http://llvm.org/viewvc/llvm-project?rev=146954&view=rev
Log:
Work in progress for:
rdar://problem/10577182
Audit lldb API impl for places where we need to perform a NULL check
Add a NULL check for SBValue.CreateValueFromExpression().
Modified:
lldb/trunk/source/API/SBValue.cpp
lldb/trunk/test/python_api/value/change_values/TestChangeValueAPI.py
Modified: lldb/trunk/source/API/SBValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=146954&r1=146953&r2=146954&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValue.cpp (original)
+++ lldb/trunk/source/API/SBValue.cpp Mon Dec 19 19:52:44 2011
@@ -392,8 +392,11 @@
true, // keep in memory
eNoDynamicValues,
result_valobj_sp);
- result_valobj_sp->SetName(ConstString(name));
- result = SBValue(result_valobj_sp);
+ if (result_valobj_sp)
+ {
+ result_valobj_sp->SetName(ConstString(name));
+ result = SBValue(result_valobj_sp);
+ }
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
Modified: lldb/trunk/test/python_api/value/change_values/TestChangeValueAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/value/change_values/TestChangeValueAPI.py?rev=146954&r1=146953&r2=146954&view=diff
==============================================================================
--- lldb/trunk/test/python_api/value/change_values/TestChangeValueAPI.py (original)
+++ lldb/trunk/test/python_api/value/change_values/TestChangeValueAPI.py Mon Dec 19 19:52:44 2011
@@ -130,6 +130,10 @@
self.assertTrue (error.Success(), "Got a changed value for sp")
self.assertTrue (actual_value == 1, "Got the right changed value for sp.")
+ # Boundary condition test the SBValue.CreateValueFromExpression() API.
+ # LLDB should not crash!
+ nosuchval = mine_value.CreateValueFromExpression(None, None)
+
process.Continue()
self.assertTrue(process.GetState() == lldb.eStateStopped)
More information about the lldb-commits
mailing list