configure.in: Remove ENABLE_STD_NAMESPACE.
[official-gcc.git] / gcc / unwind-dw2-fde.h
blob83b519a48b92587b85e78be324ee52a67311faf0
1 /* Subroutines needed for unwinding stack frames for exception handling. */
2 /* Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
3 Contributed by Jason Merrill <jason@cygnus.com>.
5 This file is part of GNU CC.
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
12 In addition to the permissions in the GNU General Public License, the
13 Free Software Foundation gives you unlimited permission to link the
14 compiled version of this file into combinations with other programs,
15 and to distribute those combinations without any restriction coming
16 from the use of this file. (The General Public License restrictions
17 do apply in other respects; for example, they cover modification of
18 the file, and distribution when not linked into a combine
19 executable.)
21 GNU CC is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 GNU General Public License for more details.
26 You should have received a copy of the GNU General Public License
27 along with GNU CC; see the file COPYING. If not, write to
28 the Free Software Foundation, 59 Temple Place - Suite 330,
29 Boston, MA 02111-1307, USA. */
32 /* Describes data used to hold onto one shared object or object file. */
33 struct object
35 void *pc_begin;
36 void *pc_end;
37 struct dwarf_fde *fde_begin;
38 struct dwarf_fde **fde_array;
39 size_t count;
40 struct object *next;
43 struct dwarf_eh_bases
45 void *tbase;
46 void *dbase;
47 void *func;
51 extern void __register_frame_info (void *, struct object *);
52 extern void __register_frame (void *);
53 extern void __register_frame_info_table (void *, struct object *);
54 extern void __register_frame_table (void *);
55 extern void *__deregister_frame_info (void *);
56 extern void __deregister_frame (void *);
59 typedef int sword __attribute__ ((mode (SI)));
60 typedef unsigned int uword __attribute__ ((mode (SI)));
61 typedef unsigned int uaddr __attribute__ ((mode (pointer)));
62 typedef int saddr __attribute__ ((mode (pointer)));
63 typedef unsigned char ubyte;
65 /* Terminology:
66 CIE - Common Information Element
67 FDE - Frame Descriptor Element
69 There is one per function, and it describes where the function code
70 is located, and what the register lifetimes and stack layout are
71 within the function.
73 The data structures are defined in the DWARF specfication, although
74 not in a very readable way (see LITERATURE).
76 Every time an exception is thrown, the code needs to locate the FDE
77 for the current function, and starts to look for exception regions
78 from that FDE. This works in a two-level search:
79 a) in a linear search, find the shared image (i.e. DLL) containing
80 the PC
81 b) using the FDE table for that shared object, locate the FDE using
82 binary search (which requires the sorting). */
84 /* The first few fields of a CIE. The CIE_id field is 0 for a CIE,
85 to distinguish it from a valid FDE. FDEs are aligned to an addressing
86 unit boundary, but the fields within are unaligned. */
87 struct dwarf_cie
89 uword length;
90 sword CIE_id;
91 ubyte version;
92 unsigned char augmentation[];
93 } __attribute__ ((packed, aligned (__alignof__ (void *))));
95 /* The first few fields of an FDE. */
96 struct dwarf_fde
98 uword length;
99 sword CIE_delta;
100 void * pc_begin;
101 uaddr pc_range;
102 } __attribute__ ((packed, aligned (__alignof__ (void *))));
104 typedef struct dwarf_fde fde;
106 /* Locate the CIE for a given FDE. */
108 static inline struct dwarf_cie *
109 get_cie (struct dwarf_fde *f)
111 return (void *)&f->CIE_delta - f->CIE_delta;
114 static inline fde *
115 next_fde (fde *f)
117 return (fde *)((char *)f + f->length + sizeof (f->length));
120 extern fde * _Unwind_Find_FDE (void *, struct dwarf_eh_bases *);