Name change (It's hitacho micro systems, not hitachi data systems)
[deliverable/binutils-gdb.git] / gdb / symfile.h
1 /* Definitions for reading symbol files into GDB.
2 Copyright (C) 1990, 1991 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20 /* This file requires that you first include "bfd.h". */
21
22
23 /* Structure for keeping track of object files.
24
25 One of these is allocated for each object file we access, e.g. the
26 exec_file, symbol_file, and any shared library object files. */
27
28 struct objfile {
29 /* All struct objfile's are chained together by their next pointers. */
30 struct objfile *next;
31
32 /* Each objfile points to a chain of struct symtabs derived from this
33 object file. They are chained by their objfile_chain pointers, and
34 each one points back to this struct objfile. */
35 struct symtab *symtabs;
36
37 /* Ditto for psymtabs. */
38 struct partial_symtab *psymtabs;
39
40 /* The object file's name. Malloc'd; free it if you free this struct. */
41 char *name;
42
43 /* The object file's BFD. Can be null, in which case bfd_open (name) and
44 put the result here. */
45 bfd *obfd;
46
47 /* The modification timestamp of the object file, as of the last time
48 we read its symbols. */
49 long mtime;
50 };
51
52
53 /* Structure to keep track of symbol reading functions for various
54 object file types. */
55
56 struct sym_fns {
57
58 /* sym_name
59 is the name, or name prefix, of the BFD "target type" that this
60 set of functions handles. E.g. "a.out" or "sunOs" or "coff" or "elf". */
61
62 char *sym_name;
63
64 /* sym_namelen
65 counts how many bytes of sym_name should be checked against the
66 BFD target type of the file being read. If an exact match is
67 desired, specify the number of characters in sym_name plus 1 for the
68 NUL. If a prefix match is desired, specify the number of characters in
69 sym_name. */
70
71 int sym_namelen;
72
73 /* sym_new_init
74 initializes anything that is global to the entire
75 symbol table. It is called during symbol_file_add, when
76 we begin debugging an entirely new program. */
77
78 void (*sym_new_init) ();
79
80 /* sym_init (sf)
81 reads any initial information from a symbol file, and
82 initializes the struct sym_fns SF in preparation for sym_read().
83 It is called every time we read a symbol file for any reason. */
84
85 void (*sym_init) ();
86
87 /* sym_read (sf, addr, mainline)
88 reads a symbol file into a psymtab (or possibly a symtab).
89 SF is the struct sym_fns that sym_init initialized. ADDR
90 is the offset between the file's specified start address and
91 its true address in memory. MAINLINE is 1 if this is the
92 main symbol table being read, and 0 if a secondary
93 symbol file (e.g. shared library or dynamically loaded file)
94 is being read. */
95
96 void (*sym_read) ();
97
98 /* sym_bfd
99 is the accessor for the symbol file being read. */
100
101 bfd *sym_bfd;
102
103 /* sym_private
104 is where information can be shared among sym_init and sym_read.
105 It is typically a pointer to malloc'd memory. */
106
107 char *sym_private; /* Should be void * */
108
109 /* next
110 finds the next struct sym_fns. They are allocated and initialized
111 in whatever module implements the functions pointed to; an
112 initializer calls add_symtab_fns to add them to the global chain. */
113 struct sym_fns *next;
114
115 /* objfile
116 is the "struct objfile" for the object file being read. */
117 struct objfile *objfile;
118 };
119
120 extern void extend_psymbol_list();
121
122 /* Add any kind of symbol to a psymbol_allocation_list. */
123
124 #define ADD_PSYMBOL_VT_TO_LIST(NAME, NAMELENGTH, NAMESPACE, CLASS, LIST, VALUE, VT)\
125 do { \
126 register struct partial_symbol *psym; \
127 if ((LIST).next >= (LIST).list + (LIST).size) \
128 extend_psymbol_list(&(LIST)); \
129 psym = (LIST).next++; \
130 \
131 SYMBOL_NAME (psym) = (char *) obstack_alloc (psymbol_obstack, \
132 (NAMELENGTH) + 1); \
133 strncpy (SYMBOL_NAME (psym), (NAME), (NAMELENGTH)); \
134 SYMBOL_NAME (psym)[(NAMELENGTH)] = '\0'; \
135 SYMBOL_NAMESPACE (psym) = (NAMESPACE); \
136 SYMBOL_CLASS (psym) = (CLASS); \
137 VT (psym) = (VALUE); \
138 } while (0);
139
140 /* Functions */
141
142 extern struct symtab *allocate_symtab ();
143 extern struct objfile *allocate_objfile ();
144 extern void free_objfile ();
145 extern int free_named_symtabs ();
146 extern void fill_in_vptr_fieldno ();
147 extern void add_symtab_fns ();
148 extern void syms_from_objfile ();
149
150 /* Functions for dealing with the misc "function" vector, really a misc
151 address<->symbol mapping vector for things we don't have debug symbols
152 for. */
153
154 extern void init_misc_bunches ();
155 extern void prim_record_misc_function ();
156 extern void discard_misc_bunches ();
157 extern void condense_misc_bunches ();
158
159 /* Sorting your symbols for fast lookup or alphabetical printing. */
160
161 extern void sort_block_syms ();
162 extern void sort_symtab_syms ();
163 extern void sort_all_symtab_syms ();
164 extern void sort_block_syms ();
165
166 /* Make a copy of the string at PTR with SIZE characters in the symbol obstack
167 (and add a null character at the end in the copy).
168 Returns the address of the copy. */
169
170 extern char *obsavestring ();
171
172 /* Concatenate strings S1, S2 and S3; return the new string.
173 Space is found in the symbol_obstack. */
174
175 extern char *obconcat ();
176
177 /* Variables */
178
179 /* The object file that the main symbol table was loaded from (e.g. the
180 argument to the "symbol-file" or "file" command). */
181
182 extern struct objfile *symfile_objfile;
183
184 /* Where execution starts in symfile */
185
186 CORE_ADDR entry_point;
187
188 /* Root of object file struct chain. */
189
190 struct objfile *object_files;
191
192 /* Vectors of all partial symbols read in from file. */
193
194 extern struct psymbol_allocation_list {
195 struct partial_symbol *list, *next;
196 int size;
197 } global_psymbols, static_psymbols;
198
199 /* Support for complaining about things in the symbol file that aren't
200 catastrophic.
201
202 Each such thing gets a counter. The first time we have the problem,
203 during a symbol read, we report it. At the end of symbol reading,
204 if verbose, we report how many of each problem we had. */
205
206 struct complaint {
207 char *message;
208 unsigned counter;
209 struct complaint *next;
210 };
211
212 /* Root of the chain of complaints that have at some point been issued.
213 This is used to reset the counters, and/or report the total counts. */
214
215 extern struct complaint complaint_root[1];
216
217 /* Functions that handle complaints. (in symfile.c) */
218
219 void complain();
220 void clear_complaints();
This page took 0.033339 seconds and 4 git commands to generate.