[lldb] Retrieve currently handled Obj-C exception via __cxa_current_exception_type...
authorKuba Mracek <mracek@apple.com>
Thu, 20 Dec 2018 02:01:59 +0000 (02:01 +0000)
committerKuba Mracek <mracek@apple.com>
Thu, 20 Dec 2018 02:01:59 +0000 (02:01 +0000)
commitc9e1190a27864868324c20aabd8fa648a8247c5a
tree9c4c52e8ff57572eb2db84a2ea0a2e6b2869b105
parent17e705129eeffdefe148ecafdd0268ba463ac876
[lldb] Retrieve currently handled Obj-C exception via __cxa_current_exception_type and add GetCurrentExceptionBacktrace SB ABI

This builds on https://reviews.llvm.org/D43884 and https://reviews.llvm.org/D43886 and extends LLDB support of Obj-C exceptions to also look for a "current exception" for a thread in the C++ exception handling runtime metadata (via call to __cxa_current_exception_type). We also construct an actual historical SBThread/ThreadSP that contains frames from the backtrace in the Obj-C exception object.

The high level goal this achieves is that when we're already crashed (because an unhandled exception occurred), we can still access the exception object and retrieve the backtrace from the throw point. In Obj-C, this is particularly useful because a catch+rethrow is very common and in those cases you currently don't have any access to the throw point backtrace.

Differential Revision: https://reviews.llvm.org/D44072

llvm-svn: 349718
14 files changed:
lldb/include/lldb/API/SBThread.h
lldb/include/lldb/Target/LanguageRuntime.h
lldb/include/lldb/Target/Thread.h
lldb/packages/Python/lldbsuite/test/lang/objc/exceptions/Makefile
lldb/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py
lldb/packages/Python/lldbsuite/test/lang/objc/exceptions/main.mm [moved from lldb/packages/Python/lldbsuite/test/lang/objc/exceptions/main.m with 57% similarity]
lldb/scripts/interface/SBThread.i
lldb/source/API/SBThread.cpp
lldb/source/Commands/CommandObjectThread.cpp
lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
lldb/source/Target/Thread.cpp