OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [unwind-dw2-fde.h] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
/* Subroutines needed for unwinding stack frames for exception handling.  */
2
/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004
3
   Free Software Foundation, Inc.
4
   Contributed by Jason Merrill <jason@cygnus.com>.
5
 
6
This file is part of GCC.
7
 
8
GCC is free software; you can redistribute it and/or modify it under
9
the terms of the GNU General Public License as published by the Free
10
Software Foundation; either version 2, or (at your option) any later
11
version.
12
 
13
In addition to the permissions in the GNU General Public License, the
14
Free Software Foundation gives you unlimited permission to link the
15
compiled version of this file into combinations with other programs,
16
and to distribute those combinations without any restriction coming
17
from the use of this file.  (The General Public License restrictions
18
do apply in other respects; for example, they cover modification of
19
the file, and distribution when not linked into a combine
20
executable.)
21
 
22
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
23
WARRANTY; without even the implied warranty of MERCHANTABILITY or
24
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
25
for more details.
26
 
27
You should have received a copy of the GNU General Public License
28
along with GCC; see the file COPYING.  If not, write to the Free
29
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
30
02110-1301, USA.  */
31
 
32
#ifndef GCC_UNWIND_DW2_FDE_H
33
#define GCC_UNWIND_DW2_FDE_H
34
 
35
#ifndef HIDE_EXPORTS
36
#pragma GCC visibility push(default)
37
#endif
38
 
39
struct fde_vector
40
{
41
  const void *orig_data;
42
  size_t count;
43
  const struct dwarf_fde *array[];
44
};
45
 
46
struct object
47
{
48
  void *pc_begin;
49
  void *tbase;
50
  void *dbase;
51
  union {
52
    const struct dwarf_fde *single;
53
    struct dwarf_fde **array;
54
    struct fde_vector *sort;
55
  } u;
56
 
57
  union {
58
    struct {
59
      unsigned long sorted : 1;
60
      unsigned long from_array : 1;
61
      unsigned long mixed_encoding : 1;
62
      unsigned long encoding : 8;
63
      /* ??? Wish there was an easy way to detect a 64-bit host here;
64
         we've got 32 bits left to play with...  */
65
      unsigned long count : 21;
66
    } b;
67
    size_t i;
68
  } s;
69
 
70
#ifdef DWARF2_OBJECT_END_PTR_EXTENSION
71
  char *fde_end;
72
#endif
73
 
74
  struct object *next;
75
};
76
 
77
/* This is the original definition of struct object.  While the struct
78
   itself was opaque to users, they did know how large it was, and
79
   allocate one statically in crtbegin for each DSO.  Keep this around
80
   so that we're aware of the static size limitations for the new struct.  */
81
struct old_object
82
{
83
  void *pc_begin;
84
  void *pc_end;
85
  struct dwarf_fde *fde_begin;
86
  struct dwarf_fde **fde_array;
87
  size_t count;
88
  struct old_object *next;
89
};
90
 
91
struct dwarf_eh_bases
92
{
93
  void *tbase;
94
  void *dbase;
95
  void *func;
96
};
97
 
98
 
99
extern void __register_frame_info_bases (const void *, struct object *,
100
                                         void *, void *);
101
extern void __register_frame_info (const void *, struct object *);
102
extern void __register_frame (void *);
103
extern void __register_frame_info_table_bases (void *, struct object *,
104
                                               void *, void *);
105
extern void __register_frame_info_table (void *, struct object *);
106
extern void __register_frame_table (void *);
107
extern void *__deregister_frame_info (const void *);
108
extern void *__deregister_frame_info_bases (const void *);
109
extern void __deregister_frame (void *);
110
 
111
 
112
typedef          int  sword __attribute__ ((mode (SI)));
113
typedef unsigned int  uword __attribute__ ((mode (SI)));
114
typedef unsigned int  uaddr __attribute__ ((mode (pointer)));
115
typedef          int  saddr __attribute__ ((mode (pointer)));
116
typedef unsigned char ubyte;
117
 
118
/* Terminology:
119
   CIE - Common Information Element
120
   FDE - Frame Descriptor Element
121
 
122
   There is one per function, and it describes where the function code
123
   is located, and what the register lifetimes and stack layout are
124
   within the function.
125
 
126
   The data structures are defined in the DWARF specification, although
127
   not in a very readable way (see LITERATURE).
128
 
129
   Every time an exception is thrown, the code needs to locate the FDE
130
   for the current function, and starts to look for exception regions
131
   from that FDE. This works in a two-level search:
132
   a) in a linear search, find the shared image (i.e. DLL) containing
133
      the PC
134
   b) using the FDE table for that shared object, locate the FDE using
135
      binary search (which requires the sorting).  */
136
 
137
/* The first few fields of a CIE.  The CIE_id field is 0 for a CIE,
138
   to distinguish it from a valid FDE.  FDEs are aligned to an addressing
139
   unit boundary, but the fields within are unaligned.  */
140
struct dwarf_cie
141
{
142
  uword length;
143
  sword CIE_id;
144
  ubyte version;
145
  unsigned char augmentation[];
146
} __attribute__ ((packed, aligned (__alignof__ (void *))));
147
 
148
/* The first few fields of an FDE.  */
149
struct dwarf_fde
150
{
151
  uword length;
152
  sword CIE_delta;
153
  unsigned char pc_begin[];
154
} __attribute__ ((packed, aligned (__alignof__ (void *))));
155
 
156
typedef struct dwarf_fde fde;
157
 
158
/* Locate the CIE for a given FDE.  */
159
 
160
static inline const struct dwarf_cie *
161
get_cie (const struct dwarf_fde *f)
162
{
163
  return (void *)&f->CIE_delta - f->CIE_delta;
164
}
165
 
166
static inline const fde *
167
next_fde (const fde *f)
168
{
169
  return (const fde *) ((char *) f + f->length + sizeof (f->length));
170
}
171
 
172
extern const fde * _Unwind_Find_FDE (void *, struct dwarf_eh_bases *);
173
 
174
static inline int
175
last_fde (struct object *obj __attribute__ ((__unused__)), const fde *f)
176
{
177
#ifdef DWARF2_OBJECT_END_PTR_EXTENSION
178
  return (char *)f == obj->fde_end || f->length == 0;
179
#else
180
  return f->length == 0;
181
#endif
182
}
183
 
184
#ifndef HIDE_EXPORTS
185
#pragma GCC visibility pop
186
#endif
187
 
188
#endif /* unwind-dw2-fde.h */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.