Commit | Line | Data |
---|---|---|
0baae8db TT |
1 | /* Build symbol tables in GDB's internal format - legacy APIs |
2 | Copyright (C) 1986-2018 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 3 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, see <http://www.gnu.org/licenses/>. */ | |
18 | ||
19 | #if !defined (LEGACY_BUILDSYM_H) | |
20 | #define LEGACY_BUILDSYM_H 1 | |
21 | ||
22 | #include "buildsym.h" | |
23 | ||
24 | /* This module provides definitions used for creating and adding to | |
25 | the symbol table. These routines are called from various symbol- | |
26 | file-reading routines. This file holds the legacy API, which | |
27 | relies on a global variable to work properly. New or maintained | |
28 | symbol readers should use the builder API in buildsym.h. | |
29 | ||
30 | The basic way this module is used is as follows: | |
31 | ||
32 | scoped_free_pendings free_pending; | |
33 | cust = start_symtab (...); | |
34 | ... read debug info ... | |
35 | cust = end_symtab (...); | |
36 | ||
37 | The compunit symtab pointer ("cust") is returned from both start_symtab | |
38 | and end_symtab to simplify the debug info readers. | |
39 | ||
40 | There are minor variations on this, e.g., dwarf2read.c splits end_symtab | |
41 | into two calls: end_symtab_get_static_block, end_symtab_from_static_block, | |
42 | but all debug info readers follow this basic flow. | |
43 | ||
44 | Reading DWARF Type Units is another variation: | |
45 | ||
46 | scoped_free_pendings free_pending; | |
47 | cust = start_symtab (...); | |
48 | ... read debug info ... | |
49 | cust = end_expandable_symtab (...); | |
50 | ||
51 | And then reading subsequent Type Units within the containing "Comp Unit" | |
52 | will use a second flow: | |
53 | ||
54 | scoped_free_pendings free_pending; | |
55 | cust = restart_symtab (...); | |
56 | ... read debug info ... | |
57 | cust = augment_type_symtab (...); | |
58 | ||
59 | dbxread.c and xcoffread.c use another variation: | |
60 | ||
61 | scoped_free_pendings free_pending; | |
62 | cust = start_symtab (...); | |
63 | ... read debug info ... | |
64 | cust = end_symtab (...); | |
65 | ... start_symtab + read + end_symtab repeated ... | |
66 | */ | |
67 | ||
68 | class scoped_free_pendings | |
69 | { | |
70 | public: | |
71 | ||
72 | scoped_free_pendings () = default; | |
73 | ~scoped_free_pendings (); | |
74 | ||
75 | DISABLE_COPY_AND_ASSIGN (scoped_free_pendings); | |
76 | }; | |
77 | ||
78 | extern struct block *finish_block (struct symbol *symbol, | |
79 | struct pending_block *old_blocks, | |
80 | const struct dynamic_prop *static_link, | |
81 | CORE_ADDR start, | |
82 | CORE_ADDR end); | |
83 | ||
84 | extern void record_block_range (struct block *, | |
85 | CORE_ADDR start, CORE_ADDR end_inclusive); | |
86 | ||
87 | extern void start_subfile (const char *name); | |
88 | ||
89 | extern void patch_subfile_names (struct subfile *subfile, const char *name); | |
90 | ||
91 | extern void push_subfile (); | |
92 | ||
93 | extern const char *pop_subfile (); | |
94 | ||
95 | extern struct block *end_symtab_get_static_block (CORE_ADDR end_addr, | |
96 | int expandable, | |
97 | int required); | |
98 | ||
99 | extern struct compunit_symtab * | |
100 | end_symtab_from_static_block (struct block *static_block, | |
101 | int section, int expandable); | |
102 | ||
103 | extern struct compunit_symtab *end_symtab (CORE_ADDR end_addr, int section); | |
104 | ||
105 | extern struct compunit_symtab *end_expandable_symtab (CORE_ADDR end_addr, | |
106 | int section); | |
107 | ||
108 | extern void augment_type_symtab (void); | |
109 | ||
110 | extern struct context_stack *push_context (int desc, CORE_ADDR valu); | |
111 | ||
112 | extern struct context_stack pop_context (); | |
113 | ||
114 | extern record_line_ftype record_line; | |
115 | ||
116 | extern struct compunit_symtab *start_symtab (struct objfile *objfile, | |
117 | const char *name, | |
118 | const char *comp_dir, | |
119 | CORE_ADDR start_addr, | |
120 | enum language language); | |
121 | ||
122 | extern void restart_symtab (struct compunit_symtab *cust, | |
123 | const char *name, CORE_ADDR start_addr); | |
124 | ||
125 | /* Record the name of the debug format in the current pending symbol | |
126 | table. FORMAT must be a string with a lifetime at least as long as | |
127 | the symtab's objfile. */ | |
128 | ||
129 | extern void record_debugformat (const char *format); | |
130 | ||
131 | /* Record the name of the debuginfo producer (usually the compiler) in | |
132 | the current pending symbol table. PRODUCER must be a string with a | |
133 | lifetime at least as long as the symtab's objfile. */ | |
134 | ||
135 | extern void record_producer (const char *producer); | |
136 | ||
137 | /* Set the name of the last source file. NAME is copied by this | |
138 | function. */ | |
139 | ||
140 | extern void set_last_source_file (const char *name); | |
141 | ||
142 | /* Fetch the name of the last source file. */ | |
143 | ||
144 | extern const char *get_last_source_file (void); | |
145 | ||
146 | /* Return the compunit symtab object. | |
147 | It is only valid to call this between calls to start_symtab and the | |
148 | end_symtab* functions. */ | |
149 | ||
150 | extern struct compunit_symtab *buildsym_compunit_symtab (void); | |
151 | ||
152 | /* Return the macro table. | |
153 | Initialize it if this is the first use. | |
154 | It is only valid to call this between calls to start_symtab and the | |
155 | end_symtab* functions. */ | |
156 | ||
157 | extern struct macro_table *get_macro_table (void); | |
158 | ||
159 | /* Set the last source start address. Can only be used between | |
160 | start_symtab and end_symtab* calls. */ | |
161 | ||
162 | extern void set_last_source_start_addr (CORE_ADDR addr); | |
163 | ||
164 | /* Get the last source start address. Can only be used between | |
165 | start_symtab and end_symtab* calls. */ | |
166 | ||
167 | extern CORE_ADDR get_last_source_start_addr (); | |
168 | ||
169 | /* Return the local using directives. */ | |
170 | ||
171 | extern struct using_direct **get_local_using_directives (); | |
172 | ||
173 | /* Set the list of local using directives. */ | |
174 | ||
175 | extern void set_local_using_directives (struct using_direct *new_local); | |
176 | ||
177 | /* Return the global using directives. */ | |
178 | ||
179 | extern struct using_direct **get_global_using_directives (); | |
180 | ||
181 | /* True if the context stack is empty. */ | |
182 | ||
183 | extern bool outermost_context_p (); | |
184 | ||
185 | /* Return the top of the context stack, or nullptr if there is an | |
186 | entry. */ | |
187 | ||
188 | extern struct context_stack *get_current_context_stack (); | |
189 | ||
190 | /* Return the context stack depth. */ | |
191 | ||
192 | extern int get_context_stack_depth (); | |
193 | ||
194 | /* Return the current subfile. */ | |
195 | ||
196 | extern struct subfile *get_current_subfile (); | |
197 | ||
198 | /* Return the local symbol list. */ | |
199 | ||
200 | extern struct pending **get_local_symbols (); | |
201 | ||
202 | /* Return the file symbol list. */ | |
203 | ||
204 | extern struct pending **get_file_symbols (); | |
205 | ||
206 | /* Return the global symbol list. */ | |
207 | ||
208 | extern struct pending **get_global_symbols (); | |
209 | ||
80e649fc TT |
210 | /* Return the current buildsym_compunit. */ |
211 | ||
212 | extern struct buildsym_compunit *get_buildsym_compunit (); | |
213 | ||
0baae8db | 214 | #endif /* defined (LEGACY_BUILDSYM_H) */ |