]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/symfile.h
* Makefile.in: Make check depend on all.
[thirdparty/binutils-gdb.git] / gdb / symfile.h
CommitLineData
bd5635a1 1/* Definitions for reading symbol files into GDB.
318bf84f 2 Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
bd5635a1
RP
3
4This file is part of GDB.
5
2f068b0d 6This program is free software; you can redistribute it and/or modify
bd5635a1 7it under the terms of the GNU General Public License as published by
2f068b0d
FF
8the Free Software Foundation; either version 2 of the License, or
9(at your option) any later version.
bd5635a1 10
2f068b0d 11This program is distributed in the hope that it will be useful,
bd5635a1
RP
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
2f068b0d
FF
17along with this program; if not, write to the Free Software
18Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
bd5635a1 19
318bf84f
FF
20#if !defined (SYMFILE_H)
21#define SYMFILE_H
22
bd5635a1
RP
23/* This file requires that you first include "bfd.h". */
24
318bf84f
FF
25struct psymbol_allocation_list {
26 struct partial_symbol *list;
27 struct partial_symbol *next;
28 int size;
29};
30
80d68b1d
FF
31/* Structure to keep track of symbol reading functions for various
32 object file types. */
33
34struct 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).
51b80b00
FF
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
80d68b1d
FF
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
51b80b00 72 void (*sym_read) PARAMS ((struct objfile *, struct section_offsets *, int));
80d68b1d
FF
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
51b80b00
FF
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
80d68b1d
FF
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
318bf84f
FF
96extern void
97extend_psymbol_list PARAMS ((struct psymbol_allocation_list *,
98 struct objfile *));
7e258d18
PB
99
100/* Add any kind of symbol to a psymbol_allocation_list. */
101
318bf84f 102#define ADD_PSYMBOL_VT_TO_LIST(NAME,NAMELENGTH,NAMESPACE,CLASS,LIST,VALUE,VT) \
7e258d18
PB
103 do { \
104 register struct partial_symbol *psym; \
105 if ((LIST).next >= (LIST).list + (LIST).size) \
318bf84f 106 extend_psymbol_list (&(LIST),objfile); \
7e258d18
PB
107 psym = (LIST).next++; \
108 \
318bf84f 109 SYMBOL_NAME (psym) = (char *) obstack_alloc (&objfile->psymbol_obstack, \
7e258d18 110 (NAMELENGTH) + 1); \
318bf84f 111 memcpy (SYMBOL_NAME (psym), (NAME), (NAMELENGTH)); \
7e258d18
PB
112 SYMBOL_NAME (psym)[(NAMELENGTH)] = '\0'; \
113 SYMBOL_NAMESPACE (psym) = (NAMESPACE); \
114 SYMBOL_CLASS (psym) = (CLASS); \
115 VT (psym) = (VALUE); \
116 } while (0);
117
318bf84f
FF
118#ifdef DEBUG
119
120/* Since one arg is a struct, we have to pass in a ptr and deref it (sigh) */
121
122#define ADD_PSYMBOL_TO_LIST(name, namelength, namespace, class, list, value) \
123 add_psymbol_to_list (name, namelength, namespace, class, &list, value)
124
125#define ADD_PSYMBOL_ADDR_TO_LIST(name, namelength, namespace, class, list, value) \
126 add_psymbol_addr_to_list (name, namelength, namespace, class, &list, value)
127
128#else /* !DEBUG */
129
130/* Add a symbol with an integer value to a psymtab. */
131
132#define ADD_PSYMBOL_TO_LIST(name, namelength, namespace, class, list, value) \
133 ADD_PSYMBOL_VT_TO_LIST (name, namelength, namespace, class, list, value, SYMBOL_VALUE)
134
135/* Add a symbol with a CORE_ADDR value to a psymtab. */
136
137#define ADD_PSYMBOL_ADDR_TO_LIST(name, namelength, namespace, class, list, value)\
138 ADD_PSYMBOL_VT_TO_LIST (name, namelength, namespace, class, list, value, SYMBOL_VALUE_ADDRESS)
139
140#endif /* DEBUG */
141
bd5635a1
RP
142 /* Functions */
143
318bf84f
FF
144extern void
145sort_pst_symbols PARAMS ((struct partial_symtab *));
146
147extern struct symtab *
148allocate_symtab PARAMS ((char *, struct objfile *));
149
318bf84f
FF
150extern int
151free_named_symtabs PARAMS ((char *));
bd5635a1 152
318bf84f
FF
153extern void
154fill_in_vptr_fieldno PARAMS ((struct type *));
bd5635a1 155
318bf84f
FF
156extern void
157add_symtab_fns PARAMS ((struct sym_fns *));
158
51b80b00
FF
159extern void
160init_entry_point_info PARAMS ((struct objfile *));
161
318bf84f
FF
162extern void
163syms_from_objfile PARAMS ((struct objfile *, CORE_ADDR, int, int));
164
51b80b00
FF
165extern void
166new_symfile_objfile PARAMS ((struct objfile *, int, int));
167
318bf84f 168extern struct partial_symtab *
51b80b00
FF
169start_psymtab_common PARAMS ((struct objfile *, struct section_offsets *,
170 char *, CORE_ADDR,
318bf84f
FF
171 struct partial_symbol *,
172 struct partial_symbol *));
bd5635a1
RP
173
174/* Sorting your symbols for fast lookup or alphabetical printing. */
175
318bf84f
FF
176extern void
177sort_block_syms PARAMS ((struct block *));
178
179extern void
180sort_symtab_syms PARAMS ((struct symtab *));
181
182extern void
183sort_all_symtab_syms PARAMS ((void));
bd5635a1
RP
184
185/* Make a copy of the string at PTR with SIZE characters in the symbol obstack
186 (and add a null character at the end in the copy).
187 Returns the address of the copy. */
188
318bf84f
FF
189extern char *
190obsavestring PARAMS ((char *, int, struct obstack *));
bd5635a1
RP
191
192/* Concatenate strings S1, S2 and S3; return the new string.
193 Space is found in the symbol_obstack. */
194
318bf84f
FF
195extern char *
196obconcat PARAMS ((struct obstack *obstackp, const char *, const char *,
197 const char *));
bd5635a1
RP
198
199 /* Variables */
200
318bf84f
FF
201/* From symfile.c */
202
203extern struct partial_symtab *
204allocate_psymtab PARAMS ((char *, struct objfile *));
205
51b80b00 206/* From dwarfread.c */
318bf84f 207
51b80b00
FF
208extern void
209dwarf_build_psymtabs PARAMS ((struct objfile *, struct section_offsets *, int,
210 file_ptr, unsigned int, file_ptr, unsigned int));
318bf84f 211
51b80b00 212/* From dbxread.c */
318bf84f 213
51b80b00
FF
214extern void
215elfstab_build_psymtabs PARAMS ((struct objfile *objfile,
216 struct section_offsets *section_offsets,
217 int mainline,
218 file_ptr staboff, unsigned int stabsize,
219 file_ptr stabstroffset, unsigned int stabstrsize));
318bf84f 220
51b80b00 221/* From demangle.c */
318bf84f
FF
222
223extern void
51b80b00 224set_demangling_style PARAMS ((char *));
318bf84f
FF
225
226#endif /* !defined(SYMFILE_H) */