1 /* Build symbol tables in GDB's internal format - legacy APIs
2 Copyright (C) 1986-2019 Free Software Foundation, Inc.
4 This file is part of GDB.
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.
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.
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/>. */
19 #ifndef BUILDSYM_LEGACY_H
20 #define BUILDSYM_LEGACY_H
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.
30 The basic way this module is used is as follows:
32 scoped_free_pendings free_pending;
33 cust = start_symtab (...);
34 ... read debug info ...
35 cust = end_symtab (...);
37 The compunit symtab pointer ("cust") is returned from both start_symtab
38 and end_symtab to simplify the debug info readers.
40 dbxread.c and xcoffread.c use another variation:
42 scoped_free_pendings free_pending;
43 cust = start_symtab (...);
44 ... read debug info ...
45 cust = end_symtab (...);
46 ... start_symtab + read + end_symtab repeated ...
49 class scoped_free_pendings
53 scoped_free_pendings () = default;
54 ~scoped_free_pendings ();
56 DISABLE_COPY_AND_ASSIGN (scoped_free_pendings
);
59 extern struct block
*finish_block (struct symbol
*symbol
,
60 struct pending_block
*old_blocks
,
61 const struct dynamic_prop
*static_link
,
65 extern void record_block_range (struct block
*,
66 CORE_ADDR start
, CORE_ADDR end_inclusive
);
68 extern void start_subfile (const char *name
);
70 extern void patch_subfile_names (struct subfile
*subfile
, const char *name
);
72 extern void push_subfile ();
74 extern const char *pop_subfile ();
76 extern struct compunit_symtab
*end_symtab (CORE_ADDR end_addr
, int section
);
78 extern struct context_stack
*push_context (int desc
, CORE_ADDR valu
);
80 extern struct context_stack
pop_context ();
82 extern void record_line (struct subfile
*subfile
, int line
, CORE_ADDR pc
);
84 extern struct compunit_symtab
*start_symtab (struct objfile
*objfile
,
88 enum language language
);
90 extern void restart_symtab (struct compunit_symtab
*cust
,
91 const char *name
, CORE_ADDR start_addr
);
93 /* Record the name of the debug format in the current pending symbol
94 table. FORMAT must be a string with a lifetime at least as long as
95 the symtab's objfile. */
97 extern void record_debugformat (const char *format
);
99 /* Record the name of the debuginfo producer (usually the compiler) in
100 the current pending symbol table. PRODUCER must be a string with a
101 lifetime at least as long as the symtab's objfile. */
103 extern void record_producer (const char *producer
);
105 /* Set the name of the last source file. NAME is copied by this
108 extern void set_last_source_file (const char *name
);
110 /* Fetch the name of the last source file. */
112 extern const char *get_last_source_file (void);
114 /* Return the compunit symtab object.
115 It is only valid to call this between calls to start_symtab and the
116 end_symtab* functions. */
118 extern struct compunit_symtab
*buildsym_compunit_symtab (void);
120 /* Return the macro table.
121 Initialize it if this is the first use.
122 It is only valid to call this between calls to start_symtab and the
123 end_symtab* functions. */
125 extern struct macro_table
*get_macro_table (void);
127 /* Set the last source start address. Can only be used between
128 start_symtab and end_symtab* calls. */
130 extern void set_last_source_start_addr (CORE_ADDR addr
);
132 /* Get the last source start address. Can only be used between
133 start_symtab and end_symtab* calls. */
135 extern CORE_ADDR
get_last_source_start_addr ();
137 /* Return the local using directives. */
139 extern struct using_direct
**get_local_using_directives ();
141 /* Set the list of local using directives. */
143 extern void set_local_using_directives (struct using_direct
*new_local
);
145 /* Return the global using directives. */
147 extern struct using_direct
**get_global_using_directives ();
149 /* True if the context stack is empty. */
151 extern bool outermost_context_p ();
153 /* Return the top of the context stack, or nullptr if there is an
156 extern struct context_stack
*get_current_context_stack ();
158 /* Return the context stack depth. */
160 extern int get_context_stack_depth ();
162 /* Return the current subfile. */
164 extern struct subfile
*get_current_subfile ();
166 /* Return the local symbol list. */
168 extern struct pending
**get_local_symbols ();
170 /* Return the file symbol list. */
172 extern struct pending
**get_file_symbols ();
174 /* Return the global symbol list. */
176 extern struct pending
**get_global_symbols ();
178 /* Return the current buildsym_compunit. */
180 extern struct buildsym_compunit
*get_buildsym_compunit ();
182 #endif /* BUILDSYM_LEGACY_H */
This page took 0.047862 seconds and 4 git commands to generate.