• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include <gabixx_config.h>
47 
48 namespace __cxxabiv1 {
49 
50   enum {
51     DW_EH_PE_absptr   = 0x00,
52     DW_EH_PE_uleb128  = 0x01,
53     DW_EH_PE_udata2   = 0x02,
54     DW_EH_PE_udata4   = 0x03,
55     DW_EH_PE_udata8   = 0x04,
56     DW_EH_PE_sleb128  = 0x09,
57     DW_EH_PE_sdata2   = 0x0A,
58     DW_EH_PE_sdata4   = 0x0B,
59     DW_EH_PE_sdata8   = 0x0C,
60     DW_EH_PE_pcrel    = 0x10,
61     DW_EH_PE_textrel  = 0x20,
62     DW_EH_PE_datarel  = 0x30,
63     DW_EH_PE_funcrel  = 0x40,
64     DW_EH_PE_aligned  = 0x50,
65     DW_EH_PE_indirect = 0x80,
66     DW_EH_PE_omit     = 0xFF
67   };
68 
69   // Buffer to cache some information during PR
70   struct ScanResultInternal {
71     int64_t        ttypeIndex;   // > 0 catch handler, < 0 exception spec handler, == 0 a cleanup
72     const uint8_t* actionRecord;         // Currently unused.  Retained to ease future maintenance.
73     const uint8_t* languageSpecificData;  // Needed only for __cxa_call_unexpected
74     uintptr_t      landingPad;   // null -> nothing found, else something found
75     void*          adjustedPtr;  // Used in cxa_exception.cpp
76     _Unwind_Reason_Code reason;  // One of _URC_FATAL_PHASE1_ERROR,
77                                  //        _URC_FATAL_PHASE2_ERROR,
78                                  //        _URC_CONTINUE_UNWIND,
79                                  //        _URC_HANDLER_FOUND
80   };
81 
82   uintptr_t readULEB128(const uint8_t** data) _GABIXX_HIDDEN;
83   intptr_t readSLEB128(const uint8_t** data) _GABIXX_HIDDEN;
84   uintptr_t readEncodedPointer(const uint8_t** data,
85                                uint8_t encoding) _GABIXX_HIDDEN;
86 
87 } // namespace __cxxabiv1
88 
89 #endif // __GXXABI_DWARF_HELPER_H
90