* am29k-tdep.c (initialize_29k): Fix call_scratch_address doc.
[deliverable/binutils-gdb.git] / gdb / symfile.h
1 /* Definitions for reading symbol files into GDB.
2 Copyright (C) 1990, 1991, 1992 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 #if !defined (SYMFILE_H)
21 #define SYMFILE_H
22
23 /* This file requires that you first include "bfd.h". */
24
25 struct psymbol_allocation_list {
26 struct partial_symbol *list;
27 struct partial_symbol *next;
28 int size;
29 };
30
31 /* Structure to keep track of symbol reading functions for various
32 object file types. */
33
34 struct sym_fns {
35
36 /* is the name, or name prefix, of the BFD "target type" that this
37 set of functions handles. E.g. "a.out" or "sunOs" or "coff" or "elf". */
38
39 char *sym_name;
40
41 /* counts how many bytes of sym_name should be checked against the
42 BFD target type of the file being read. If an exact match is
43 desired, specify the number of characters in sym_name plus 1 for the
44 NUL. If a prefix match is desired, specify the number of characters in
45 sym_name. */
46
47 int sym_namelen;
48
49 /* Initializes anything that is global to the entire symbol table. It is
50 called during symbol_file_add, when we begin debugging an entirely new
51 program. */
52
53 void (*sym_new_init) PARAMS ((struct objfile *));
54
55 /* Reads any initial information from a symbol file, and initializes the
56 struct sym_fns SF in preparation for sym_read(). It is called every
57 time we read a symbol file for any reason. */
58
59 void (*sym_init) PARAMS ((struct objfile *));
60
61 /* sym_read (objfile, addr, mainline)
62 Reads a symbol file into a psymtab (or possibly a symtab).
63 OBJFILE is the objfile struct for the file we are reading.
64 SECTION_OFFSETS
65 are the offset between the file's specified section addresses and
66 their true addresses in memory.
67 MAINLINE is 1 if this is the
68 main symbol table being read, and 0 if a secondary
69 symbol file (e.g. shared library or dynamically loaded file)
70 is being read. */
71
72 void (*sym_read) PARAMS ((struct objfile *, struct section_offsets *, int));
73
74 /* Called when we are finished with an objfile. Should do all cleanup
75 that is specific to the object file format for the particular objfile. */
76
77 void (*sym_finish) PARAMS ((struct objfile *));
78
79 /* This function produces a file-dependent section_offsets structure,
80 allocated in the objfile's storage, and based on the parameter.
81 The parameter is currently a CORE_ADDR (FIXME!) for backward compatibility
82 with the higher levels of GDB. It should probably be changed to
83 a string, where NULL means the default, and others are parsed in a file
84 dependent way. The result of this function is handed in to sym_read. */
85
86 struct section_offsets *(*sym_offsets) PARAMS ((struct objfile *, CORE_ADDR));
87
88 /* Finds the next struct sym_fns. They are allocated and initialized
89 in whatever module implements the functions pointed to; an
90 initializer calls add_symtab_fns to add them to the global chain. */
91
92 struct sym_fns *next;
93
94 };
95
96 extern void
97 extend_psymbol_list PARAMS ((struct psymbol_allocation_list *,
98 struct objfile *));
99
100 /* Add any kind of symbol to a psymbol_allocation_list. */
101
102 #ifndef INLINE_ADD_PSYMBOL
103 #define INLINE_ADD_PSYMBOL 1
104 #endif
105
106 #if !INLINE_ADD_PSYMBOL
107
108 /* Since one arg is a struct, we have to pass in a ptr and deref it (sigh) */
109
110 #define ADD_PSYMBOL_TO_LIST(name, namelength, namespace, class, list, value, language, objfile) \
111 add_psymbol_to_list (name, namelength, namespace, class, &list, value, language, objfile)
112
113 #define ADD_PSYMBOL_ADDR_TO_LIST(name, namelength, namespace, class, list, value, language, objfile) \
114 add_psymbol_addr_to_list (name, namelength, namespace, class, &list, value, language, objfile)
115
116 #else /* !INLINE_ADD_PSYMBOL */
117
118 #include "demangle.h"
119
120 #define ADD_PSYMBOL_VT_TO_LIST(NAME,NAMELENGTH,NAMESPACE,CLASS,LIST,VALUE,VT,LANGUAGE, OBJFILE) \
121 do { \
122 register struct partial_symbol *psym; \
123 register char *demangled_name; \
124 if ((LIST).next >= (LIST).list + (LIST).size) \
125 extend_psymbol_list (&(LIST),(OBJFILE)); \
126 psym = (LIST).next++; \
127 SYMBOL_NAME (psym) = \
128 (char *) obstack_alloc (&objfile->psymbol_obstack, \
129 (NAMELENGTH) + 1); \
130 memcpy (SYMBOL_NAME (psym), (NAME), (NAMELENGTH)); \
131 SYMBOL_NAME (psym)[(NAMELENGTH)] = '\0'; \
132 SYMBOL_NAMESPACE (psym) = (NAMESPACE); \
133 PSYMBOL_CLASS (psym) = (CLASS); \
134 VT (psym) = (VALUE); \
135 SYMBOL_LANGUAGE (psym) = (LANGUAGE); \
136 if ((LANGUAGE) == language_cplus) \
137 { \
138 demangled_name = \
139 cplus_demangle (SYMBOL_NAME (psym), DMGL_PARAMS | DMGL_ANSI); \
140 if (demangled_name == NULL) \
141 { \
142 SYMBOL_DEMANGLED_NAME (psym) = NULL; \
143 } \
144 else \
145 { \
146 SYMBOL_DEMANGLED_NAME (psym) = \
147 obsavestring (demangled_name, strlen (demangled_name), \
148 &objfile->psymbol_obstack); \
149 free (demangled_name); \
150 } \
151 } \
152 } while (0);
153
154 /* Add a symbol with an integer value to a psymtab. */
155
156 #define ADD_PSYMBOL_TO_LIST(name, namelength, namespace, class, list, value, language, objfile) \
157 ADD_PSYMBOL_VT_TO_LIST (name, namelength, namespace, class, list, value, SYMBOL_VALUE, language, objfile)
158
159 /* Add a symbol with a CORE_ADDR value to a psymtab. */
160
161 #define ADD_PSYMBOL_ADDR_TO_LIST(name, namelength, namespace, class, list, value, language, objfile)\
162 ADD_PSYMBOL_VT_TO_LIST (name, namelength, namespace, class, list, value, SYMBOL_VALUE_ADDRESS, language, objfile)
163
164 #endif /* INLINE_ADD_PSYMBOL */
165
166 /* Functions */
167
168 extern void
169 sort_pst_symbols PARAMS ((struct partial_symtab *));
170
171 extern struct symtab *
172 allocate_symtab PARAMS ((char *, struct objfile *));
173
174 extern int
175 free_named_symtabs PARAMS ((char *));
176
177 extern void
178 fill_in_vptr_fieldno PARAMS ((struct type *));
179
180 extern void
181 add_symtab_fns PARAMS ((struct sym_fns *));
182
183 extern void
184 init_entry_point_info PARAMS ((struct objfile *));
185
186 extern void
187 syms_from_objfile PARAMS ((struct objfile *, CORE_ADDR, int, int));
188
189 extern void
190 new_symfile_objfile PARAMS ((struct objfile *, int, int));
191
192 extern struct partial_symtab *
193 start_psymtab_common PARAMS ((struct objfile *, struct section_offsets *,
194 char *, CORE_ADDR,
195 struct partial_symbol *,
196 struct partial_symbol *));
197
198 /* Sorting your symbols for fast lookup or alphabetical printing. */
199
200 extern void
201 sort_block_syms PARAMS ((struct block *));
202
203 extern void
204 sort_symtab_syms PARAMS ((struct symtab *));
205
206 extern void
207 sort_all_symtab_syms PARAMS ((void));
208
209 /* Make a copy of the string at PTR with SIZE characters in the symbol obstack
210 (and add a null character at the end in the copy).
211 Returns the address of the copy. */
212
213 extern char *
214 obsavestring PARAMS ((char *, int, struct obstack *));
215
216 /* Concatenate strings S1, S2 and S3; return the new string.
217 Space is found in the symbol_obstack. */
218
219 extern char *
220 obconcat PARAMS ((struct obstack *obstackp, const char *, const char *,
221 const char *));
222
223 /* Variables */
224
225 /* From symfile.c */
226
227 extern struct partial_symtab *
228 allocate_psymtab PARAMS ((char *, struct objfile *));
229
230 /* From dwarfread.c */
231
232 extern void
233 dwarf_build_psymtabs PARAMS ((struct objfile *, struct section_offsets *, int,
234 file_ptr, unsigned int, file_ptr, unsigned int));
235
236 /* From dbxread.c */
237
238 extern void
239 elfstab_build_psymtabs PARAMS ((struct objfile *objfile,
240 struct section_offsets *section_offsets,
241 int mainline,
242 file_ptr staboff, unsigned int stabsize,
243 file_ptr stabstroffset, unsigned int stabstrsize));
244
245 /* From demangle.c */
246
247 extern void
248 set_demangling_style PARAMS ((char *));
249
250 #endif /* !defined(SYMFILE_H) */
This page took 0.034106 seconds and 4 git commands to generate.