• rsesek's avatar
    [Mac] Modify the ObjC exception preprocessor to make some exceptions fatal. · 1e145dcb
    rsesek authored
    Various Cocoa routines in the event loop obscure exception stack traces
    by catching-and-rethrowing exceptions, so that the original trace from
    throwing the exception is lost.
    
    To combat this, the ObjC exception preprocessor will now unwind the stack to
    search for an exception handler. If it finds a stack frame with a handler, it
    will check that the function's name is not on the sinkhole list. If it is on the
    list, the preprocessor will make the exception fatal to produce a stack trace
    from the point of throw. If it is not on the list, then the preprocessor will
    not take action and will let the normal exception handling mechanism run.
    
    The preprocessor works in conjunction with the base::mac::CallWithEHFrame
    system. The preprocessor is only called for exceptions raised with objc_throw,
    which C++ exceptions are not. Furthermore, some of the system routines that do
    the catch-and-rethrow are higher on the stack than CallWithEHFrame, so it
    cannot force those exceptions to be fatal at the point of throw.
    
    This change also wraps -[BrowserCrApplication sendAction:to:from:] in
    CallWithEHFrame().
    
    BUG=637270
    R=mark@chromium.org
    
    Review-Url: https://codereview.chromium.org/2543813003
    Cr-Commit-Position: refs/heads/master@{#437033}
    1e145dcb
chrome_browser_application_mac.h 1.37 KB