GDB (xrefs)
Loading...
Searching...
No Matches
buildsym-legacy.c
Go to the documentation of this file.
1/* Legacy support routines for building symbol tables in GDB's internal format.
2 Copyright (C) 1986-2023 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#include "defs.h"
20#include "buildsym-legacy.h"
21#include "symtab.h"
22
23/* The work-in-progress of the compunit we are building.
24 This is created first, before any subfiles by start_compunit_symtab. */
25
27
28void
29record_debugformat (const char *format)
30{
32}
33
34void
35record_producer (const char *producer)
36{
38}
39
40
41
42/* See buildsym.h. */
43
44void
46{
47 gdb_assert (buildsym_compunit != nullptr || name == nullptr);
48 if (buildsym_compunit != nullptr)
50}
51
52/* See buildsym.h. */
53
54const char *
56{
57 if (buildsym_compunit == nullptr)
58 return nullptr;
60}
61
62/* See buildsym.h. */
63
64void
66{
67 gdb_assert (buildsym_compunit != nullptr);
69}
70
71/* See buildsym.h. */
72
73CORE_ADDR
79
80/* See buildsym.h. */
81
82bool
84{
85 gdb_assert (buildsym_compunit != nullptr);
87}
88
89/* See buildsym.h. */
90
91int
93{
94 gdb_assert (buildsym_compunit != nullptr);
96}
97
98/* See buildsym.h. */
99
100struct subfile *
102{
103 gdb_assert (buildsym_compunit != nullptr);
105}
106
107/* See buildsym.h. */
108
109struct pending **
111{
112 gdb_assert (buildsym_compunit != nullptr);
114}
115
116/* See buildsym.h. */
117
118struct pending **
120{
121 gdb_assert (buildsym_compunit != nullptr);
123}
124
125/* See buildsym.h. */
126
127struct pending **
129{
130 gdb_assert (buildsym_compunit != nullptr);
132}
133
134void
135start_subfile (const char *name)
136{
137 gdb_assert (buildsym_compunit != nullptr);
139}
140
141void
143{
144 gdb_assert (buildsym_compunit != nullptr);
146}
147
148void
150{
151 gdb_assert (buildsym_compunit != nullptr);
153}
154
155const char *
157{
158 gdb_assert (buildsym_compunit != nullptr);
160}
161
162/* Delete the buildsym compunit. */
163
164static void
166{
167 if (buildsym_compunit == NULL)
168 return;
169 delete buildsym_compunit;
170 buildsym_compunit = NULL;
171}
172
173struct compunit_symtab *
174end_compunit_symtab (CORE_ADDR end_addr)
175{
176 gdb_assert (buildsym_compunit != nullptr);
177 struct compunit_symtab *result
180 return result;
181}
182
183struct context_stack *
184push_context (int desc, CORE_ADDR valu)
185{
186 gdb_assert (buildsym_compunit != nullptr);
187 return buildsym_compunit->push_context (desc, valu);
188}
189
190struct context_stack
192{
193 gdb_assert (buildsym_compunit != nullptr);
195}
196
197struct block *
198finish_block (struct symbol *symbol, struct pending_block *old_blocks,
199 const struct dynamic_prop *static_link,
200 CORE_ADDR start, CORE_ADDR end)
201{
202 gdb_assert (buildsym_compunit != nullptr);
203 return buildsym_compunit->finish_block (symbol, old_blocks, static_link,
204 start, end);
205}
206
207void
208record_line (struct subfile *subfile, int line, unrelocated_addr pc)
209{
210 gdb_assert (buildsym_compunit != nullptr);
211 /* Assume every line entry is a statement start, that is a good place to
212 put a breakpoint for that line number. */
214}
215
216/* Start a new compunit_symtab for a new source file in OBJFILE. Called, for
217 example, when a stabs symbol of type N_SO is seen, or when a DWARF
218 DW_TAG_compile_unit DIE is seen. It indicates the start of data for one
219 original source file.
220
221 NAME is the name of the file (cannot be NULL). COMP_DIR is the
222 directory in which the file was compiled (or NULL if not known).
223 START_ADDR is the lowest address of objects in the file (or 0 if
224 not known). LANGUAGE is the language of the source file, or
225 language_unknown if not known, in which case it'll be deduced from
226 the filename. */
227
228struct compunit_symtab *
230 const char *comp_dir, CORE_ADDR start_addr,
231 enum language language)
232{
233 /* These should have been reset either by successful completion of building
234 a symtab, or by the scoped_free_pendings destructor. */
235 gdb_assert (buildsym_compunit == nullptr);
236
237 buildsym_compunit = new struct buildsym_compunit (objfile, name, comp_dir,
238 language, start_addr);
239
241}
242
243/* At end of reading syms, or in case of quit, ensure everything
244 associated with building symtabs is freed.
245
246 N.B. This is *not* intended to be used when building psymtabs. Some debug
247 info readers call this anyway, which is harmless if confusing. */
248
253
254/* See buildsym-legacy.h. */
255
256struct buildsym_compunit *
258{
259 gdb_assert (buildsym_compunit != nullptr);
260 return buildsym_compunit;
261}
const char *const name
void set_last_source_start_addr(CORE_ADDR addr)
struct context_stack * push_context(int desc, CORE_ADDR valu)
struct block * finish_block(struct symbol *symbol, struct pending_block *old_blocks, const struct dynamic_prop *static_link, CORE_ADDR start, CORE_ADDR end)
struct compunit_symtab * start_compunit_symtab(struct objfile *objfile, const char *name, const char *comp_dir, CORE_ADDR start_addr, enum language language)
struct context_stack pop_context()
void push_subfile()
static struct buildsym_compunit * buildsym_compunit
struct pending ** get_file_symbols()
CORE_ADDR get_last_source_start_addr()
static void free_buildsym_compunit(void)
bool outermost_context_p()
struct subfile * get_current_subfile()
void record_debugformat(const char *format)
void set_last_source_file(const char *name)
void record_producer(const char *producer)
struct compunit_symtab * end_compunit_symtab(CORE_ADDR end_addr)
void patch_subfile_names(struct subfile *subfile, const char *name)
struct pending ** get_global_symbols()
int get_context_stack_depth()
void record_line(struct subfile *subfile, int line, unrelocated_addr pc)
void start_subfile(const char *name)
const char * get_last_source_file()
struct pending ** get_local_symbols()
const char * pop_subfile()
struct buildsym_compunit * get_buildsym_compunit()
@ LEF_IS_STMT
Definition buildsym.h:129
language
Definition defs.h:211
Definition block.h:109
CORE_ADDR start() const
Definition block.h:111
struct dynamic_prop * static_link() const
Definition block.c:408
CORE_ADDR end() const
Definition block.h:119
void push_subfile()
Definition buildsym.c:606
struct compunit_symtab * get_compunit_symtab()
Definition buildsym.h:245
CORE_ADDR get_last_source_start_addr()
Definition buildsym.h:255
struct pending ** get_local_symbols()
Definition buildsym.h:297
void start_subfile(const char *name, const char *name_for_id)
Definition buildsym.c:487
const char * get_last_source_file()
Definition buildsym.h:189
struct block * finish_block(struct symbol *symbol, struct pending_block *old_blocks, const struct dynamic_prop *static_link, CORE_ADDR start, CORE_ADDR end)
Definition buildsym.c:386
void record_line(struct subfile *subfile, int line, unrelocated_addr pc, linetable_entry_flags flags)
Definition buildsym.c:626
void record_producer(const char *producer)
Definition buildsym.h:317
void set_last_source_file(const char *name)
Definition buildsym.h:183
bool outermost_context_p() const
Definition buildsym.h:275
void set_last_source_start_addr(CORE_ADDR addr)
Definition buildsym.h:250
struct pending ** get_file_symbols()
Definition buildsym.h:302
void record_debugformat(const char *format)
Definition buildsym.h:312
int get_context_stack_depth() const
Definition buildsym.h:287
struct context_stack pop_context()
Definition buildsym.c:1156
struct pending ** get_global_symbols()
Definition buildsym.h:307
struct subfile * get_current_subfile()
Definition buildsym.h:292
void patch_subfile_names(struct subfile *subfile, const char *name)
Definition buildsym.c:566
const char * pop_subfile()
Definition buildsym.c:614
struct compunit_symtab * end_compunit_symtab(CORE_ADDR end_addr)
Definition buildsym.c:1046
struct context_stack * push_context(int desc, CORE_ADDR valu)
Definition buildsym.c:1134