Add regression test infrastructure.
[dragonfly.git] / contrib / gdb / gdb / hpread.h
1 /* hpread.h
2  * Common include file for:
3  *   hp_symtab_read.c
4  *   hp_psymtab_read.c
5  */
6
7 /* Copyright 1993, 1996 Free Software Foundation, Inc.
8
9    This file is part of GDB.
10
11    This program is free software; you can redistribute it and/or modify
12    it under the terms of the GNU General Public License as published by
13    the Free Software Foundation; either version 2 of the License, or
14    (at your option) any later version.
15
16    This program is distributed in the hope that it will be useful,
17    but WITHOUT ANY WARRANTY; without even the implied warranty of
18    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19    GNU General Public License for more details.
20
21    You should have received a copy of the GNU General Public License
22    along with this program; if not, write to the Free Software
23    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24
25    Written by the Center for Software Science at the University of Utah
26    and by Cygnus Support.  */
27
28 #include "defs.h"
29 #include "bfd.h"
30 #include "gdb_string.h"
31 #include "hp-symtab.h"
32 #include "syms.h"
33 #include "symtab.h"
34 #include "symfile.h"
35 #include "objfiles.h"
36 #include "buildsym.h"
37 #include "complaints.h"
38 #include "gdb-stabs.h"
39 #include "gdbtypes.h"
40 #include "demangle.h"
41
42 /* Private information attached to an objfile which we use to find
43    and internalize the HP C debug symbols within that objfile.  */
44
45 struct hpread_symfile_info
46 {
47   /* The contents of each of the debug sections (there are 4 of them).  */
48   char *gntt;
49   char *lntt;
50   char *slt;
51   char *vt;
52
53   /* We keep the size of the $VT$ section for range checking.  */
54   unsigned int vt_size;
55
56   /* Some routines still need to know the number of symbols in the
57      main debug sections ($LNTT$ and $GNTT$). */
58   unsigned int lntt_symcount;
59   unsigned int gntt_symcount;
60
61   /* To keep track of all the types we've processed.  */
62   struct type **type_vector;
63   int type_vector_length;
64
65   /* Keeps track of the beginning of a range of source lines.  */
66   sltpointer sl_index;
67
68   /* Some state variables we'll need.  */
69   int within_function;
70
71   /* Keep track of the current function's address.  We may need to look
72      up something based on this address.  */
73   unsigned int current_function_value;
74 };
75
76 /* Accessor macros to get at the fields.  */
77 #define HPUX_SYMFILE_INFO(o) \
78   ((struct hpread_symfile_info *)((o)->sym_private))
79 #define GNTT(o)                 (HPUX_SYMFILE_INFO(o)->gntt)
80 #define LNTT(o)                 (HPUX_SYMFILE_INFO(o)->lntt)
81 #define SLT(o)                  (HPUX_SYMFILE_INFO(o)->slt)
82 #define VT(o)                   (HPUX_SYMFILE_INFO(o)->vt)
83 #define VT_SIZE(o)              (HPUX_SYMFILE_INFO(o)->vt_size)
84 #define LNTT_SYMCOUNT(o)        (HPUX_SYMFILE_INFO(o)->lntt_symcount)
85 #define GNTT_SYMCOUNT(o)        (HPUX_SYMFILE_INFO(o)->gntt_symcount)
86 #define TYPE_VECTOR(o)          (HPUX_SYMFILE_INFO(o)->type_vector)
87 #define TYPE_VECTOR_LENGTH(o)   (HPUX_SYMFILE_INFO(o)->type_vector_length)
88 #define SL_INDEX(o)             (HPUX_SYMFILE_INFO(o)->sl_index)
89 #define WITHIN_FUNCTION(o)      (HPUX_SYMFILE_INFO(o)->within_function)
90 #define CURRENT_FUNCTION_VALUE(o) (HPUX_SYMFILE_INFO(o)->current_function_value)
91
92 /* Given the native debug symbol SYM, set NAMEP to the name associated
93    with the debug symbol.  Note we may be called with a debug symbol which
94    has no associated name, in that case we return an empty string.
95
96    Also note we "know" that the name for any symbol is always in the
97    same place.  Hence we don't have to conditionalize on the symbol type.  */
98 #define SET_NAMESTRING(SYM, NAMEP, OBJFILE) \
99   if (! hpread_has_name ((SYM)->dblock.kind)) \
100     *NAMEP = ""; \
101   else if (((unsigned)(SYM)->dsfile.name) >= VT_SIZE (OBJFILE)) \
102     { \
103       complain (&string_table_offset_complaint, (char *) symnum); \
104       *NAMEP = ""; \
105     } \
106   else \
107     *NAMEP = (SYM)->dsfile.name + VT (OBJFILE)
108 \f
109 /* We put a pointer to this structure in the read_symtab_private field
110    of the psymtab.  */
111
112 struct symloc
113 {
114   /* The offset within the file symbol table of first local symbol for
115      this file.  */
116
117   int ldsymoff;
118
119   /* Length (in bytes) of the section of the symbol table devoted to
120      this file's symbols (actually, the section bracketed may contain
121      more than just this file's symbols).  If ldsymlen is 0, the only
122      reason for this thing's existence is the dependency list.
123      Nothing else will happen when it is read in.  */
124
125   int ldsymlen;
126 };
127
128 #define LDSYMOFF(p) (((struct symloc *)((p)->read_symtab_private))->ldsymoff)
129 #define LDSYMLEN(p) (((struct symloc *)((p)->read_symtab_private))->ldsymlen)
130 #define SYMLOC(p) ((struct symloc *)((p)->read_symtab_private))
131 \f
132 /* FIXME: Shouldn't this stuff be in a .h file somewhere?  */
133 /* Nonzero means give verbose info on gdb action.  */
134 extern int info_verbose;
135
136 /* Complaints about the symbols we have encountered.  */
137 extern struct complaint string_table_offset_complaint;
138 extern struct complaint lbrac_unmatched_complaint;
139 extern struct complaint lbrac_mismatch_complaint;
140
141 extern union sltentry *hpread_get_slt
142   PARAMS ((int, struct objfile *));
143
144 extern union dnttentry *hpread_get_lntt
145   PARAMS ((int, struct objfile *));
146
147 int hpread_has_name
148   PARAMS ((enum dntt_entry_type));
149
150 /* end of hpread.h */