[Lldb-commits] [PATCH] D73225: Handle the new objc direct dispatch accelerator functions for uncommonly overridden methods

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jan 22 13:37:14 PST 2020


jingham created this revision.
jingham added reviewers: friss, JDevlieghere.
Herald added subscribers: lldb-commits, aprantl.
Herald added a project: LLDB.

Clang added a new feature to the ObjC compiler that will translate method
calls to commonly un-overridden methods into a function that checks whether
the method is overridden anywhere and if not directly dispatches to the
NSObject implementation.

      

That means if you do override any of these methods, "step-in" will not step
into your code, since we hit the wrapper function, which has no debug info,
and immediately step out again.

      

Add code to recognize these functions as "trampolines" and a thread plan that
will get us from the function to the user code, if overridden.

Note, this is not the same feature as the objc_direct attribute, whereby an ObjC developer can state that a certain method will not be overridden so that the compiler will issue a direct call to the implementation function.  That actually shouldn't need debugger support for stepping, since we will step directly into the implementation function, not into some ObjC runtime shim.  So we'll either stop or not correctly based on whether the implementation function has debug info or not.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73225

Files:
  lldb/include/lldb/Target/ThreadPlan.h
  lldb/include/lldb/Target/ThreadPlanStepInRange.h
  lldb/packages/Python/lldbsuite/test/lang/objc/direct-dispatch-step/Makefile
  lldb/packages/Python/lldbsuite/test/lang/objc/direct-dispatch-step/TestObjCDirectDispatchStepping.py
  lldb/packages/Python/lldbsuite/test/lang/objc/direct-dispatch-step/stepping-tests.m
  lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
  lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h
  lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
  lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73225.239684.patch
Type: text/x-patch
Size: 31882 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200122/a1d8a4a1/attachment-0001.bin>


More information about the lldb-commits mailing list