2004-04-17 Randolph Chung <tausq@debian.org>
[platform/upstream/binutils.git] / gdb / hppa-tdep.h
1 /* Common target dependent code for GDB on HPPA systems.
2    Copyright 2003 Free Software Foundation, Inc.
3
4    This file is part of GDB.
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 59 Temple Place - Suite 330,
19    Boston, MA 02111-1307, USA.  */
20
21 #ifndef HPPA_TDEP_H
22 #define HPPA_TDEP_H
23
24 enum { HPPA_INSTRUCTION_SIZE = 4 };
25
26 /* Target-dependent structure in gdbarch.  */
27 struct gdbarch_tdep
28 {
29   /* The number of bytes in an address.  For now, this field is designed
30      to allow us to differentiate hppa32 from hppa64 targets.  */
31   int bytes_per_address;
32 };
33
34 /*
35  * Unwind table and descriptor.
36  */
37
38 struct unwind_table_entry
39   {
40     CORE_ADDR region_start;
41     CORE_ADDR region_end;
42
43     unsigned int Cannot_unwind:1;       /* 0 */
44     unsigned int Millicode:1;   /* 1 */
45     unsigned int Millicode_save_sr0:1;  /* 2 */
46     unsigned int Region_description:2;  /* 3..4 */
47     unsigned int reserved1:1;   /* 5 */
48     unsigned int Entry_SR:1;    /* 6 */
49     unsigned int Entry_FR:4;    /* number saved *//* 7..10 */
50     unsigned int Entry_GR:5;    /* number saved *//* 11..15 */
51     unsigned int Args_stored:1; /* 16 */
52     unsigned int Variable_Frame:1;      /* 17 */
53     unsigned int Separate_Package_Body:1;       /* 18 */
54     unsigned int Frame_Extension_Millicode:1;   /* 19 */
55     unsigned int Stack_Overflow_Check:1;        /* 20 */
56     unsigned int Two_Instruction_SP_Increment:1;        /* 21 */
57     unsigned int Ada_Region:1;  /* 22 */
58     unsigned int cxx_info:1;    /* 23 */
59     unsigned int cxx_try_catch:1;       /* 24 */
60     unsigned int sched_entry_seq:1;     /* 25 */
61     unsigned int reserved2:1;   /* 26 */
62     unsigned int Save_SP:1;     /* 27 */
63     unsigned int Save_RP:1;     /* 28 */
64     unsigned int Save_MRP_in_frame:1;   /* 29 */
65     unsigned int extn_ptr_defined:1;    /* 30 */
66     unsigned int Cleanup_defined:1;     /* 31 */
67
68     unsigned int MPE_XL_interrupt_marker:1;     /* 0 */
69     unsigned int HP_UX_interrupt_marker:1;      /* 1 */
70     unsigned int Large_frame:1; /* 2 */
71     unsigned int Pseudo_SP_Set:1;       /* 3 */
72     unsigned int reserved4:1;   /* 4 */
73     unsigned int Total_frame_size:27;   /* 5..31 */
74
75     /* This is *NOT* part of an actual unwind_descriptor in an object
76        file.  It is *ONLY* part of the "internalized" descriptors that
77        we create from those in a file.
78      */
79     struct
80       {
81         unsigned int stub_type:4;       /* 0..3 */
82         unsigned int padding:28;        /* 4..31 */
83       }
84     stub_unwind;
85   };
86
87 /* HP linkers also generate unwinds for various linker-generated stubs.
88    GDB reads in the stubs from the $UNWIND_END$ subspace, then 
89    "converts" them into normal unwind entries using some of the reserved
90    fields to store the stub type.  */
91
92 /* The gaps represent linker stubs used in MPE and space for future
93    expansion.  */
94 enum unwind_stub_types
95   {
96     LONG_BRANCH = 1,
97     PARAMETER_RELOCATION = 2,
98     EXPORT = 10,
99     IMPORT = 11,
100     IMPORT_SHLIB = 12,
101   };
102
103 /* We use the objfile->obj_private pointer for two things:
104  * 1.  An unwind table;
105  *
106  * 2.  A pointer to any associated shared library object.
107  *
108  * #defines are used to help refer to these objects.
109  */
110
111 /* Info about the unwind table associated with an object file.
112  * This is hung off of the "objfile->obj_private" pointer, and
113  * is allocated in the objfile's psymbol obstack.  This allows
114  * us to have unique unwind info for each executable and shared
115  * library that we are debugging.
116  */
117 struct hppa_unwind_info
118   {
119     struct unwind_table_entry *table;   /* Pointer to unwind info */
120     struct unwind_table_entry *cache;   /* Pointer to last entry we found */
121     int last;                   /* Index of last entry */
122   };
123
124 struct hppa_objfile_private
125   {
126     struct hppa_unwind_info *unwind_info;       /* a pointer */
127     struct so_list *so_info;    /* a pointer  */
128     CORE_ADDR dp;
129   };
130
131 extern const struct objfile_data *hppa_objfile_priv_data;
132
133 #endif  /* HPPA_TDEP_H */