Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / base / mac / call_with_eh_frame.cc
blob8ea6f75b4bfd896d026cca477ceb2eb0013aa391
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/mac/call_with_eh_frame.h"
7 #include <unwind.h>
9 #include "build/build_config.h"
11 namespace base {
12 namespace mac {
14 _Unwind_Reason_Code CxxPersonalityRoutine(
15 int version,
16 _Unwind_Action actions,
17 uint64_t exceptionClass,
18 struct _Unwind_Exception* exceptionObject,
19 struct _Unwind_Context* context) {
20 // Tell libunwind that this is the end of the stack. When it encounters the
21 // CallWithEHFrame, it will stop searching for an exception handler. The
22 // result is that no exception handler has been found higher on the stack,
23 // and any that are lower on the stack (e.g. in CFRunLoopRunSpecific), will
24 // now be skipped. Since this is reporting the end of the stack, and no
25 // exception handler will have been found, std::terminate() will be called.
26 return _URC_END_OF_STACK;
29 #if defined(OS_IOS)
30 // No iOS assembly implementation exists, so just call the block directly.
31 void CallWithEHFrame(void (^block)(void)) {
32 block();
34 #endif
36 } // namespace mac
37 } // namespace base