1 // Copyright (C) 2012 The Android Open Source Project 2 // All rights reserved. 3 // 4 // Redistribution and use in source and binary forms, with or without 5 // modification, are permitted provided that the following conditions 6 // are met: 7 // 1. Redistributions of source code must retain the above copyright 8 // notice, this list of conditions and the following disclaimer. 9 // 2. Redistributions in binary form must reproduce the above copyright 10 // notice, this list of conditions and the following disclaimer in the 11 // documentation and/or other materials provided with the distribution. 12 // 3. Neither the name of the project nor the names of its contributors 13 // may be used to endorse or promote products derived from this software 14 // without specific prior written permission. 15 // 16 // THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 17 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 // ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 20 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 // SUCH DAMAGE. 27 //===----------------------------------------------------------------------===// 28 // 29 // The LLVM Compiler Infrastructure 30 // 31 // This file is dual licensed under the MIT and the University of Illinois Open 32 // Source Licenses. See LICENSE.TXT for details. 33 // 34 // 35 // This file implements the "Exception Handling APIs" 36 // http://www.codesourcery.com/public/cxx-abi/abi-eh.html 37 // http://www.intel.com/design/itanium/downloads/245358.htm 38 // 39 //===----------------------------------------------------------------------===// 40 41 #ifndef __GXXABI_DWARF_HELPER_H 42 #define __GXXABI_DWARF_HELPER_H 43 44 #include <cstdint> 45 #include <unwind.h> 46 47 namespace __cxxabiv1 { 48 49 enum { 50 DW_EH_PE_absptr = 0x00, 51 DW_EH_PE_uleb128 = 0x01, 52 DW_EH_PE_udata2 = 0x02, 53 DW_EH_PE_udata4 = 0x03, 54 DW_EH_PE_udata8 = 0x04, 55 DW_EH_PE_sleb128 = 0x09, 56 DW_EH_PE_sdata2 = 0x0A, 57 DW_EH_PE_sdata4 = 0x0B, 58 DW_EH_PE_sdata8 = 0x0C, 59 DW_EH_PE_pcrel = 0x10, 60 DW_EH_PE_textrel = 0x20, 61 DW_EH_PE_datarel = 0x30, 62 DW_EH_PE_funcrel = 0x40, 63 DW_EH_PE_aligned = 0x50, 64 DW_EH_PE_indirect = 0x80, 65 DW_EH_PE_omit = 0xFF 66 }; 67 68 // Buffer to cache some information during PR 69 struct ScanResultInternal { 70 int64_t ttypeIndex; // > 0 catch handler, < 0 exception spec handler, == 0 a cleanup 71 const uint8_t* actionRecord; // Currently unused. Retained to ease future maintenance. 72 const uint8_t* languageSpecificData; // Needed only for __cxa_call_unexpected 73 uintptr_t landingPad; // null -> nothing found, else something found 74 void* adjustedPtr; // Used in cxa_exception.cpp 75 _Unwind_Reason_Code reason; // One of _URC_FATAL_PHASE1_ERROR, 76 // _URC_FATAL_PHASE2_ERROR, 77 // _URC_CONTINUE_UNWIND, 78 // _URC_HANDLER_FOUND 79 }; 80 81 uintptr_t readULEB128(const uint8_t** data); 82 intptr_t readSLEB128(const uint8_t** data); 83 uintptr_t readEncodedPointer(const uint8_t** data, 84 uint8_t encoding); 85 86 } // namespace __cxxabiv1 87 88 #endif // __GXXABI_DWARF_HELPER_H 89