Author: Jim Ingham
Date: 2019-11-01T17:20:31-07:00
New Revision: 81cc5d1c7d3f7292e82e8611fcd4a2889278a218

URL: 
https://github.com/llvm/llvm-project/commit/81cc5d1c7d3f7292e82e8611fcd4a2889278a218
DIFF: 
https://github.com/llvm/llvm-project/commit/81cc5d1c7d3f7292e82e8611fcd4a2889278a218.diff

LOG: Don't assume that __cxa_current_exception_type exists.

Normally you shouldn't be able to have a process with an ItaniumABI plugin
that doesn't have this symbol.  But if the loader crashes before loading
libc++abi.dylib (on MacOS), then the symbol might not be present.  So we
should check before accessing the pointer.

There isn't a good way to write a test for this, but the change is obvious.

Added: 
    

Modified: 
    
lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp

Removed: 
    


################################################################################
diff  --git 
a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
 
b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
index 02e62a263286..70b0b51f502c 100644
--- 
a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
+++ 
b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
@@ -559,6 +559,9 @@ ValueObjectSP 
ItaniumABILanguageRuntime::GetExceptionObjectForThread(
   modules.FindSymbolsWithNameAndType(
       ConstString("__cxa_current_exception_type"), eSymbolTypeCode, contexts);
   contexts.GetContextAtIndex(0, context);
+  if (!context.symbol) {
+    return {};
+  }
   Address addr = context.symbol->GetAddress();
 
   Status error;


        
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to