ExceptionAbi.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright 2012-present Facebook, Inc.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #pragma once
  17. // A clone of the relevant parts of unwind-cxx.h from libstdc++
  18. // The layout of these structures is defined by the ABI.
  19. #include <exception>
  20. #include <typeinfo>
  21. #include <unwind.h>
  22. namespace __cxxabiv1 {
  23. struct __cxa_exception {
  24. std::type_info* exceptionType;
  25. void (*exceptionDestructor)(void*);
  26. std::unexpected_handler unexpectedHandler;
  27. std::terminate_handler terminateHandler;
  28. __cxa_exception* nextException;
  29. int handlerCount;
  30. int handlerSwitchValue;
  31. const char* actionRecord;
  32. const char* languageSpecificData;
  33. void* catchTemp;
  34. void* adjustedPtr;
  35. _Unwind_Exception unwindHeader;
  36. };
  37. struct __cxa_eh_globals {
  38. __cxa_exception* caughtExceptions;
  39. unsigned int uncaughtExceptions;
  40. };
  41. extern "C" {
  42. __cxa_eh_globals* __cxa_get_globals(void) noexcept;
  43. __cxa_eh_globals* __cxa_get_globals_fast(void) noexcept;
  44. }
  45. } // namespace __cxxabiv1