[Lldb-commits] [lldb] r298694 - The expression text in AppleObjCRuntimeV1::CreateObjectChecker

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 24 01:01:17 PDT 2017


Author: jmolenda
Date: Fri Mar 24 03:01:16 2017
New Revision: 298694

URL: http://llvm.org/viewvc/llvm-project?rev=298694&view=rev
Log:
The expression text in AppleObjCRuntimeV1::CreateObjectChecker
was formatted into a string inside an assert() expression.
Which is elided when lldb is built with asserts disabled;
the result is that all expressions will fail when debugging
programs using the objective-c v1 runtime.

<rdar://problem/30353271> 

Modified:
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp?rev=298694&r1=298693&r2=298694&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp Fri Mar 24 03:01:16 2017
@@ -127,7 +127,7 @@ struct BufStruct {
 UtilityFunction *AppleObjCRuntimeV1::CreateObjectChecker(const char *name) {
   std::unique_ptr<BufStruct> buf(new BufStruct);
 
-  assert(snprintf(&buf->contents[0], sizeof(buf->contents),
+  int strformatsize = snprintf(&buf->contents[0], sizeof(buf->contents),
                   "struct __objc_class                                         "
                   "           \n"
                   "{                                                           "
@@ -169,7 +169,8 @@ UtilityFunction *AppleObjCRuntimeV1::Cre
                   "           \n"
                   "}                                                           "
                   "           \n",
-                  name) < (int)sizeof(buf->contents));
+                  name);
+  assert(strformatsize < (int)sizeof(buf->contents));
 
   Error error;
   return GetTargetRef().GetUtilityFunctionForLanguage(




More information about the lldb-commits mailing list