[Lldb-commits] [PATCH] D43886: [lldb] Add GetCurrentException and GetCurrentExceptionBacktrace APIs to SBThread

Kuba (Brecka) Mracek via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 28 10:53:16 PST 2018


kubamracek created this revision.
kubamracek added reviewers: jasonmolenda, jingham.
Herald added a subscriber: mgorny.

This adds new APIs and commands to deal with exceptions (mostly Obj-C exceptions):

- SBThread and Thread get GetCurrentException API, which returns an SBValue/ValueObjectSP with the current exception for a thread. "Current" means an exception that is currently being thrown, caught or otherwise processed. In this patch, we only know about the exception when in objc_exception_throw, but subsequent patches will expand this.
- SBThread and Thread get GetCurrentExceptionBacktrace, which return an SBThread/ThreadSP containing a historical thread backtrace retrieved from the exception object. Currently unimplemented, subsequent patches will implement this.

To be able to extract the exception when inside objc_exception_throw, this patch introduces a concept of "frame recognizer" and "recognized frame". This should be an extensible mechanism that hardcodes knowledge about special frames (like objc_exception_throw) where we know the ABI, arguments or other special properties of that frame, even without source code. In this patch, we only handle objc_exception_throw frame.


https://reviews.llvm.org/D43886

Files:
  include/lldb/API/SBThread.h
  include/lldb/Target/FrameRecognizer.h
  include/lldb/Target/Platform.h
  include/lldb/Target/StackFrame.h
  include/lldb/Target/Thread.h
  lldb.xcodeproj/project.pbxproj
  packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py
  source/API/SBThread.cpp
  source/Commands/CommandObjectThread.cpp
  source/Plugins/Platform/MacOSX/CMakeLists.txt
  source/Plugins/Platform/MacOSX/DarwinFrameRecognizer.cpp
  source/Plugins/Platform/MacOSX/DarwinFrameRecognizer.h
  source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
  source/Plugins/Platform/MacOSX/PlatformDarwin.h
  source/Target/StackFrame.cpp
  source/Target/Thread.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43886.136338.patch
Type: text/x-patch
Size: 22772 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180228/a6c4fdd6/attachment-0001.bin>


More information about the lldb-commits mailing list