]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/buildsym-legacy.h
Introduce buildsym-legacy.h
[thirdparty/binutils-gdb.git] / gdb / buildsym-legacy.h
CommitLineData
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
68class scoped_free_pendings
69{
70public:
71
72 scoped_free_pendings () = default;
73 ~scoped_free_pendings ();
74
75 DISABLE_COPY_AND_ASSIGN (scoped_free_pendings);
76};
77
78extern 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
84extern void record_block_range (struct block *,
85 CORE_ADDR start, CORE_ADDR end_inclusive);
86
87extern void start_subfile (const char *name);
88
89extern void patch_subfile_names (struct subfile *subfile, const char *name);
90
91extern void push_subfile ();
92
93extern const char *pop_subfile ();
94
95extern struct block *end_symtab_get_static_block (CORE_ADDR end_addr,
96 int expandable,
97 int required);
98
99extern struct compunit_symtab *
100 end_symtab_from_static_block (struct block *static_block,
101 int section, int expandable);
102
103extern struct compunit_symtab *end_symtab (CORE_ADDR end_addr, int section);
104
105extern struct compunit_symtab *end_expandable_symtab (CORE_ADDR end_addr,
106 int section);
107
108extern void augment_type_symtab (void);
109
110extern struct context_stack *push_context (int desc, CORE_ADDR valu);
111
112extern struct context_stack pop_context ();
113
114extern record_line_ftype record_line;
115
116extern 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
122extern 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
129extern 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
135extern void record_producer (const char *producer);
136
137/* Set the name of the last source file. NAME is copied by this
138 function. */
139
140extern void set_last_source_file (const char *name);
141
142/* Fetch the name of the last source file. */
143
144extern 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
150extern 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
157extern 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
162extern 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
167extern CORE_ADDR get_last_source_start_addr ();
168
169/* Return the local using directives. */
170
171extern struct using_direct **get_local_using_directives ();
172
173/* Set the list of local using directives. */
174
175extern void set_local_using_directives (struct using_direct *new_local);
176
177/* Return the global using directives. */
178
179extern struct using_direct **get_global_using_directives ();
180
181/* True if the context stack is empty. */
182
183extern bool outermost_context_p ();
184
185/* Return the top of the context stack, or nullptr if there is an
186 entry. */
187
188extern struct context_stack *get_current_context_stack ();
189
190/* Return the context stack depth. */
191
192extern int get_context_stack_depth ();
193
194/* Return the current subfile. */
195
196extern struct subfile *get_current_subfile ();
197
198/* Return the local symbol list. */
199
200extern struct pending **get_local_symbols ();
201
202/* Return the file symbol list. */
203
204extern struct pending **get_file_symbols ();
205
206/* Return the global symbol list. */
207
208extern struct pending **get_global_symbols ();
209
210#endif /* defined (LEGACY_BUILDSYM_H) */