[Lldb-commits] [lldb] r328088 - Fix crash exposed by r328025

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 21 04:10:58 PDT 2018

Author: labath
Date: Wed Mar 21 04:10:57 2018
New Revision: 328088

URL: http://llvm.org/viewvc/llvm-project?rev=328088&view=rev
Fix crash exposed by r328025

The issue was that the ASTDumper was being passed a null pointer
(because we did not create any declaration for the operator==).  The
crash was in logging code, so it only manifested it self if you ran the
tests with logging enabled (like our bots do).

Given that this is logging code and the rest of the debugger is fine
with the declaration being null, I just make sure the logging code can
handle it as well. Right now I just do the null check in
ClangExpressionDeclMap, but if the ASTDumper class is meant to be a
debugging/logging aid, then it might be a good idea move the check
inside the class itself.


Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp?rev=328088&r1=328087&r2=328088&view=diff
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp Wed Mar 21 04:10:57 2018
@@ -2116,7 +2116,8 @@ void ClangExpressionDeclMap::AddOneFunct
   parser_vars->m_llvm_value = NULL;
   if (log) {
-    ASTDumper ast_dumper(function_decl);
+    std::string function_str =
+        function_decl ? ASTDumper(function_decl).GetCString() : "nullptr";
     StreamString ss;
@@ -2127,7 +2128,7 @@ void ClangExpressionDeclMap::AddOneFunct
         "  CEDM::FEVD[%u] Found %s function %s (description %s), returned %s",
         current_id, (function ? "specific" : "generic"), decl_name.c_str(),
-        ss.GetData(), ast_dumper.GetCString());
+        ss.GetData(), function_str.c_str());

More information about the lldb-commits mailing list