Merge from vendor branch NTPD:
[dragonfly.git] / contrib / gcc / frame.h
1 /* Header file for unwinding stack frames for exception handling.  */
2 /* Compile this one with gcc.  */
3 /* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
4    Contributed by Jason Merrill <jason@cygnus.com>.
5
6 This file is part of GNU CC.
7
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING.  If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA.  */
22
23
24 typedef struct frame_state
25 {
26   void *cfa;
27   void *eh_ptr;
28   long cfa_offset;
29   long args_size;
30   long reg_or_offset[FIRST_PSEUDO_REGISTER+1];
31   unsigned short cfa_reg;
32   unsigned short retaddr_column;
33   char saved[FIRST_PSEUDO_REGISTER+1];
34 } frame_state;
35
36 /* Values for 'saved' above.  */
37 #define REG_UNSAVED 0
38 #define REG_SAVED_OFFSET 1
39 #define REG_SAVED_REG 2
40
41 /* The representation for an "object" to be searched for frame unwind info.
42    For targets with named sections, one object is an executable or shared
43    library; for other targets, one object is one translation unit.
44
45    A copy of this structure declaration is printed by collect2.c;
46    keep the copies synchronized!  */
47
48 struct object {
49   void *pc_begin;
50   void *pc_end;
51   struct dwarf_fde *fde_begin;
52   struct dwarf_fde **fde_array;
53   size_t count;
54   struct object *next;
55 };
56
57 /* Note the following routines are exported interfaces from libgcc; do not
58    change these interfaces.  Instead create new interfaces.  Also note
59    references to these functions may be made weak in files where they
60    are referenced.  */
61
62 extern void __register_frame (void * );
63 extern void __register_frame_table (void *);
64 extern void __deregister_frame (void *);
65
66 /* Called either from crtbegin.o or a static constructor to register the
67    unwind info for an object or translation unit, respectively.  */
68
69 extern void __register_frame_info (void *, struct object *);
70
71 /* Similar, but BEGIN is actually a pointer to a table of unwind entries
72    for different translation units.  Called from the file generated by
73    collect2.  */
74 extern void __register_frame_info_table (void *, struct object *);
75
76 /* Called from crtend.o to deregister the unwind info for an object.  */
77
78 extern void *__deregister_frame_info (void *);
79
80 /* Called from __throw to find the registers to restore for a given
81    PC_TARGET.  The caller should allocate a local variable of `struct
82    frame_state' (declared in frame.h) and pass its address to STATE_IN.
83    Returns NULL on failure, otherwise returns STATE_IN.  */
84
85 extern struct frame_state *__frame_state_for (void *, struct frame_state *);