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