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   /* Is this an ELF target? This can be 64-bit HP-UX, or a 32/64-bit GNU/Linux
34      system.  */
35   int is_elf;
36 };
37
38 /*
39  * Unwind table and descriptor.
40  */
41
42 struct unwind_table_entry
43   {
44     CORE_ADDR region_start;
45     CORE_ADDR region_end;
46
47     unsigned int Cannot_unwind:1;       /* 0 */
48     unsigned int Millicode:1;   /* 1 */
49     unsigned int Millicode_save_sr0:1;  /* 2 */
50     unsigned int Region_description:2;  /* 3..4 */
51     unsigned int reserved1:1;   /* 5 */
52     unsigned int Entry_SR:1;    /* 6 */
53     unsigned int Entry_FR:4;    /* number saved *//* 7..10 */
54     unsigned int Entry_GR:5;    /* number saved *//* 11..15 */
55     unsigned int Args_stored:1; /* 16 */
56     unsigned int Variable_Frame:1;      /* 17 */
57     unsigned int Separate_Package_Body:1;       /* 18 */
58     unsigned int Frame_Extension_Millicode:1;   /* 19 */
59     unsigned int Stack_Overflow_Check:1;        /* 20 */
60     unsigned int Two_Instruction_SP_Increment:1;        /* 21 */
61     unsigned int Ada_Region:1;  /* 22 */
62     unsigned int cxx_info:1;    /* 23 */
63     unsigned int cxx_try_catch:1;       /* 24 */
64     unsigned int sched_entry_seq:1;     /* 25 */
65     unsigned int reserved2:1;   /* 26 */
66     unsigned int Save_SP:1;     /* 27 */
67     unsigned int Save_RP:1;     /* 28 */
68     unsigned int Save_MRP_in_frame:1;   /* 29 */
69     unsigned int extn_ptr_defined:1;    /* 30 */
70     unsigned int Cleanup_defined:1;     /* 31 */
71
72     unsigned int MPE_XL_interrupt_marker:1;     /* 0 */
73     unsigned int HP_UX_interrupt_marker:1;      /* 1 */
74     unsigned int Large_frame:1; /* 2 */
75     unsigned int Pseudo_SP_Set:1;       /* 3 */
76     unsigned int reserved4:1;   /* 4 */
77     unsigned int Total_frame_size:27;   /* 5..31 */
78
79     /* This is *NOT* part of an actual unwind_descriptor in an object
80        file.  It is *ONLY* part of the "internalized" descriptors that
81        we create from those in a file.
82      */
83     struct
84       {
85         unsigned int stub_type:4;       /* 0..3 */
86         unsigned int padding:28;        /* 4..31 */
87       }
88     stub_unwind;
89   };
90
91 /* HP linkers also generate unwinds for various linker-generated stubs.
92    GDB reads in the stubs from the $UNWIND_END$ subspace, then 
93    "converts" them into normal unwind entries using some of the reserved
94    fields to store the stub type.  */
95
96 /* The gaps represent linker stubs used in MPE and space for future
97    expansion.  */
98 enum unwind_stub_types
99   {
100     LONG_BRANCH = 1,
101     PARAMETER_RELOCATION = 2,
102     EXPORT = 10,
103     IMPORT = 11,
104     IMPORT_SHLIB = 12,
105   };
106
107 /* We use the objfile->obj_private pointer for two things:
108  * 1.  An unwind table;
109  *
110  * 2.  A pointer to any associated shared library object.
111  *
112  * #defines are used to help refer to these objects.
113  */
114
115 /* Info about the unwind table associated with an object file.
116  * This is hung off of the "objfile->obj_private" pointer, and
117  * is allocated in the objfile's psymbol obstack.  This allows
118  * us to have unique unwind info for each executable and shared
119  * library that we are debugging.
120  */
121 struct hppa_unwind_info
122   {
123     struct unwind_table_entry *table;   /* Pointer to unwind info */
124     struct unwind_table_entry *cache;   /* Pointer to last entry we found */
125     int last;                   /* Index of last entry */
126   };
127
128 struct hppa_objfile_private
129   {
130     struct hppa_unwind_info *unwind_info;       /* a pointer */
131     struct so_list *so_info;    /* a pointer  */
132     CORE_ADDR dp;
133   };
134
135 extern const struct objfile_data *hppa_objfile_priv_data;
136
137 #endif  /* HPPA_TDEP_H */