Commit | Line | Data |
---|---|---|
ccefe4c4 TT |
1 | /* Partial symbol tables. |
2 | ||
28e7fd62 | 3 | Copyright (C) 2009-2013 Free Software Foundation, Inc. |
ccefe4c4 TT |
4 | |
5 | This file is part of GDB. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 3 of the License, or | |
10 | (at your option) any later version. | |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
19 | ||
20 | #include "defs.h" | |
21 | #include "symtab.h" | |
22 | #include "psympriv.h" | |
23 | #include "objfiles.h" | |
24 | #include "gdb_assert.h" | |
25 | #include "block.h" | |
26 | #include "filenames.h" | |
27 | #include "source.h" | |
28 | #include "addrmap.h" | |
29 | #include "gdbtypes.h" | |
30 | #include "bcache.h" | |
31 | #include "ui-out.h" | |
32 | #include "command.h" | |
33 | #include "readline/readline.h" | |
34 | #include "gdb_regex.h" | |
40658b94 | 35 | #include "dictionary.h" |
c00f8484 KS |
36 | #include "language.h" |
37 | #include "cp-support.h" | |
dfc7bb5b | 38 | #include "gdbcmd.h" |
ccefe4c4 TT |
39 | |
40 | #ifndef DEV_TTY | |
41 | #define DEV_TTY "/dev/tty" | |
42 | #endif | |
43 | ||
710e1a31 SW |
44 | struct psymbol_bcache |
45 | { | |
46 | struct bcache *bcache; | |
47 | }; | |
48 | ||
5c80ed9d TT |
49 | static struct partial_symbol *match_partial_symbol (struct objfile *, |
50 | struct partial_symtab *, | |
40658b94 PH |
51 | int, |
52 | const char *, domain_enum, | |
2edb89d3 JK |
53 | symbol_compare_ftype *, |
54 | symbol_compare_ftype *); | |
40658b94 | 55 | |
5c80ed9d TT |
56 | static struct partial_symbol *lookup_partial_symbol (struct objfile *, |
57 | struct partial_symtab *, | |
ccefe4c4 TT |
58 | const char *, int, |
59 | domain_enum); | |
60 | ||
da5132d3 | 61 | static const char *psymtab_to_fullname (struct partial_symtab *ps); |
ccefe4c4 | 62 | |
5c80ed9d TT |
63 | static struct partial_symbol *find_pc_sect_psymbol (struct objfile *, |
64 | struct partial_symtab *, | |
ccefe4c4 TT |
65 | CORE_ADDR, |
66 | struct obj_section *); | |
67 | ||
50da2f25 YQ |
68 | static void fixup_psymbol_section (struct partial_symbol *psym, |
69 | struct objfile *objfile); | |
ccefe4c4 | 70 | |
5c80ed9d TT |
71 | static struct symtab *psymtab_to_symtab (struct objfile *objfile, |
72 | struct partial_symtab *pst); | |
ccefe4c4 | 73 | |
b11896a5 TT |
74 | /* Ensure that the partial symbols for OBJFILE have been loaded. This |
75 | function always returns its argument, as a convenience. */ | |
76 | ||
77 | struct objfile * | |
78 | require_partial_symbols (struct objfile *objfile, int verbose) | |
79 | { | |
80 | if ((objfile->flags & OBJF_PSYMTABS_READ) == 0) | |
81 | { | |
82 | objfile->flags |= OBJF_PSYMTABS_READ; | |
83 | ||
84 | if (objfile->sf->sym_read_psymbols) | |
85 | { | |
86 | if (verbose) | |
87 | { | |
88 | printf_unfiltered (_("Reading symbols from %s..."), | |
89 | objfile->name); | |
90 | gdb_flush (gdb_stdout); | |
91 | } | |
92 | (*objfile->sf->sym_read_psymbols) (objfile); | |
93 | if (verbose) | |
94 | { | |
95 | if (!objfile_has_symbols (objfile)) | |
96 | { | |
97 | wrap_here (""); | |
98 | printf_unfiltered (_("(no debugging symbols found)...")); | |
99 | wrap_here (""); | |
100 | } | |
101 | ||
102 | printf_unfiltered (_("done.\n")); | |
103 | } | |
104 | } | |
105 | } | |
106 | ||
107 | return objfile; | |
108 | } | |
109 | ||
110 | /* Traverse all psymtabs in one objfile, requiring that the psymtabs | |
111 | be read in. */ | |
112 | ||
113 | #define ALL_OBJFILE_PSYMTABS_REQUIRED(objfile, p) \ | |
114 | for ((p) = require_partial_symbols (objfile, 1)->psymtabs; \ | |
115 | (p) != NULL; \ | |
116 | (p) = (p)->next) | |
117 | ||
118 | /* We want to make sure this file always requires psymtabs. */ | |
119 | ||
120 | #undef ALL_OBJFILE_PSYMTABS | |
121 | ||
122 | /* Traverse all psymtabs in all objfiles. */ | |
123 | ||
124 | #define ALL_PSYMTABS(objfile, p) \ | |
125 | ALL_OBJFILES (objfile) \ | |
126 | ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, p) | |
127 | ||
f8eba3c6 TT |
128 | /* Helper function for partial_map_symtabs_matching_filename that |
129 | expands the symtabs and calls the iterator. */ | |
ccefe4c4 | 130 | |
f8eba3c6 TT |
131 | static int |
132 | partial_map_expand_apply (struct objfile *objfile, | |
133 | const char *name, | |
f8eba3c6 TT |
134 | const char *real_path, |
135 | struct partial_symtab *pst, | |
136 | int (*callback) (struct symtab *, void *), | |
137 | void *data) | |
138 | { | |
139 | struct symtab *last_made = objfile->symtabs; | |
140 | ||
9439a077 TT |
141 | /* Shared psymtabs should never be seen here. Instead they should |
142 | be handled properly by the caller. */ | |
143 | gdb_assert (pst->user == NULL); | |
144 | ||
f8eba3c6 TT |
145 | /* Don't visit already-expanded psymtabs. */ |
146 | if (pst->readin) | |
147 | return 0; | |
148 | ||
149 | /* This may expand more than one symtab, and we want to iterate over | |
150 | all of them. */ | |
5c80ed9d | 151 | psymtab_to_symtab (objfile, pst); |
f8eba3c6 | 152 | |
f5b95b50 | 153 | return iterate_over_some_symtabs (name, real_path, callback, data, |
f8eba3c6 TT |
154 | objfile->symtabs, last_made); |
155 | } | |
156 | ||
157 | /* Implementation of the map_symtabs_matching_filename method. */ | |
158 | ||
159 | static int | |
160 | partial_map_symtabs_matching_filename (struct objfile *objfile, | |
161 | const char *name, | |
f8eba3c6 TT |
162 | const char *real_path, |
163 | int (*callback) (struct symtab *, | |
164 | void *), | |
165 | void *data) | |
ccefe4c4 TT |
166 | { |
167 | struct partial_symtab *pst; | |
c011a4f4 | 168 | const char *name_basename = lbasename (name); |
ccefe4c4 | 169 | |
b11896a5 | 170 | ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, pst) |
ccefe4c4 | 171 | { |
9439a077 TT |
172 | /* We can skip shared psymtabs here, because any file name will be |
173 | attached to the unshared psymtab. */ | |
174 | if (pst->user != NULL) | |
175 | continue; | |
176 | ||
b4c41fc7 DE |
177 | /* Anonymous psymtabs don't have a file name. */ |
178 | if (pst->anonymous) | |
179 | continue; | |
180 | ||
af529f8f | 181 | if (compare_filenames_for_search (pst->filename, name)) |
ccefe4c4 | 182 | { |
f5b95b50 | 183 | if (partial_map_expand_apply (objfile, name, real_path, |
f8eba3c6 TT |
184 | pst, callback, data)) |
185 | return 1; | |
ccefe4c4 TT |
186 | } |
187 | ||
c011a4f4 DE |
188 | /* Before we invoke realpath, which can get expensive when many |
189 | files are involved, do a quick comparison of the basenames. */ | |
190 | if (! basenames_may_differ | |
191 | && FILENAME_CMP (name_basename, lbasename (pst->filename)) != 0) | |
192 | continue; | |
193 | ||
ccefe4c4 TT |
194 | /* If the user gave us an absolute path, try to find the file in |
195 | this symtab and use its absolute path. */ | |
ccefe4c4 TT |
196 | if (real_path != NULL) |
197 | { | |
af529f8f JK |
198 | gdb_assert (IS_ABSOLUTE_PATH (real_path)); |
199 | gdb_assert (IS_ABSOLUTE_PATH (name)); | |
ccefe4c4 | 200 | psymtab_to_fullname (pst); |
f5b95b50 | 201 | if (pst->fullname != NULL |
af529f8f | 202 | && FILENAME_CMP (real_path, pst->fullname) == 0) |
ccefe4c4 | 203 | { |
f5b95b50 | 204 | if (partial_map_expand_apply (objfile, name, real_path, |
f8eba3c6 TT |
205 | pst, callback, data)) |
206 | return 1; | |
ccefe4c4 TT |
207 | } |
208 | } | |
209 | } | |
210 | ||
f8eba3c6 | 211 | return 0; |
ccefe4c4 TT |
212 | } |
213 | ||
214 | /* Find which partial symtab contains PC and SECTION starting at psymtab PST. | |
215 | We may find a different psymtab than PST. See FIND_PC_SECT_PSYMTAB. */ | |
216 | ||
217 | static struct partial_symtab * | |
5c80ed9d TT |
218 | find_pc_sect_psymtab_closer (struct objfile *objfile, |
219 | CORE_ADDR pc, struct obj_section *section, | |
ccefe4c4 TT |
220 | struct partial_symtab *pst, |
221 | struct minimal_symbol *msymbol) | |
222 | { | |
ccefe4c4 TT |
223 | struct partial_symtab *tpst; |
224 | struct partial_symtab *best_pst = pst; | |
225 | CORE_ADDR best_addr = pst->textlow; | |
226 | ||
9750bca9 JK |
227 | gdb_assert (!pst->psymtabs_addrmap_supported); |
228 | ||
ccefe4c4 TT |
229 | /* An objfile that has its functions reordered might have |
230 | many partial symbol tables containing the PC, but | |
231 | we want the partial symbol table that contains the | |
232 | function containing the PC. */ | |
233 | if (!(objfile->flags & OBJF_REORDERED) && | |
0df8b418 | 234 | section == 0) /* Can't validate section this way. */ |
ccefe4c4 TT |
235 | return pst; |
236 | ||
237 | if (msymbol == NULL) | |
238 | return (pst); | |
239 | ||
240 | /* The code range of partial symtabs sometimes overlap, so, in | |
241 | the loop below, we need to check all partial symtabs and | |
0df8b418 | 242 | find the one that fits better for the given PC address. We |
ccefe4c4 TT |
243 | select the partial symtab that contains a symbol whose |
244 | address is closest to the PC address. By closest we mean | |
245 | that find_pc_sect_symbol returns the symbol with address | |
246 | that is closest and still less than the given PC. */ | |
247 | for (tpst = pst; tpst != NULL; tpst = tpst->next) | |
248 | { | |
249 | if (pc >= tpst->textlow && pc < tpst->texthigh) | |
250 | { | |
251 | struct partial_symbol *p; | |
252 | CORE_ADDR this_addr; | |
253 | ||
254 | /* NOTE: This assumes that every psymbol has a | |
255 | corresponding msymbol, which is not necessarily | |
256 | true; the debug info might be much richer than the | |
257 | object's symbol table. */ | |
5c80ed9d | 258 | p = find_pc_sect_psymbol (objfile, tpst, pc, section); |
ccefe4c4 TT |
259 | if (p != NULL |
260 | && SYMBOL_VALUE_ADDRESS (p) | |
261 | == SYMBOL_VALUE_ADDRESS (msymbol)) | |
262 | return tpst; | |
263 | ||
264 | /* Also accept the textlow value of a psymtab as a | |
265 | "symbol", to provide some support for partial | |
266 | symbol tables with line information but no debug | |
267 | symbols (e.g. those produced by an assembler). */ | |
268 | if (p != NULL) | |
269 | this_addr = SYMBOL_VALUE_ADDRESS (p); | |
270 | else | |
271 | this_addr = tpst->textlow; | |
272 | ||
273 | /* Check whether it is closer than our current | |
274 | BEST_ADDR. Since this symbol address is | |
275 | necessarily lower or equal to PC, the symbol closer | |
276 | to PC is the symbol which address is the highest. | |
277 | This way we return the psymtab which contains such | |
0df8b418 | 278 | best match symbol. This can help in cases where the |
ccefe4c4 TT |
279 | symbol information/debuginfo is not complete, like |
280 | for instance on IRIX6 with gcc, where no debug info | |
0df8b418 MS |
281 | is emitted for statics. (See also the nodebug.exp |
282 | testcase.) */ | |
ccefe4c4 TT |
283 | if (this_addr > best_addr) |
284 | { | |
285 | best_addr = this_addr; | |
286 | best_pst = tpst; | |
287 | } | |
288 | } | |
289 | } | |
290 | return best_pst; | |
291 | } | |
292 | ||
293 | /* Find which partial symtab contains PC and SECTION. Return 0 if | |
294 | none. We return the psymtab that contains a symbol whose address | |
295 | exactly matches PC, or, if we cannot find an exact match, the | |
296 | psymtab that contains a symbol whose address is closest to PC. */ | |
297 | static struct partial_symtab * | |
298 | find_pc_sect_psymtab (struct objfile *objfile, CORE_ADDR pc, | |
299 | struct obj_section *section, | |
300 | struct minimal_symbol *msymbol) | |
301 | { | |
302 | struct partial_symtab *pst; | |
303 | ||
304 | /* Try just the PSYMTABS_ADDRMAP mapping first as it has better granularity | |
305 | than the later used TEXTLOW/TEXTHIGH one. */ | |
306 | ||
307 | if (objfile->psymtabs_addrmap != NULL) | |
308 | { | |
309 | pst = addrmap_find (objfile->psymtabs_addrmap, pc); | |
310 | if (pst != NULL) | |
311 | { | |
312 | /* FIXME: addrmaps currently do not handle overlayed sections, | |
313 | so fall back to the non-addrmap case if we're debugging | |
314 | overlays and the addrmap returned the wrong section. */ | |
315 | if (overlay_debugging && msymbol && section) | |
316 | { | |
317 | struct partial_symbol *p; | |
ad3bbd48 | 318 | |
ccefe4c4 TT |
319 | /* NOTE: This assumes that every psymbol has a |
320 | corresponding msymbol, which is not necessarily | |
321 | true; the debug info might be much richer than the | |
322 | object's symbol table. */ | |
5c80ed9d | 323 | p = find_pc_sect_psymbol (objfile, pst, pc, section); |
ccefe4c4 TT |
324 | if (!p |
325 | || SYMBOL_VALUE_ADDRESS (p) | |
326 | != SYMBOL_VALUE_ADDRESS (msymbol)) | |
327 | goto next; | |
328 | } | |
329 | ||
330 | /* We do not try to call FIND_PC_SECT_PSYMTAB_CLOSER as | |
331 | PSYMTABS_ADDRMAP we used has already the best 1-byte | |
332 | granularity and FIND_PC_SECT_PSYMTAB_CLOSER may mislead us into | |
333 | a worse chosen section due to the TEXTLOW/TEXTHIGH ranges | |
334 | overlap. */ | |
335 | ||
336 | return pst; | |
337 | } | |
338 | } | |
339 | ||
340 | next: | |
341 | ||
342 | /* Existing PSYMTABS_ADDRMAP mapping is present even for PARTIAL_SYMTABs | |
343 | which still have no corresponding full SYMTABs read. But it is not | |
344 | present for non-DWARF2 debug infos not supporting PSYMTABS_ADDRMAP in GDB | |
345 | so far. */ | |
346 | ||
347 | /* Check even OBJFILE with non-zero PSYMTABS_ADDRMAP as only several of | |
348 | its CUs may be missing in PSYMTABS_ADDRMAP as they may be varying | |
349 | debug info type in single OBJFILE. */ | |
350 | ||
b11896a5 | 351 | ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, pst) |
9750bca9 JK |
352 | if (!pst->psymtabs_addrmap_supported |
353 | && pc >= pst->textlow && pc < pst->texthigh) | |
ccefe4c4 TT |
354 | { |
355 | struct partial_symtab *best_pst; | |
356 | ||
5c80ed9d TT |
357 | best_pst = find_pc_sect_psymtab_closer (objfile, pc, section, pst, |
358 | msymbol); | |
ccefe4c4 TT |
359 | if (best_pst != NULL) |
360 | return best_pst; | |
361 | } | |
362 | ||
363 | return NULL; | |
364 | } | |
365 | ||
366 | static struct symtab * | |
367 | find_pc_sect_symtab_from_partial (struct objfile *objfile, | |
368 | struct minimal_symbol *msymbol, | |
369 | CORE_ADDR pc, struct obj_section *section, | |
370 | int warn_if_readin) | |
371 | { | |
372 | struct partial_symtab *ps = find_pc_sect_psymtab (objfile, pc, section, | |
373 | msymbol); | |
374 | if (ps) | |
375 | { | |
376 | if (warn_if_readin && ps->readin) | |
377 | /* Might want to error() here (in case symtab is corrupt and | |
378 | will cause a core dump), but maybe we can successfully | |
379 | continue, so let's not. */ | |
380 | warning (_("\ | |
381 | (Internal error: pc %s in read in psymtab, but not in symtab.)\n"), | |
5c80ed9d TT |
382 | paddress (get_objfile_arch (objfile), pc)); |
383 | psymtab_to_symtab (objfile, ps); | |
9703b513 | 384 | return ps->symtab; |
ccefe4c4 TT |
385 | } |
386 | return NULL; | |
387 | } | |
388 | ||
389 | /* Find which partial symbol within a psymtab matches PC and SECTION. | |
390 | Return 0 if none. */ | |
391 | ||
392 | static struct partial_symbol * | |
5c80ed9d TT |
393 | find_pc_sect_psymbol (struct objfile *objfile, |
394 | struct partial_symtab *psymtab, CORE_ADDR pc, | |
ccefe4c4 TT |
395 | struct obj_section *section) |
396 | { | |
397 | struct partial_symbol *best = NULL, *p, **pp; | |
398 | CORE_ADDR best_pc; | |
399 | ||
400 | gdb_assert (psymtab != NULL); | |
401 | ||
0df8b418 | 402 | /* Cope with programs that start at address 0. */ |
ccefe4c4 TT |
403 | best_pc = (psymtab->textlow != 0) ? psymtab->textlow - 1 : 0; |
404 | ||
405 | /* Search the global symbols as well as the static symbols, so that | |
406 | find_pc_partial_function doesn't use a minimal symbol and thus | |
407 | cache a bad endaddr. */ | |
5c80ed9d TT |
408 | for (pp = objfile->global_psymbols.list + psymtab->globals_offset; |
409 | (pp - (objfile->global_psymbols.list + psymtab->globals_offset) | |
ccefe4c4 TT |
410 | < psymtab->n_global_syms); |
411 | pp++) | |
412 | { | |
413 | p = *pp; | |
414 | if (SYMBOL_DOMAIN (p) == VAR_DOMAIN | |
415 | && SYMBOL_CLASS (p) == LOC_BLOCK | |
416 | && pc >= SYMBOL_VALUE_ADDRESS (p) | |
417 | && (SYMBOL_VALUE_ADDRESS (p) > best_pc | |
418 | || (psymtab->textlow == 0 | |
419 | && best_pc == 0 && SYMBOL_VALUE_ADDRESS (p) == 0))) | |
420 | { | |
0df8b418 | 421 | if (section) /* Match on a specific section. */ |
ccefe4c4 | 422 | { |
5c80ed9d | 423 | fixup_psymbol_section (p, objfile); |
ccefe4c4 TT |
424 | if (!matching_obj_sections (SYMBOL_OBJ_SECTION (p), section)) |
425 | continue; | |
426 | } | |
427 | best_pc = SYMBOL_VALUE_ADDRESS (p); | |
428 | best = p; | |
429 | } | |
430 | } | |
431 | ||
5c80ed9d TT |
432 | for (pp = objfile->static_psymbols.list + psymtab->statics_offset; |
433 | (pp - (objfile->static_psymbols.list + psymtab->statics_offset) | |
ccefe4c4 TT |
434 | < psymtab->n_static_syms); |
435 | pp++) | |
436 | { | |
437 | p = *pp; | |
438 | if (SYMBOL_DOMAIN (p) == VAR_DOMAIN | |
439 | && SYMBOL_CLASS (p) == LOC_BLOCK | |
440 | && pc >= SYMBOL_VALUE_ADDRESS (p) | |
441 | && (SYMBOL_VALUE_ADDRESS (p) > best_pc | |
442 | || (psymtab->textlow == 0 | |
443 | && best_pc == 0 && SYMBOL_VALUE_ADDRESS (p) == 0))) | |
444 | { | |
0df8b418 | 445 | if (section) /* Match on a specific section. */ |
ccefe4c4 | 446 | { |
5c80ed9d | 447 | fixup_psymbol_section (p, objfile); |
ccefe4c4 TT |
448 | if (!matching_obj_sections (SYMBOL_OBJ_SECTION (p), section)) |
449 | continue; | |
450 | } | |
451 | best_pc = SYMBOL_VALUE_ADDRESS (p); | |
452 | best = p; | |
453 | } | |
454 | } | |
455 | ||
456 | return best; | |
457 | } | |
458 | ||
50da2f25 | 459 | static void |
ccefe4c4 TT |
460 | fixup_psymbol_section (struct partial_symbol *psym, struct objfile *objfile) |
461 | { | |
462 | CORE_ADDR addr; | |
463 | ||
50da2f25 YQ |
464 | if (psym == NULL || SYMBOL_OBJ_SECTION (psym) != NULL) |
465 | return; | |
ccefe4c4 TT |
466 | |
467 | gdb_assert (objfile); | |
468 | ||
469 | switch (SYMBOL_CLASS (psym)) | |
470 | { | |
471 | case LOC_STATIC: | |
472 | case LOC_LABEL: | |
473 | case LOC_BLOCK: | |
474 | addr = SYMBOL_VALUE_ADDRESS (psym); | |
475 | break; | |
476 | default: | |
477 | /* Nothing else will be listed in the minsyms -- no use looking | |
478 | it up. */ | |
50da2f25 | 479 | return; |
ccefe4c4 TT |
480 | } |
481 | ||
482 | fixup_section (&psym->ginfo, addr, objfile); | |
ccefe4c4 TT |
483 | } |
484 | ||
485 | static struct symtab * | |
486 | lookup_symbol_aux_psymtabs (struct objfile *objfile, | |
487 | int block_index, const char *name, | |
488 | const domain_enum domain) | |
489 | { | |
490 | struct partial_symtab *ps; | |
491 | const int psymtab_index = (block_index == GLOBAL_BLOCK ? 1 : 0); | |
bfb05775 | 492 | struct symtab *stab_best = NULL; |
ccefe4c4 | 493 | |
b11896a5 | 494 | ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, ps) |
ccefe4c4 | 495 | { |
5c80ed9d TT |
496 | if (!ps->readin && lookup_partial_symbol (objfile, ps, name, |
497 | psymtab_index, domain)) | |
c00f8484 KS |
498 | { |
499 | struct symbol *sym = NULL; | |
5c80ed9d | 500 | struct symtab *stab = psymtab_to_symtab (objfile, ps); |
c00f8484 KS |
501 | |
502 | /* Some caution must be observed with overloaded functions | |
503 | and methods, since the psymtab will not contain any overload | |
504 | information (but NAME might contain it). */ | |
505 | if (stab->primary) | |
506 | { | |
507 | struct blockvector *bv = BLOCKVECTOR (stab); | |
508 | struct block *block = BLOCKVECTOR_BLOCK (bv, block_index); | |
509 | ||
510 | sym = lookup_block_symbol (block, name, domain); | |
511 | } | |
512 | ||
513 | if (sym && strcmp_iw (SYMBOL_SEARCH_NAME (sym), name) == 0) | |
bfb05775 JK |
514 | { |
515 | if (!TYPE_IS_OPAQUE (SYMBOL_TYPE (sym))) | |
516 | return stab; | |
517 | ||
518 | stab_best = stab; | |
519 | } | |
c00f8484 KS |
520 | |
521 | /* Keep looking through other psymtabs. */ | |
522 | } | |
ccefe4c4 TT |
523 | } |
524 | ||
bfb05775 | 525 | return stab_best; |
ccefe4c4 TT |
526 | } |
527 | ||
40658b94 PH |
528 | /* Look in PST for a symbol in DOMAIN whose name matches NAME. Search |
529 | the global block of PST if GLOBAL, and otherwise the static block. | |
530 | MATCH is the comparison operation that returns true iff MATCH (s, | |
531 | NAME), where s is a SYMBOL_SEARCH_NAME. If ORDERED_COMPARE is | |
532 | non-null, the symbols in the block are assumed to be ordered | |
533 | according to it (allowing binary search). It must be compatible | |
534 | with MATCH. Returns the symbol, if found, and otherwise NULL. */ | |
535 | ||
536 | static struct partial_symbol * | |
5c80ed9d TT |
537 | match_partial_symbol (struct objfile *objfile, |
538 | struct partial_symtab *pst, int global, | |
40658b94 | 539 | const char *name, domain_enum domain, |
2edb89d3 JK |
540 | symbol_compare_ftype *match, |
541 | symbol_compare_ftype *ordered_compare) | |
40658b94 PH |
542 | { |
543 | struct partial_symbol **start, **psym; | |
544 | struct partial_symbol **top, **real_top, **bottom, **center; | |
545 | int length = (global ? pst->n_global_syms : pst->n_static_syms); | |
546 | int do_linear_search = 1; | |
547 | ||
548 | if (length == 0) | |
549 | return NULL; | |
550 | start = (global ? | |
5c80ed9d TT |
551 | objfile->global_psymbols.list + pst->globals_offset : |
552 | objfile->static_psymbols.list + pst->statics_offset); | |
40658b94 PH |
553 | |
554 | if (global && ordered_compare) /* Can use a binary search. */ | |
555 | { | |
556 | do_linear_search = 0; | |
557 | ||
558 | /* Binary search. This search is guaranteed to end with center | |
559 | pointing at the earliest partial symbol whose name might be | |
560 | correct. At that point *all* partial symbols with an | |
561 | appropriate name will be checked against the correct | |
562 | domain. */ | |
563 | ||
564 | bottom = start; | |
565 | top = start + length - 1; | |
566 | real_top = top; | |
567 | while (top > bottom) | |
568 | { | |
569 | center = bottom + (top - bottom) / 2; | |
570 | gdb_assert (center < top); | |
571 | if (!do_linear_search | |
572 | && (SYMBOL_LANGUAGE (*center) == language_java)) | |
573 | do_linear_search = 1; | |
574 | if (ordered_compare (SYMBOL_SEARCH_NAME (*center), name) >= 0) | |
575 | top = center; | |
576 | else | |
577 | bottom = center + 1; | |
578 | } | |
579 | gdb_assert (top == bottom); | |
580 | ||
581 | while (top <= real_top | |
582 | && match (SYMBOL_SEARCH_NAME (*top), name) == 0) | |
583 | { | |
584 | if (symbol_matches_domain (SYMBOL_LANGUAGE (*top), | |
585 | SYMBOL_DOMAIN (*top), domain)) | |
586 | return *top; | |
587 | top++; | |
588 | } | |
589 | } | |
590 | ||
591 | /* Can't use a binary search or else we found during the binary search that | |
592 | we should also do a linear search. */ | |
593 | ||
594 | if (do_linear_search) | |
595 | { | |
596 | for (psym = start; psym < start + length; psym++) | |
597 | { | |
598 | if (symbol_matches_domain (SYMBOL_LANGUAGE (*psym), | |
599 | SYMBOL_DOMAIN (*psym), domain) | |
600 | && match (SYMBOL_SEARCH_NAME (*psym), name) == 0) | |
601 | return *psym; | |
602 | } | |
603 | } | |
604 | ||
605 | return NULL; | |
606 | } | |
607 | ||
c00f8484 KS |
608 | /* Returns the name used to search psymtabs. Unlike symtabs, psymtabs do |
609 | not contain any method/function instance information (since this would | |
610 | force reading type information while reading psymtabs). Therefore, | |
611 | if NAME contains overload information, it must be stripped before searching | |
612 | psymtabs. | |
613 | ||
614 | The caller is responsible for freeing the return result. */ | |
615 | ||
616 | static char * | |
617 | psymtab_search_name (const char *name) | |
618 | { | |
619 | switch (current_language->la_language) | |
620 | { | |
621 | case language_cplus: | |
622 | case language_java: | |
623 | { | |
624 | if (strchr (name, '(')) | |
625 | { | |
626 | char *ret = cp_remove_params (name); | |
627 | ||
628 | if (ret) | |
629 | return ret; | |
630 | } | |
631 | } | |
632 | break; | |
633 | ||
634 | default: | |
635 | break; | |
636 | } | |
637 | ||
638 | return xstrdup (name); | |
639 | } | |
640 | ||
ccefe4c4 | 641 | /* Look, in partial_symtab PST, for symbol whose natural name is NAME. |
40658b94 | 642 | Check the global symbols if GLOBAL, the static symbols if not. */ |
ccefe4c4 | 643 | |
18430289 | 644 | static struct partial_symbol * |
5c80ed9d TT |
645 | lookup_partial_symbol (struct objfile *objfile, |
646 | struct partial_symtab *pst, const char *name, | |
ccefe4c4 TT |
647 | int global, domain_enum domain) |
648 | { | |
ccefe4c4 TT |
649 | struct partial_symbol **start, **psym; |
650 | struct partial_symbol **top, **real_top, **bottom, **center; | |
651 | int length = (global ? pst->n_global_syms : pst->n_static_syms); | |
652 | int do_linear_search = 1; | |
c00f8484 KS |
653 | char *search_name; |
654 | struct cleanup *cleanup; | |
ccefe4c4 TT |
655 | |
656 | if (length == 0) | |
657 | { | |
658 | return (NULL); | |
659 | } | |
c00f8484 KS |
660 | |
661 | search_name = psymtab_search_name (name); | |
662 | cleanup = make_cleanup (xfree, search_name); | |
ccefe4c4 | 663 | start = (global ? |
5c80ed9d TT |
664 | objfile->global_psymbols.list + pst->globals_offset : |
665 | objfile->static_psymbols.list + pst->statics_offset); | |
ccefe4c4 | 666 | |
0df8b418 | 667 | if (global) /* This means we can use a binary search. */ |
ccefe4c4 TT |
668 | { |
669 | do_linear_search = 0; | |
670 | ||
671 | /* Binary search. This search is guaranteed to end with center | |
672 | pointing at the earliest partial symbol whose name might be | |
673 | correct. At that point *all* partial symbols with an | |
674 | appropriate name will be checked against the correct | |
675 | domain. */ | |
676 | ||
677 | bottom = start; | |
678 | top = start + length - 1; | |
679 | real_top = top; | |
680 | while (top > bottom) | |
681 | { | |
682 | center = bottom + (top - bottom) / 2; | |
683 | if (!(center < top)) | |
3e43a32a MS |
684 | internal_error (__FILE__, __LINE__, |
685 | _("failed internal consistency check")); | |
ccefe4c4 | 686 | if (!do_linear_search |
40658b94 | 687 | && SYMBOL_LANGUAGE (*center) == language_java) |
ccefe4c4 TT |
688 | { |
689 | do_linear_search = 1; | |
690 | } | |
c00f8484 KS |
691 | if (strcmp_iw_ordered (SYMBOL_SEARCH_NAME (*center), |
692 | search_name) >= 0) | |
ccefe4c4 TT |
693 | { |
694 | top = center; | |
695 | } | |
696 | else | |
697 | { | |
698 | bottom = center + 1; | |
699 | } | |
700 | } | |
701 | if (!(top == bottom)) | |
3e43a32a MS |
702 | internal_error (__FILE__, __LINE__, |
703 | _("failed internal consistency check")); | |
ccefe4c4 | 704 | |
559a7a62 JK |
705 | /* For `case_sensitivity == case_sensitive_off' strcmp_iw_ordered will |
706 | search more exactly than what matches SYMBOL_MATCHES_SEARCH_NAME. */ | |
707 | while (top >= start && SYMBOL_MATCHES_SEARCH_NAME (*top, search_name)) | |
708 | top--; | |
709 | ||
710 | /* Fixup to have a symbol which matches SYMBOL_MATCHES_SEARCH_NAME. */ | |
711 | top++; | |
712 | ||
713 | while (top <= real_top && SYMBOL_MATCHES_SEARCH_NAME (*top, search_name)) | |
ccefe4c4 TT |
714 | { |
715 | if (symbol_matches_domain (SYMBOL_LANGUAGE (*top), | |
716 | SYMBOL_DOMAIN (*top), domain)) | |
c00f8484 KS |
717 | { |
718 | do_cleanups (cleanup); | |
719 | return (*top); | |
720 | } | |
ccefe4c4 TT |
721 | top++; |
722 | } | |
723 | } | |
724 | ||
725 | /* Can't use a binary search or else we found during the binary search that | |
40658b94 | 726 | we should also do a linear search. */ |
ccefe4c4 TT |
727 | |
728 | if (do_linear_search) | |
729 | { | |
730 | for (psym = start; psym < start + length; psym++) | |
731 | { | |
732 | if (symbol_matches_domain (SYMBOL_LANGUAGE (*psym), | |
733 | SYMBOL_DOMAIN (*psym), domain) | |
c00f8484 KS |
734 | && SYMBOL_MATCHES_SEARCH_NAME (*psym, search_name)) |
735 | { | |
736 | do_cleanups (cleanup); | |
737 | return (*psym); | |
738 | } | |
ccefe4c4 TT |
739 | } |
740 | } | |
741 | ||
c00f8484 | 742 | do_cleanups (cleanup); |
ccefe4c4 TT |
743 | return (NULL); |
744 | } | |
745 | ||
746 | /* Get the symbol table that corresponds to a partial_symtab. | |
a2ca7a52 | 747 | This is fast after the first time you do it. */ |
ccefe4c4 TT |
748 | |
749 | static struct symtab * | |
5c80ed9d | 750 | psymtab_to_symtab (struct objfile *objfile, struct partial_symtab *pst) |
ccefe4c4 | 751 | { |
9439a077 TT |
752 | /* If it is a shared psymtab, find an unshared psymtab that includes |
753 | it. Any such psymtab will do. */ | |
754 | while (pst->user != NULL) | |
755 | pst = pst->user; | |
756 | ||
0df8b418 | 757 | /* If it's been looked up before, return it. */ |
ccefe4c4 TT |
758 | if (pst->symtab) |
759 | return pst->symtab; | |
760 | ||
761 | /* If it has not yet been read in, read it. */ | |
762 | if (!pst->readin) | |
763 | { | |
764 | struct cleanup *back_to = increment_reading_symtab (); | |
ad3bbd48 | 765 | |
257e7a09 | 766 | (*pst->read_symtab) (pst, objfile); |
ccefe4c4 TT |
767 | do_cleanups (back_to); |
768 | } | |
769 | ||
770 | return pst->symtab; | |
771 | } | |
772 | ||
773 | static void | |
774 | relocate_psymtabs (struct objfile *objfile, | |
775 | struct section_offsets *new_offsets, | |
776 | struct section_offsets *delta) | |
777 | { | |
778 | struct partial_symbol **psym; | |
779 | struct partial_symtab *p; | |
780 | ||
b11896a5 | 781 | ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, p) |
ccefe4c4 TT |
782 | { |
783 | p->textlow += ANOFFSET (delta, SECT_OFF_TEXT (objfile)); | |
784 | p->texthigh += ANOFFSET (delta, SECT_OFF_TEXT (objfile)); | |
785 | } | |
786 | ||
787 | for (psym = objfile->global_psymbols.list; | |
788 | psym < objfile->global_psymbols.next; | |
789 | psym++) | |
790 | { | |
791 | fixup_psymbol_section (*psym, objfile); | |
792 | if (SYMBOL_SECTION (*psym) >= 0) | |
793 | SYMBOL_VALUE_ADDRESS (*psym) += ANOFFSET (delta, | |
794 | SYMBOL_SECTION (*psym)); | |
795 | } | |
796 | for (psym = objfile->static_psymbols.list; | |
797 | psym < objfile->static_psymbols.next; | |
798 | psym++) | |
799 | { | |
800 | fixup_psymbol_section (*psym, objfile); | |
801 | if (SYMBOL_SECTION (*psym) >= 0) | |
802 | SYMBOL_VALUE_ADDRESS (*psym) += ANOFFSET (delta, | |
803 | SYMBOL_SECTION (*psym)); | |
804 | } | |
805 | } | |
806 | ||
807 | static struct symtab * | |
808 | find_last_source_symtab_from_partial (struct objfile *ofp) | |
809 | { | |
ccefe4c4 TT |
810 | struct partial_symtab *ps; |
811 | struct partial_symtab *cs_pst = 0; | |
812 | ||
b11896a5 | 813 | ALL_OBJFILE_PSYMTABS_REQUIRED (ofp, ps) |
ccefe4c4 TT |
814 | { |
815 | const char *name = ps->filename; | |
816 | int len = strlen (name); | |
ad3bbd48 | 817 | |
ccefe4c4 TT |
818 | if (!(len > 2 && (strcmp (&name[len - 2], ".h") == 0 |
819 | || strcmp (name, "<<C++-namespaces>>") == 0))) | |
820 | cs_pst = ps; | |
821 | } | |
822 | ||
823 | if (cs_pst) | |
824 | { | |
825 | if (cs_pst->readin) | |
826 | { | |
827 | internal_error (__FILE__, __LINE__, | |
828 | _("select_source_symtab: " | |
829 | "readin pst found and no symtabs.")); | |
830 | } | |
831 | else | |
5c80ed9d | 832 | return psymtab_to_symtab (ofp, cs_pst); |
ccefe4c4 TT |
833 | } |
834 | return NULL; | |
835 | } | |
836 | ||
837 | static void | |
838 | forget_cached_source_info_partial (struct objfile *objfile) | |
839 | { | |
840 | struct partial_symtab *pst; | |
841 | ||
b11896a5 | 842 | ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, pst) |
ccefe4c4 TT |
843 | { |
844 | if (pst->fullname != NULL) | |
845 | { | |
846 | xfree (pst->fullname); | |
847 | pst->fullname = NULL; | |
848 | } | |
849 | } | |
850 | } | |
851 | ||
852 | static void | |
853 | print_partial_symbols (struct gdbarch *gdbarch, | |
854 | struct partial_symbol **p, int count, char *what, | |
855 | struct ui_file *outfile) | |
856 | { | |
857 | fprintf_filtered (outfile, " %s partial symbols:\n", what); | |
858 | while (count-- > 0) | |
859 | { | |
27618ce4 | 860 | QUIT; |
ccefe4c4 TT |
861 | fprintf_filtered (outfile, " `%s'", SYMBOL_LINKAGE_NAME (*p)); |
862 | if (SYMBOL_DEMANGLED_NAME (*p) != NULL) | |
863 | { | |
864 | fprintf_filtered (outfile, " `%s'", SYMBOL_DEMANGLED_NAME (*p)); | |
865 | } | |
866 | fputs_filtered (", ", outfile); | |
867 | switch (SYMBOL_DOMAIN (*p)) | |
868 | { | |
869 | case UNDEF_DOMAIN: | |
870 | fputs_filtered ("undefined domain, ", outfile); | |
871 | break; | |
872 | case VAR_DOMAIN: | |
0df8b418 | 873 | /* This is the usual thing -- don't print it. */ |
ccefe4c4 TT |
874 | break; |
875 | case STRUCT_DOMAIN: | |
876 | fputs_filtered ("struct domain, ", outfile); | |
877 | break; | |
878 | case LABEL_DOMAIN: | |
879 | fputs_filtered ("label domain, ", outfile); | |
880 | break; | |
881 | default: | |
882 | fputs_filtered ("<invalid domain>, ", outfile); | |
883 | break; | |
884 | } | |
885 | switch (SYMBOL_CLASS (*p)) | |
886 | { | |
887 | case LOC_UNDEF: | |
888 | fputs_filtered ("undefined", outfile); | |
889 | break; | |
890 | case LOC_CONST: | |
891 | fputs_filtered ("constant int", outfile); | |
892 | break; | |
893 | case LOC_STATIC: | |
894 | fputs_filtered ("static", outfile); | |
895 | break; | |
896 | case LOC_REGISTER: | |
897 | fputs_filtered ("register", outfile); | |
898 | break; | |
899 | case LOC_ARG: | |
900 | fputs_filtered ("pass by value", outfile); | |
901 | break; | |
902 | case LOC_REF_ARG: | |
903 | fputs_filtered ("pass by reference", outfile); | |
904 | break; | |
905 | case LOC_REGPARM_ADDR: | |
906 | fputs_filtered ("register address parameter", outfile); | |
907 | break; | |
908 | case LOC_LOCAL: | |
909 | fputs_filtered ("stack parameter", outfile); | |
910 | break; | |
911 | case LOC_TYPEDEF: | |
912 | fputs_filtered ("type", outfile); | |
913 | break; | |
914 | case LOC_LABEL: | |
915 | fputs_filtered ("label", outfile); | |
916 | break; | |
917 | case LOC_BLOCK: | |
918 | fputs_filtered ("function", outfile); | |
919 | break; | |
920 | case LOC_CONST_BYTES: | |
921 | fputs_filtered ("constant bytes", outfile); | |
922 | break; | |
923 | case LOC_UNRESOLVED: | |
924 | fputs_filtered ("unresolved", outfile); | |
925 | break; | |
926 | case LOC_OPTIMIZED_OUT: | |
927 | fputs_filtered ("optimized out", outfile); | |
928 | break; | |
929 | case LOC_COMPUTED: | |
930 | fputs_filtered ("computed at runtime", outfile); | |
931 | break; | |
932 | default: | |
933 | fputs_filtered ("<invalid location>", outfile); | |
934 | break; | |
935 | } | |
936 | fputs_filtered (", ", outfile); | |
937 | fputs_filtered (paddress (gdbarch, SYMBOL_VALUE_ADDRESS (*p)), outfile); | |
938 | fprintf_filtered (outfile, "\n"); | |
939 | p++; | |
940 | } | |
941 | } | |
942 | ||
943 | static void | |
944 | dump_psymtab (struct objfile *objfile, struct partial_symtab *psymtab, | |
945 | struct ui_file *outfile) | |
946 | { | |
947 | struct gdbarch *gdbarch = get_objfile_arch (objfile); | |
948 | int i; | |
949 | ||
b4c41fc7 DE |
950 | if (psymtab->anonymous) |
951 | { | |
952 | fprintf_filtered (outfile, "\nAnonymous partial symtab (%s) ", | |
953 | psymtab->filename); | |
954 | } | |
955 | else | |
956 | { | |
957 | fprintf_filtered (outfile, "\nPartial symtab for source file %s ", | |
958 | psymtab->filename); | |
959 | } | |
ccefe4c4 TT |
960 | fprintf_filtered (outfile, "(object "); |
961 | gdb_print_host_address (psymtab, outfile); | |
962 | fprintf_filtered (outfile, ")\n\n"); | |
963 | fprintf_unfiltered (outfile, " Read from object file %s (", | |
964 | objfile->name); | |
965 | gdb_print_host_address (objfile, outfile); | |
966 | fprintf_unfiltered (outfile, ")\n"); | |
967 | ||
968 | if (psymtab->readin) | |
969 | { | |
970 | fprintf_filtered (outfile, | |
971 | " Full symtab was read (at "); | |
972 | gdb_print_host_address (psymtab->symtab, outfile); | |
973 | fprintf_filtered (outfile, " by function at "); | |
974 | gdb_print_host_address (psymtab->read_symtab, outfile); | |
975 | fprintf_filtered (outfile, ")\n"); | |
976 | } | |
977 | ||
978 | fprintf_filtered (outfile, " Relocate symbols by "); | |
5c80ed9d | 979 | for (i = 0; i < objfile->num_sections; ++i) |
ccefe4c4 TT |
980 | { |
981 | if (i != 0) | |
982 | fprintf_filtered (outfile, ", "); | |
983 | wrap_here (" "); | |
984 | fputs_filtered (paddress (gdbarch, | |
985 | ANOFFSET (psymtab->section_offsets, i)), | |
986 | outfile); | |
987 | } | |
988 | fprintf_filtered (outfile, "\n"); | |
989 | ||
990 | fprintf_filtered (outfile, " Symbols cover text addresses "); | |
991 | fputs_filtered (paddress (gdbarch, psymtab->textlow), outfile); | |
992 | fprintf_filtered (outfile, "-"); | |
993 | fputs_filtered (paddress (gdbarch, psymtab->texthigh), outfile); | |
994 | fprintf_filtered (outfile, "\n"); | |
9750bca9 JK |
995 | fprintf_filtered (outfile, " Address map supported - %s.\n", |
996 | psymtab->psymtabs_addrmap_supported ? "yes" : "no"); | |
ccefe4c4 TT |
997 | fprintf_filtered (outfile, " Depends on %d other partial symtabs.\n", |
998 | psymtab->number_of_dependencies); | |
999 | for (i = 0; i < psymtab->number_of_dependencies; i++) | |
1000 | { | |
1001 | fprintf_filtered (outfile, " %d ", i); | |
1002 | gdb_print_host_address (psymtab->dependencies[i], outfile); | |
1003 | fprintf_filtered (outfile, " %s\n", | |
1004 | psymtab->dependencies[i]->filename); | |
1005 | } | |
9439a077 TT |
1006 | if (psymtab->user != NULL) |
1007 | { | |
1008 | fprintf_filtered (outfile, " Shared partial symtab with user "); | |
1009 | gdb_print_host_address (psymtab->user, outfile); | |
1010 | fprintf_filtered (outfile, "\n"); | |
1011 | } | |
ccefe4c4 TT |
1012 | if (psymtab->n_global_syms > 0) |
1013 | { | |
1014 | print_partial_symbols (gdbarch, | |
1015 | objfile->global_psymbols.list | |
1016 | + psymtab->globals_offset, | |
1017 | psymtab->n_global_syms, "Global", outfile); | |
1018 | } | |
1019 | if (psymtab->n_static_syms > 0) | |
1020 | { | |
1021 | print_partial_symbols (gdbarch, | |
1022 | objfile->static_psymbols.list | |
1023 | + psymtab->statics_offset, | |
1024 | psymtab->n_static_syms, "Static", outfile); | |
1025 | } | |
1026 | fprintf_filtered (outfile, "\n"); | |
1027 | } | |
1028 | ||
1029 | static void | |
1030 | print_psymtab_stats_for_objfile (struct objfile *objfile) | |
1031 | { | |
1032 | int i; | |
1033 | struct partial_symtab *ps; | |
ad3bbd48 | 1034 | |
ccefe4c4 | 1035 | i = 0; |
b11896a5 | 1036 | ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, ps) |
ccefe4c4 TT |
1037 | { |
1038 | if (ps->readin == 0) | |
1039 | i++; | |
1040 | } | |
1041 | printf_filtered (_(" Number of psym tables (not yet expanded): %d\n"), i); | |
1042 | } | |
1043 | ||
1044 | static void | |
1045 | dump_psymtabs_for_objfile (struct objfile *objfile) | |
1046 | { | |
1047 | struct partial_symtab *psymtab; | |
1048 | ||
1049 | if (objfile->psymtabs) | |
1050 | { | |
1051 | printf_filtered ("Psymtabs:\n"); | |
1052 | for (psymtab = objfile->psymtabs; | |
1053 | psymtab != NULL; | |
1054 | psymtab = psymtab->next) | |
1055 | { | |
1056 | printf_filtered ("%s at ", | |
1057 | psymtab->filename); | |
1058 | gdb_print_host_address (psymtab, gdb_stdout); | |
1059 | printf_filtered (", "); | |
ccefe4c4 TT |
1060 | wrap_here (" "); |
1061 | } | |
1062 | printf_filtered ("\n\n"); | |
1063 | } | |
1064 | } | |
1065 | ||
1066 | /* Look through the partial symtabs for all symbols which begin | |
0df8b418 | 1067 | by matching FUNC_NAME. Make sure we read that symbol table in. */ |
ccefe4c4 TT |
1068 | |
1069 | static void | |
1070 | read_symtabs_for_function (struct objfile *objfile, const char *func_name) | |
1071 | { | |
1072 | struct partial_symtab *ps; | |
1073 | ||
b11896a5 | 1074 | ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, ps) |
ccefe4c4 TT |
1075 | { |
1076 | if (ps->readin) | |
1077 | continue; | |
1078 | ||
5c80ed9d | 1079 | if ((lookup_partial_symbol (objfile, ps, func_name, 1, VAR_DOMAIN) |
ccefe4c4 | 1080 | != NULL) |
5c80ed9d | 1081 | || (lookup_partial_symbol (objfile, ps, func_name, 0, VAR_DOMAIN) |
ccefe4c4 | 1082 | != NULL)) |
5c80ed9d | 1083 | psymtab_to_symtab (objfile, ps); |
ccefe4c4 TT |
1084 | } |
1085 | } | |
1086 | ||
1087 | static void | |
1088 | expand_partial_symbol_tables (struct objfile *objfile) | |
1089 | { | |
1090 | struct partial_symtab *psymtab; | |
1091 | ||
b11896a5 | 1092 | ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, psymtab) |
ccefe4c4 | 1093 | { |
5c80ed9d | 1094 | psymtab_to_symtab (objfile, psymtab); |
ccefe4c4 TT |
1095 | } |
1096 | } | |
1097 | ||
1098 | static void | |
1099 | read_psymtabs_with_filename (struct objfile *objfile, const char *filename) | |
1100 | { | |
1101 | struct partial_symtab *p; | |
1102 | ||
b11896a5 | 1103 | ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, p) |
ccefe4c4 | 1104 | { |
b4c41fc7 DE |
1105 | /* Anonymous psymtabs don't have a name of a source file. */ |
1106 | if (p->anonymous) | |
1107 | continue; | |
1108 | ||
0ba1096a | 1109 | if (filename_cmp (filename, p->filename) == 0) |
5c80ed9d | 1110 | psymtab_to_symtab (objfile, p); |
ccefe4c4 TT |
1111 | } |
1112 | } | |
1113 | ||
ccefe4c4 TT |
1114 | static void |
1115 | map_symbol_filenames_psymtab (struct objfile *objfile, | |
74e2f255 DE |
1116 | symbol_filename_ftype *fun, void *data, |
1117 | int need_fullname) | |
ccefe4c4 TT |
1118 | { |
1119 | struct partial_symtab *ps; | |
1120 | ||
b11896a5 | 1121 | ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, ps) |
ccefe4c4 TT |
1122 | { |
1123 | const char *fullname; | |
1124 | ||
1125 | if (ps->readin) | |
1126 | continue; | |
1127 | ||
f80c6f3f DE |
1128 | /* We can skip shared psymtabs here, because any file name will be |
1129 | attached to the unshared psymtab. */ | |
1130 | if (ps->user != NULL) | |
1131 | continue; | |
1132 | ||
b4c41fc7 DE |
1133 | /* Anonymous psymtabs don't have a file name. */ |
1134 | if (ps->anonymous) | |
1135 | continue; | |
1136 | ||
821296b7 | 1137 | QUIT; |
74e2f255 DE |
1138 | if (need_fullname) |
1139 | fullname = psymtab_to_fullname (ps); | |
1140 | else | |
1141 | fullname = NULL; | |
2837d59e | 1142 | (*fun) (ps->filename, fullname, data); |
ccefe4c4 TT |
1143 | } |
1144 | } | |
1145 | ||
ccefe4c4 TT |
1146 | /* Finds the fullname that a partial_symtab represents. |
1147 | ||
1148 | If this functions finds the fullname, it will save it in ps->fullname | |
1149 | and it will also return the value. | |
1150 | ||
1151 | If this function fails to find the file that this partial_symtab represents, | |
1152 | NULL will be returned and ps->fullname will be set to NULL. */ | |
256f06f3 | 1153 | |
da5132d3 | 1154 | static const char * |
ccefe4c4 TT |
1155 | psymtab_to_fullname (struct partial_symtab *ps) |
1156 | { | |
1157 | int r; | |
1158 | ||
1159 | if (!ps) | |
1160 | return NULL; | |
b4c41fc7 DE |
1161 | if (ps->anonymous) |
1162 | return NULL; | |
ccefe4c4 | 1163 | |
256f06f3 DE |
1164 | /* Use cached copy if we have it. |
1165 | We rely on forget_cached_source_info being called appropriately | |
1166 | to handle cases like the file being moved. */ | |
1167 | if (ps->fullname) | |
1168 | return ps->fullname; | |
1169 | ||
ccefe4c4 TT |
1170 | r = find_and_open_source (ps->filename, ps->dirname, &ps->fullname); |
1171 | ||
1172 | if (r >= 0) | |
1173 | { | |
1174 | close (r); | |
1175 | return ps->fullname; | |
1176 | } | |
1177 | ||
1178 | return NULL; | |
1179 | } | |
1180 | ||
dd786858 | 1181 | static const char * |
ccefe4c4 TT |
1182 | find_symbol_file_from_partial (struct objfile *objfile, const char *name) |
1183 | { | |
1184 | struct partial_symtab *pst; | |
1185 | ||
b11896a5 | 1186 | ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, pst) |
ccefe4c4 | 1187 | { |
5c80ed9d | 1188 | if (lookup_partial_symbol (objfile, pst, name, 1, VAR_DOMAIN)) |
ccefe4c4 TT |
1189 | return pst->filename; |
1190 | } | |
1191 | return NULL; | |
1192 | } | |
1193 | ||
40658b94 PH |
1194 | /* For all symbols, s, in BLOCK that are in NAMESPACE and match NAME |
1195 | according to the function MATCH, call CALLBACK(BLOCK, s, DATA). | |
1196 | BLOCK is assumed to come from OBJFILE. Returns 1 iff CALLBACK | |
1197 | ever returns non-zero, and otherwise returns 0. */ | |
ccefe4c4 | 1198 | |
40658b94 PH |
1199 | static int |
1200 | map_block (const char *name, domain_enum namespace, struct objfile *objfile, | |
1201 | struct block *block, | |
1202 | int (*callback) (struct block *, struct symbol *, void *), | |
2edb89d3 | 1203 | void *data, symbol_compare_ftype *match) |
ccefe4c4 | 1204 | { |
8157b174 | 1205 | struct block_iterator iter; |
40658b94 | 1206 | struct symbol *sym; |
ccefe4c4 | 1207 | |
8157b174 TT |
1208 | for (sym = block_iter_match_first (block, name, match, &iter); |
1209 | sym != NULL; sym = block_iter_match_next (name, match, &iter)) | |
ccefe4c4 | 1210 | { |
40658b94 PH |
1211 | if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), |
1212 | SYMBOL_DOMAIN (sym), namespace)) | |
1213 | { | |
1214 | if (callback (block, sym, data)) | |
1215 | return 1; | |
1216 | } | |
ccefe4c4 TT |
1217 | } |
1218 | ||
40658b94 | 1219 | return 0; |
ccefe4c4 TT |
1220 | } |
1221 | ||
40658b94 PH |
1222 | /* Psymtab version of map_matching_symbols. See its definition in |
1223 | the definition of quick_symbol_functions in symfile.h. */ | |
1224 | ||
ccefe4c4 | 1225 | static void |
40658b94 PH |
1226 | map_matching_symbols_psymtab (const char *name, domain_enum namespace, |
1227 | struct objfile *objfile, int global, | |
1228 | int (*callback) (struct block *, | |
1229 | struct symbol *, void *), | |
1230 | void *data, | |
2edb89d3 JK |
1231 | symbol_compare_ftype *match, |
1232 | symbol_compare_ftype *ordered_compare) | |
ccefe4c4 | 1233 | { |
40658b94 | 1234 | const int block_kind = global ? GLOBAL_BLOCK : STATIC_BLOCK; |
ccefe4c4 TT |
1235 | struct partial_symtab *ps; |
1236 | ||
b11896a5 | 1237 | ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, ps) |
ccefe4c4 TT |
1238 | { |
1239 | QUIT; | |
1240 | if (ps->readin | |
5c80ed9d | 1241 | || match_partial_symbol (objfile, ps, global, name, namespace, match, |
40658b94 | 1242 | ordered_compare)) |
ccefe4c4 | 1243 | { |
5c80ed9d | 1244 | struct symtab *s = psymtab_to_symtab (objfile, ps); |
40658b94 | 1245 | struct block *block; |
ad3bbd48 | 1246 | |
ccefe4c4 TT |
1247 | if (s == NULL || !s->primary) |
1248 | continue; | |
40658b94 PH |
1249 | block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), block_kind); |
1250 | if (map_block (name, namespace, objfile, block, | |
1251 | callback, data, match)) | |
1252 | return; | |
1253 | if (callback (block, NULL, data)) | |
1254 | return; | |
ccefe4c4 TT |
1255 | } |
1256 | } | |
40658b94 | 1257 | } |
ccefe4c4 | 1258 | |
9439a077 TT |
1259 | /* A helper for expand_symtabs_matching_via_partial that handles |
1260 | searching included psymtabs. This returns 1 if a symbol is found, | |
1261 | and zero otherwise. It also updates the 'searched_flag' on the | |
1262 | various psymtabs that it searches. */ | |
1263 | ||
1264 | static int | |
1265 | recursively_search_psymtabs (struct partial_symtab *ps, | |
1266 | struct objfile *objfile, | |
1267 | enum search_domain kind, | |
1268 | int (*name_matcher) (const char *, void *), | |
1269 | void *data) | |
1270 | { | |
1271 | struct partial_symbol **psym; | |
1272 | struct partial_symbol **bound, **gbound, **sbound; | |
1273 | int keep_going = 1; | |
1274 | int result = PST_SEARCHED_AND_NOT_FOUND; | |
1275 | int i; | |
1276 | ||
1277 | if (ps->searched_flag != PST_NOT_SEARCHED) | |
1278 | return ps->searched_flag == PST_SEARCHED_AND_FOUND; | |
1279 | ||
1280 | /* Recurse into shared psymtabs first, because they may have already | |
1281 | been searched, and this could save some time. */ | |
1282 | for (i = 0; i < ps->number_of_dependencies; ++i) | |
1283 | { | |
1284 | int r; | |
1285 | ||
1286 | /* Skip non-shared dependencies, these are handled elsewhere. */ | |
1287 | if (ps->dependencies[i]->user == NULL) | |
1288 | continue; | |
1289 | ||
1290 | r = recursively_search_psymtabs (ps->dependencies[i], | |
1291 | objfile, kind, name_matcher, data); | |
1292 | if (r != 0) | |
1293 | { | |
1294 | ps->searched_flag = PST_SEARCHED_AND_FOUND; | |
1295 | return 1; | |
1296 | } | |
1297 | } | |
1298 | ||
1299 | gbound = (objfile->global_psymbols.list | |
1300 | + ps->globals_offset + ps->n_global_syms); | |
1301 | sbound = (objfile->static_psymbols.list | |
1302 | + ps->statics_offset + ps->n_static_syms); | |
1303 | bound = gbound; | |
1304 | ||
1305 | /* Go through all of the symbols stored in a partial | |
1306 | symtab in one loop. */ | |
1307 | psym = objfile->global_psymbols.list + ps->globals_offset; | |
1308 | while (keep_going) | |
1309 | { | |
1310 | if (psym >= bound) | |
1311 | { | |
1312 | if (bound == gbound && ps->n_static_syms != 0) | |
1313 | { | |
1314 | psym = objfile->static_psymbols.list + ps->statics_offset; | |
1315 | bound = sbound; | |
1316 | } | |
1317 | else | |
1318 | keep_going = 0; | |
1319 | continue; | |
1320 | } | |
1321 | else | |
1322 | { | |
1323 | QUIT; | |
1324 | ||
1325 | if ((kind == ALL_DOMAIN | |
1326 | || (kind == VARIABLES_DOMAIN | |
1327 | && SYMBOL_CLASS (*psym) != LOC_TYPEDEF | |
1328 | && SYMBOL_CLASS (*psym) != LOC_BLOCK) | |
1329 | || (kind == FUNCTIONS_DOMAIN | |
1330 | && SYMBOL_CLASS (*psym) == LOC_BLOCK) | |
1331 | || (kind == TYPES_DOMAIN | |
1332 | && SYMBOL_CLASS (*psym) == LOC_TYPEDEF)) | |
1333 | && (*name_matcher) (SYMBOL_SEARCH_NAME (*psym), data)) | |
1334 | { | |
1335 | /* Found a match, so notify our caller. */ | |
1336 | result = PST_SEARCHED_AND_FOUND; | |
1337 | keep_going = 0; | |
1338 | } | |
1339 | } | |
1340 | psym++; | |
1341 | } | |
1342 | ||
1343 | ps->searched_flag = result; | |
1344 | return result == PST_SEARCHED_AND_FOUND; | |
1345 | } | |
1346 | ||
ccefe4c4 | 1347 | static void |
f8eba3c6 TT |
1348 | expand_symtabs_matching_via_partial |
1349 | (struct objfile *objfile, | |
1350 | int (*file_matcher) (const char *, void *), | |
e078317b | 1351 | int (*name_matcher) (const char *, void *), |
f8eba3c6 TT |
1352 | enum search_domain kind, |
1353 | void *data) | |
ccefe4c4 TT |
1354 | { |
1355 | struct partial_symtab *ps; | |
1356 | ||
9439a077 | 1357 | /* Clear the search flags. */ |
b11896a5 | 1358 | ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, ps) |
ccefe4c4 | 1359 | { |
9439a077 TT |
1360 | ps->searched_flag = PST_NOT_SEARCHED; |
1361 | } | |
ccefe4c4 | 1362 | |
9439a077 TT |
1363 | ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, ps) |
1364 | { | |
ccefe4c4 TT |
1365 | if (ps->readin) |
1366 | continue; | |
1367 | ||
9439a077 TT |
1368 | /* We skip shared psymtabs because file-matching doesn't apply |
1369 | to them; but we search them later in the loop. */ | |
1370 | if (ps->user != NULL) | |
ccefe4c4 TT |
1371 | continue; |
1372 | ||
b4c41fc7 DE |
1373 | if (file_matcher) |
1374 | { | |
1375 | if (ps->anonymous) | |
1376 | continue; | |
1377 | if (! (*file_matcher) (ps->filename, data)) | |
1378 | continue; | |
1379 | } | |
ccefe4c4 | 1380 | |
9439a077 | 1381 | if (recursively_search_psymtabs (ps, objfile, kind, name_matcher, data)) |
5c80ed9d | 1382 | psymtab_to_symtab (objfile, ps); |
ccefe4c4 TT |
1383 | } |
1384 | } | |
1385 | ||
1386 | static int | |
1387 | objfile_has_psyms (struct objfile *objfile) | |
1388 | { | |
1389 | return objfile->psymtabs != NULL; | |
1390 | } | |
1391 | ||
1392 | const struct quick_symbol_functions psym_functions = | |
1393 | { | |
1394 | objfile_has_psyms, | |
1395 | find_last_source_symtab_from_partial, | |
1396 | forget_cached_source_info_partial, | |
f8eba3c6 | 1397 | partial_map_symtabs_matching_filename, |
ccefe4c4 TT |
1398 | lookup_symbol_aux_psymtabs, |
1399 | print_psymtab_stats_for_objfile, | |
1400 | dump_psymtabs_for_objfile, | |
1401 | relocate_psymtabs, | |
1402 | read_symtabs_for_function, | |
1403 | expand_partial_symbol_tables, | |
1404 | read_psymtabs_with_filename, | |
1405 | find_symbol_file_from_partial, | |
40658b94 | 1406 | map_matching_symbols_psymtab, |
ccefe4c4 TT |
1407 | expand_symtabs_matching_via_partial, |
1408 | find_pc_sect_symtab_from_partial, | |
ccefe4c4 TT |
1409 | map_symbol_filenames_psymtab |
1410 | }; | |
1411 | ||
1412 | \f | |
1413 | ||
1414 | /* This compares two partial symbols by names, using strcmp_iw_ordered | |
1415 | for the comparison. */ | |
1416 | ||
1417 | static int | |
1418 | compare_psymbols (const void *s1p, const void *s2p) | |
1419 | { | |
1420 | struct partial_symbol *const *s1 = s1p; | |
1421 | struct partial_symbol *const *s2 = s2p; | |
1422 | ||
1423 | return strcmp_iw_ordered (SYMBOL_SEARCH_NAME (*s1), | |
1424 | SYMBOL_SEARCH_NAME (*s2)); | |
1425 | } | |
1426 | ||
1427 | void | |
5c80ed9d | 1428 | sort_pst_symbols (struct objfile *objfile, struct partial_symtab *pst) |
ccefe4c4 | 1429 | { |
0df8b418 | 1430 | /* Sort the global list; don't sort the static list. */ |
ccefe4c4 | 1431 | |
5c80ed9d | 1432 | qsort (objfile->global_psymbols.list + pst->globals_offset, |
ccefe4c4 TT |
1433 | pst->n_global_syms, sizeof (struct partial_symbol *), |
1434 | compare_psymbols); | |
1435 | } | |
1436 | ||
1437 | /* Allocate and partially fill a partial symtab. It will be | |
1438 | completely filled at the end of the symbol list. | |
1439 | ||
0df8b418 | 1440 | FILENAME is the name of the symbol-file we are reading from. */ |
ccefe4c4 TT |
1441 | |
1442 | struct partial_symtab * | |
1443 | start_psymtab_common (struct objfile *objfile, | |
1444 | struct section_offsets *section_offsets, | |
1445 | const char *filename, | |
1446 | CORE_ADDR textlow, struct partial_symbol **global_syms, | |
1447 | struct partial_symbol **static_syms) | |
1448 | { | |
1449 | struct partial_symtab *psymtab; | |
1450 | ||
1451 | psymtab = allocate_psymtab (filename, objfile); | |
1452 | psymtab->section_offsets = section_offsets; | |
1453 | psymtab->textlow = textlow; | |
1454 | psymtab->texthigh = psymtab->textlow; /* default */ | |
1455 | psymtab->globals_offset = global_syms - objfile->global_psymbols.list; | |
1456 | psymtab->statics_offset = static_syms - objfile->static_psymbols.list; | |
1457 | return (psymtab); | |
1458 | } | |
1459 | ||
cbd70537 SW |
1460 | /* Calculate a hash code for the given partial symbol. The hash is |
1461 | calculated using the symbol's value, language, domain, class | |
0df8b418 | 1462 | and name. These are the values which are set by |
cbd70537 SW |
1463 | add_psymbol_to_bcache. */ |
1464 | ||
710e1a31 | 1465 | static unsigned long |
cbd70537 SW |
1466 | psymbol_hash (const void *addr, int length) |
1467 | { | |
1468 | unsigned long h = 0; | |
1469 | struct partial_symbol *psymbol = (struct partial_symbol *) addr; | |
1470 | unsigned int lang = psymbol->ginfo.language; | |
1471 | unsigned int domain = PSYMBOL_DOMAIN (psymbol); | |
1472 | unsigned int class = PSYMBOL_CLASS (psymbol); | |
1473 | ||
1474 | h = hash_continue (&psymbol->ginfo.value, sizeof (psymbol->ginfo.value), h); | |
1475 | h = hash_continue (&lang, sizeof (unsigned int), h); | |
1476 | h = hash_continue (&domain, sizeof (unsigned int), h); | |
1477 | h = hash_continue (&class, sizeof (unsigned int), h); | |
1478 | h = hash_continue (psymbol->ginfo.name, strlen (psymbol->ginfo.name), h); | |
1479 | ||
1480 | return h; | |
1481 | } | |
1482 | ||
1483 | /* Returns true if the symbol at addr1 equals the symbol at addr2. | |
1484 | For the comparison this function uses a symbols value, | |
1485 | language, domain, class and name. */ | |
1486 | ||
710e1a31 | 1487 | static int |
cbd70537 SW |
1488 | psymbol_compare (const void *addr1, const void *addr2, int length) |
1489 | { | |
1490 | struct partial_symbol *sym1 = (struct partial_symbol *) addr1; | |
1491 | struct partial_symbol *sym2 = (struct partial_symbol *) addr2; | |
1492 | ||
1493 | return (memcmp (&sym1->ginfo.value, &sym1->ginfo.value, | |
1494 | sizeof (sym1->ginfo.value)) == 0 | |
1495 | && sym1->ginfo.language == sym2->ginfo.language | |
1496 | && PSYMBOL_DOMAIN (sym1) == PSYMBOL_DOMAIN (sym2) | |
1497 | && PSYMBOL_CLASS (sym1) == PSYMBOL_CLASS (sym2) | |
1498 | && sym1->ginfo.name == sym2->ginfo.name); | |
1499 | } | |
1500 | ||
710e1a31 SW |
1501 | /* Initialize a partial symbol bcache. */ |
1502 | ||
1503 | struct psymbol_bcache * | |
1504 | psymbol_bcache_init (void) | |
1505 | { | |
1506 | struct psymbol_bcache *bcache = XCALLOC (1, struct psymbol_bcache); | |
1507 | bcache->bcache = bcache_xmalloc (psymbol_hash, psymbol_compare); | |
1508 | return bcache; | |
1509 | } | |
1510 | ||
1511 | /* Free a partial symbol bcache. */ | |
1512 | void | |
1513 | psymbol_bcache_free (struct psymbol_bcache *bcache) | |
1514 | { | |
1515 | if (bcache == NULL) | |
1516 | return; | |
1517 | ||
1518 | bcache_xfree (bcache->bcache); | |
1519 | xfree (bcache); | |
1520 | } | |
1521 | ||
0df8b418 | 1522 | /* Return the internal bcache of the psymbol_bcache BCACHE. */ |
710e1a31 SW |
1523 | |
1524 | struct bcache * | |
1525 | psymbol_bcache_get_bcache (struct psymbol_bcache *bcache) | |
1526 | { | |
1527 | return bcache->bcache; | |
1528 | } | |
1529 | ||
1530 | /* Find a copy of the SYM in BCACHE. If BCACHE has never seen this | |
1531 | symbol before, add a copy to BCACHE. In either case, return a pointer | |
1532 | to BCACHE's copy of the symbol. If optional ADDED is not NULL, return | |
1533 | 1 in case of new entry or 0 if returning an old entry. */ | |
1534 | ||
1535 | static const struct partial_symbol * | |
1536 | psymbol_bcache_full (struct partial_symbol *sym, | |
1537 | struct psymbol_bcache *bcache, | |
1538 | int *added) | |
1539 | { | |
1540 | return bcache_full (sym, | |
1541 | sizeof (struct partial_symbol), | |
1542 | bcache->bcache, | |
1543 | added); | |
1544 | } | |
1545 | ||
ccefe4c4 TT |
1546 | /* Helper function, initialises partial symbol structure and stashes |
1547 | it into objfile's bcache. Note that our caching mechanism will | |
1548 | use all fields of struct partial_symbol to determine hash value of the | |
1549 | structure. In other words, having two symbols with the same name but | |
1550 | different domain (or address) is possible and correct. */ | |
1551 | ||
1552 | static const struct partial_symbol * | |
72b9f47f | 1553 | add_psymbol_to_bcache (const char *name, int namelength, int copy_name, |
ccefe4c4 TT |
1554 | domain_enum domain, |
1555 | enum address_class class, | |
1556 | long val, /* Value as a long */ | |
1557 | CORE_ADDR coreaddr, /* Value as a CORE_ADDR */ | |
1558 | enum language language, struct objfile *objfile, | |
1559 | int *added) | |
1560 | { | |
cbd70537 SW |
1561 | struct partial_symbol psymbol; |
1562 | ||
fc956729 SW |
1563 | /* We must ensure that the entire 'value' field has been zeroed |
1564 | before assigning to it, because an assignment may not write the | |
1565 | entire field. */ | |
1566 | memset (&psymbol.ginfo.value, 0, sizeof (psymbol.ginfo.value)); | |
1567 | ||
0df8b418 | 1568 | /* val and coreaddr are mutually exclusive, one of them *will* be zero. */ |
ccefe4c4 TT |
1569 | if (val != 0) |
1570 | { | |
1571 | SYMBOL_VALUE (&psymbol) = val; | |
1572 | } | |
1573 | else | |
1574 | { | |
1575 | SYMBOL_VALUE_ADDRESS (&psymbol) = coreaddr; | |
1576 | } | |
1577 | SYMBOL_SECTION (&psymbol) = 0; | |
fc956729 | 1578 | SYMBOL_OBJ_SECTION (&psymbol) = NULL; |
33e5013e | 1579 | SYMBOL_SET_LANGUAGE (&psymbol, language); |
ccefe4c4 TT |
1580 | PSYMBOL_DOMAIN (&psymbol) = domain; |
1581 | PSYMBOL_CLASS (&psymbol) = class; | |
1582 | ||
1583 | SYMBOL_SET_NAMES (&psymbol, name, namelength, copy_name, objfile); | |
1584 | ||
0df8b418 | 1585 | /* Stash the partial symbol away in the cache. */ |
710e1a31 SW |
1586 | return psymbol_bcache_full (&psymbol, |
1587 | objfile->psymbol_cache, | |
1588 | added); | |
ccefe4c4 TT |
1589 | } |
1590 | ||
923c6a3d | 1591 | /* Increase the space allocated for LISTP, which is probably |
0df8b418 | 1592 | global_psymbols or static_psymbols. This space will eventually |
923c6a3d TT |
1593 | be freed in free_objfile(). */ |
1594 | ||
1595 | static void | |
1596 | extend_psymbol_list (struct psymbol_allocation_list *listp, | |
1597 | struct objfile *objfile) | |
1598 | { | |
1599 | int new_size; | |
1600 | ||
1601 | if (listp->size == 0) | |
1602 | { | |
1603 | new_size = 255; | |
1604 | listp->list = (struct partial_symbol **) | |
1605 | xmalloc (new_size * sizeof (struct partial_symbol *)); | |
1606 | } | |
1607 | else | |
1608 | { | |
1609 | new_size = listp->size * 2; | |
1610 | listp->list = (struct partial_symbol **) | |
1611 | xrealloc ((char *) listp->list, | |
1612 | new_size * sizeof (struct partial_symbol *)); | |
1613 | } | |
1614 | /* Next assumes we only went one over. Should be good if | |
0df8b418 | 1615 | program works correctly. */ |
923c6a3d TT |
1616 | listp->next = listp->list + listp->size; |
1617 | listp->size = new_size; | |
1618 | } | |
1619 | ||
ccefe4c4 TT |
1620 | /* Helper function, adds partial symbol to the given partial symbol |
1621 | list. */ | |
1622 | ||
1623 | static void | |
1624 | append_psymbol_to_list (struct psymbol_allocation_list *list, | |
1625 | const struct partial_symbol *psym, | |
1626 | struct objfile *objfile) | |
1627 | { | |
1628 | if (list->next >= list->list + list->size) | |
1629 | extend_psymbol_list (list, objfile); | |
1630 | *list->next++ = (struct partial_symbol *) psym; | |
1631 | OBJSTAT (objfile, n_psyms++); | |
1632 | } | |
1633 | ||
1634 | /* Add a symbol with a long value to a psymtab. | |
1635 | Since one arg is a struct, we pass in a ptr and deref it (sigh). | |
1636 | Return the partial symbol that has been added. */ | |
1637 | ||
7dc25483 | 1638 | void |
72b9f47f | 1639 | add_psymbol_to_list (const char *name, int namelength, int copy_name, |
ccefe4c4 TT |
1640 | domain_enum domain, |
1641 | enum address_class class, | |
1642 | struct psymbol_allocation_list *list, | |
1643 | long val, /* Value as a long */ | |
1644 | CORE_ADDR coreaddr, /* Value as a CORE_ADDR */ | |
1645 | enum language language, struct objfile *objfile) | |
1646 | { | |
1647 | const struct partial_symbol *psym; | |
1648 | ||
1649 | int added; | |
1650 | ||
0df8b418 | 1651 | /* Stash the partial symbol away in the cache. */ |
ccefe4c4 TT |
1652 | psym = add_psymbol_to_bcache (name, namelength, copy_name, domain, class, |
1653 | val, coreaddr, language, objfile, &added); | |
1654 | ||
1655 | /* Do not duplicate global partial symbols. */ | |
1656 | if (list == &objfile->global_psymbols | |
1657 | && !added) | |
7dc25483 | 1658 | return; |
ccefe4c4 | 1659 | |
0df8b418 | 1660 | /* Save pointer to partial symbol in psymtab, growing symtab if needed. */ |
ccefe4c4 | 1661 | append_psymbol_to_list (list, psym, objfile); |
ccefe4c4 TT |
1662 | } |
1663 | ||
1664 | /* Initialize storage for partial symbols. */ | |
1665 | ||
1666 | void | |
1667 | init_psymbol_list (struct objfile *objfile, int total_symbols) | |
1668 | { | |
1669 | /* Free any previously allocated psymbol lists. */ | |
1670 | ||
1671 | if (objfile->global_psymbols.list) | |
1672 | { | |
1673 | xfree (objfile->global_psymbols.list); | |
1674 | } | |
1675 | if (objfile->static_psymbols.list) | |
1676 | { | |
1677 | xfree (objfile->static_psymbols.list); | |
1678 | } | |
1679 | ||
1680 | /* Current best guess is that approximately a twentieth | |
1681 | of the total symbols (in a debugging file) are global or static | |
ca9c6ee2 | 1682 | oriented symbols, then multiply that by slop factor of two. */ |
ccefe4c4 TT |
1683 | |
1684 | objfile->global_psymbols.size = total_symbols / 10; | |
1685 | objfile->static_psymbols.size = total_symbols / 10; | |
1686 | ||
1687 | if (objfile->global_psymbols.size > 0) | |
1688 | { | |
1689 | objfile->global_psymbols.next = | |
1690 | objfile->global_psymbols.list = (struct partial_symbol **) | |
1691 | xmalloc ((objfile->global_psymbols.size | |
1692 | * sizeof (struct partial_symbol *))); | |
1693 | } | |
1694 | if (objfile->static_psymbols.size > 0) | |
1695 | { | |
1696 | objfile->static_psymbols.next = | |
1697 | objfile->static_psymbols.list = (struct partial_symbol **) | |
1698 | xmalloc ((objfile->static_psymbols.size | |
1699 | * sizeof (struct partial_symbol *))); | |
1700 | } | |
1701 | } | |
1702 | ||
1703 | struct partial_symtab * | |
1704 | allocate_psymtab (const char *filename, struct objfile *objfile) | |
1705 | { | |
1706 | struct partial_symtab *psymtab; | |
1707 | ||
1708 | if (objfile->free_psymtabs) | |
1709 | { | |
1710 | psymtab = objfile->free_psymtabs; | |
1711 | objfile->free_psymtabs = psymtab->next; | |
1712 | } | |
1713 | else | |
1714 | psymtab = (struct partial_symtab *) | |
1715 | obstack_alloc (&objfile->objfile_obstack, | |
1716 | sizeof (struct partial_symtab)); | |
1717 | ||
1718 | memset (psymtab, 0, sizeof (struct partial_symtab)); | |
10f0c4bb TT |
1719 | psymtab->filename = obstack_copy0 (&objfile->objfile_obstack, |
1720 | filename, strlen (filename)); | |
ccefe4c4 TT |
1721 | psymtab->symtab = NULL; |
1722 | ||
1723 | /* Prepend it to the psymtab list for the objfile it belongs to. | |
1724 | Psymtabs are searched in most recent inserted -> least recent | |
0df8b418 | 1725 | inserted order. */ |
ccefe4c4 | 1726 | |
ccefe4c4 TT |
1727 | psymtab->next = objfile->psymtabs; |
1728 | objfile->psymtabs = psymtab; | |
ccefe4c4 | 1729 | |
45cfd468 DE |
1730 | if (symtab_create_debug) |
1731 | { | |
1732 | /* Be a bit clever with debugging messages, and don't print objfile | |
1733 | every time, only when it changes. */ | |
1734 | static char *last_objfile_name = NULL; | |
1735 | ||
1736 | if (last_objfile_name == NULL | |
1737 | || strcmp (last_objfile_name, objfile->name) != 0) | |
1738 | { | |
1739 | xfree (last_objfile_name); | |
1740 | last_objfile_name = xstrdup (objfile->name); | |
1741 | fprintf_unfiltered (gdb_stdlog, | |
1742 | "Creating one or more psymtabs for objfile %s ...\n", | |
1743 | last_objfile_name); | |
1744 | } | |
1745 | fprintf_unfiltered (gdb_stdlog, | |
fd55216c DE |
1746 | "Created psymtab %s for module %s.\n", |
1747 | host_address_to_string (psymtab), filename); | |
45cfd468 DE |
1748 | } |
1749 | ||
ccefe4c4 TT |
1750 | return (psymtab); |
1751 | } | |
1752 | ||
1753 | void | |
5c80ed9d | 1754 | discard_psymtab (struct objfile *objfile, struct partial_symtab *pst) |
ccefe4c4 TT |
1755 | { |
1756 | struct partial_symtab **prev_pst; | |
1757 | ||
1758 | /* From dbxread.c: | |
1759 | Empty psymtabs happen as a result of header files which don't | |
1760 | have any symbols in them. There can be a lot of them. But this | |
1761 | check is wrong, in that a psymtab with N_SLINE entries but | |
1762 | nothing else is not empty, but we don't realize that. Fixing | |
1763 | that without slowing things down might be tricky. */ | |
1764 | ||
0df8b418 | 1765 | /* First, snip it out of the psymtab chain. */ |
ccefe4c4 | 1766 | |
5c80ed9d | 1767 | prev_pst = &(objfile->psymtabs); |
ccefe4c4 TT |
1768 | while ((*prev_pst) != pst) |
1769 | prev_pst = &((*prev_pst)->next); | |
1770 | (*prev_pst) = pst->next; | |
1771 | ||
0df8b418 | 1772 | /* Next, put it on a free list for recycling. */ |
ccefe4c4 | 1773 | |
5c80ed9d TT |
1774 | pst->next = objfile->free_psymtabs; |
1775 | objfile->free_psymtabs = pst; | |
ccefe4c4 TT |
1776 | } |
1777 | ||
c9bf0622 TT |
1778 | /* An object of this type is passed to discard_psymtabs_upto. */ |
1779 | ||
1780 | struct psymtab_state | |
1781 | { | |
1782 | /* The objfile where psymtabs are discarded. */ | |
1783 | ||
1784 | struct objfile *objfile; | |
1785 | ||
1786 | /* The first psymtab to save. */ | |
1787 | ||
1788 | struct partial_symtab *save; | |
1789 | }; | |
1790 | ||
1791 | /* A cleanup function used by make_cleanup_discard_psymtabs. */ | |
1792 | ||
1793 | static void | |
1794 | discard_psymtabs_upto (void *arg) | |
1795 | { | |
1796 | struct psymtab_state *state = arg; | |
1797 | ||
1798 | while (state->objfile->psymtabs != state->save) | |
1799 | discard_psymtab (state->objfile, state->objfile->psymtabs); | |
1800 | } | |
1801 | ||
1802 | /* Return a new cleanup that discards all psymtabs created in OBJFILE | |
1803 | after this function is called. */ | |
1804 | ||
1805 | struct cleanup * | |
1806 | make_cleanup_discard_psymtabs (struct objfile *objfile) | |
1807 | { | |
1808 | struct psymtab_state *state = XNEW (struct psymtab_state); | |
1809 | ||
1810 | state->objfile = objfile; | |
1811 | state->save = objfile->psymtabs; | |
1812 | ||
1813 | return make_cleanup_dtor (discard_psymtabs_upto, state, xfree); | |
1814 | } | |
1815 | ||
ccefe4c4 TT |
1816 | \f |
1817 | ||
dfc7bb5b | 1818 | static void |
ccefe4c4 TT |
1819 | maintenance_print_psymbols (char *args, int from_tty) |
1820 | { | |
1821 | char **argv; | |
1822 | struct ui_file *outfile; | |
1823 | struct cleanup *cleanups; | |
1824 | char *symname = NULL; | |
1825 | char *filename = DEV_TTY; | |
1826 | struct objfile *objfile; | |
1827 | struct partial_symtab *ps; | |
1828 | ||
1829 | dont_repeat (); | |
1830 | ||
1831 | if (args == NULL) | |
1832 | { | |
3e43a32a MS |
1833 | error (_("\ |
1834 | print-psymbols takes an output file name and optional symbol file name")); | |
ccefe4c4 TT |
1835 | } |
1836 | argv = gdb_buildargv (args); | |
1837 | cleanups = make_cleanup_freeargv (argv); | |
1838 | ||
1839 | if (argv[0] != NULL) | |
1840 | { | |
1841 | filename = argv[0]; | |
0df8b418 | 1842 | /* If a second arg is supplied, it is a source file name to match on. */ |
ccefe4c4 TT |
1843 | if (argv[1] != NULL) |
1844 | { | |
1845 | symname = argv[1]; | |
1846 | } | |
1847 | } | |
1848 | ||
1849 | filename = tilde_expand (filename); | |
1850 | make_cleanup (xfree, filename); | |
1851 | ||
1852 | outfile = gdb_fopen (filename, FOPEN_WT); | |
1853 | if (outfile == 0) | |
1854 | perror_with_name (filename); | |
1855 | make_cleanup_ui_file_delete (outfile); | |
1856 | ||
ccefe4c4 | 1857 | ALL_PSYMTABS (objfile, ps) |
27618ce4 TT |
1858 | { |
1859 | QUIT; | |
1860 | if (symname == NULL || filename_cmp (symname, ps->filename) == 0) | |
1861 | dump_psymtab (objfile, ps, outfile); | |
1862 | } | |
ccefe4c4 TT |
1863 | do_cleanups (cleanups); |
1864 | } | |
1865 | ||
1866 | /* List all the partial symbol tables whose names match REGEXP (optional). */ | |
dfc7bb5b | 1867 | static void |
ccefe4c4 TT |
1868 | maintenance_info_psymtabs (char *regexp, int from_tty) |
1869 | { | |
1870 | struct program_space *pspace; | |
1871 | struct objfile *objfile; | |
1872 | ||
1873 | if (regexp) | |
1874 | re_comp (regexp); | |
1875 | ||
1876 | ALL_PSPACES (pspace) | |
1877 | ALL_PSPACE_OBJFILES (pspace, objfile) | |
1878 | { | |
1879 | struct gdbarch *gdbarch = get_objfile_arch (objfile); | |
1880 | struct partial_symtab *psymtab; | |
1881 | ||
1882 | /* We don't want to print anything for this objfile until we | |
1883 | actually find a symtab whose name matches. */ | |
1884 | int printed_objfile_start = 0; | |
1885 | ||
b11896a5 | 1886 | ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, psymtab) |
ccefe4c4 TT |
1887 | { |
1888 | QUIT; | |
1889 | ||
1890 | if (! regexp | |
1891 | || re_exec (psymtab->filename)) | |
1892 | { | |
1893 | if (! printed_objfile_start) | |
1894 | { | |
1895 | printf_filtered ("{ objfile %s ", objfile->name); | |
1896 | wrap_here (" "); | |
1897 | printf_filtered ("((struct objfile *) %s)\n", | |
1898 | host_address_to_string (objfile)); | |
1899 | printed_objfile_start = 1; | |
1900 | } | |
1901 | ||
1902 | printf_filtered (" { psymtab %s ", psymtab->filename); | |
1903 | wrap_here (" "); | |
1904 | printf_filtered ("((struct partial_symtab *) %s)\n", | |
1905 | host_address_to_string (psymtab)); | |
1906 | ||
1907 | printf_filtered (" readin %s\n", | |
1908 | psymtab->readin ? "yes" : "no"); | |
1909 | printf_filtered (" fullname %s\n", | |
3e43a32a MS |
1910 | psymtab->fullname |
1911 | ? psymtab->fullname : "(null)"); | |
ccefe4c4 TT |
1912 | printf_filtered (" text addresses "); |
1913 | fputs_filtered (paddress (gdbarch, psymtab->textlow), | |
1914 | gdb_stdout); | |
1915 | printf_filtered (" -- "); | |
1916 | fputs_filtered (paddress (gdbarch, psymtab->texthigh), | |
1917 | gdb_stdout); | |
1918 | printf_filtered ("\n"); | |
9750bca9 JK |
1919 | printf_filtered (" psymtabs_addrmap_supported %s\n", |
1920 | (psymtab->psymtabs_addrmap_supported | |
1921 | ? "yes" : "no")); | |
ccefe4c4 TT |
1922 | printf_filtered (" globals "); |
1923 | if (psymtab->n_global_syms) | |
1924 | { | |
1925 | printf_filtered ("(* (struct partial_symbol **) %s @ %d)\n", | |
5c80ed9d | 1926 | host_address_to_string (objfile->global_psymbols.list |
ccefe4c4 TT |
1927 | + psymtab->globals_offset), |
1928 | psymtab->n_global_syms); | |
1929 | } | |
1930 | else | |
1931 | printf_filtered ("(none)\n"); | |
1932 | printf_filtered (" statics "); | |
1933 | if (psymtab->n_static_syms) | |
1934 | { | |
1935 | printf_filtered ("(* (struct partial_symbol **) %s @ %d)\n", | |
5c80ed9d | 1936 | host_address_to_string (objfile->static_psymbols.list |
ccefe4c4 TT |
1937 | + psymtab->statics_offset), |
1938 | psymtab->n_static_syms); | |
1939 | } | |
1940 | else | |
1941 | printf_filtered ("(none)\n"); | |
1942 | printf_filtered (" dependencies "); | |
1943 | if (psymtab->number_of_dependencies) | |
1944 | { | |
1945 | int i; | |
1946 | ||
1947 | printf_filtered ("{\n"); | |
1948 | for (i = 0; i < psymtab->number_of_dependencies; i++) | |
1949 | { | |
1950 | struct partial_symtab *dep = psymtab->dependencies[i]; | |
1951 | ||
1952 | /* Note the string concatenation there --- no comma. */ | |
1953 | printf_filtered (" psymtab %s " | |
1954 | "((struct partial_symtab *) %s)\n", | |
1955 | dep->filename, | |
1956 | host_address_to_string (dep)); | |
1957 | } | |
1958 | printf_filtered (" }\n"); | |
1959 | } | |
1960 | else | |
1961 | printf_filtered ("(none)\n"); | |
1962 | printf_filtered (" }\n"); | |
1963 | } | |
1964 | } | |
1965 | ||
1966 | if (printed_objfile_start) | |
1967 | printf_filtered ("}\n"); | |
1968 | } | |
1969 | } | |
1970 | ||
1971 | /* Check consistency of psymtabs and symtabs. */ | |
1972 | ||
dfc7bb5b | 1973 | static void |
ccefe4c4 TT |
1974 | maintenance_check_symtabs (char *ignore, int from_tty) |
1975 | { | |
1976 | struct symbol *sym; | |
1977 | struct partial_symbol **psym; | |
1978 | struct symtab *s = NULL; | |
1979 | struct partial_symtab *ps; | |
1980 | struct blockvector *bv; | |
1981 | struct objfile *objfile; | |
1982 | struct block *b; | |
1983 | int length; | |
1984 | ||
1985 | ALL_PSYMTABS (objfile, ps) | |
1986 | { | |
1987 | struct gdbarch *gdbarch = get_objfile_arch (objfile); | |
ad3bbd48 | 1988 | |
5c80ed9d | 1989 | s = psymtab_to_symtab (objfile, ps); |
ccefe4c4 TT |
1990 | if (s == NULL) |
1991 | continue; | |
1992 | bv = BLOCKVECTOR (s); | |
1993 | b = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK); | |
5c80ed9d | 1994 | psym = objfile->static_psymbols.list + ps->statics_offset; |
ccefe4c4 TT |
1995 | length = ps->n_static_syms; |
1996 | while (length--) | |
1997 | { | |
1998 | sym = lookup_block_symbol (b, SYMBOL_LINKAGE_NAME (*psym), | |
1999 | SYMBOL_DOMAIN (*psym)); | |
2000 | if (!sym) | |
2001 | { | |
2002 | printf_filtered ("Static symbol `"); | |
2003 | puts_filtered (SYMBOL_LINKAGE_NAME (*psym)); | |
2004 | printf_filtered ("' only found in "); | |
2005 | puts_filtered (ps->filename); | |
2006 | printf_filtered (" psymtab\n"); | |
2007 | } | |
2008 | psym++; | |
2009 | } | |
2010 | b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); | |
5c80ed9d | 2011 | psym = objfile->global_psymbols.list + ps->globals_offset; |
ccefe4c4 TT |
2012 | length = ps->n_global_syms; |
2013 | while (length--) | |
2014 | { | |
2015 | sym = lookup_block_symbol (b, SYMBOL_LINKAGE_NAME (*psym), | |
2016 | SYMBOL_DOMAIN (*psym)); | |
2017 | if (!sym) | |
2018 | { | |
2019 | printf_filtered ("Global symbol `"); | |
2020 | puts_filtered (SYMBOL_LINKAGE_NAME (*psym)); | |
2021 | printf_filtered ("' only found in "); | |
2022 | puts_filtered (ps->filename); | |
2023 | printf_filtered (" psymtab\n"); | |
2024 | } | |
2025 | psym++; | |
2026 | } | |
2027 | if (ps->texthigh < ps->textlow) | |
2028 | { | |
2029 | printf_filtered ("Psymtab "); | |
2030 | puts_filtered (ps->filename); | |
2031 | printf_filtered (" covers bad range "); | |
2032 | fputs_filtered (paddress (gdbarch, ps->textlow), gdb_stdout); | |
2033 | printf_filtered (" - "); | |
2034 | fputs_filtered (paddress (gdbarch, ps->texthigh), gdb_stdout); | |
2035 | printf_filtered ("\n"); | |
2036 | continue; | |
2037 | } | |
2038 | if (ps->texthigh == 0) | |
2039 | continue; | |
2040 | if (ps->textlow < BLOCK_START (b) || ps->texthigh > BLOCK_END (b)) | |
2041 | { | |
2042 | printf_filtered ("Psymtab "); | |
2043 | puts_filtered (ps->filename); | |
2044 | printf_filtered (" covers "); | |
2045 | fputs_filtered (paddress (gdbarch, ps->textlow), gdb_stdout); | |
2046 | printf_filtered (" - "); | |
2047 | fputs_filtered (paddress (gdbarch, ps->texthigh), gdb_stdout); | |
2048 | printf_filtered (" but symtab covers only "); | |
2049 | fputs_filtered (paddress (gdbarch, BLOCK_START (b)), gdb_stdout); | |
2050 | printf_filtered (" - "); | |
2051 | fputs_filtered (paddress (gdbarch, BLOCK_END (b)), gdb_stdout); | |
2052 | printf_filtered ("\n"); | |
2053 | } | |
2054 | } | |
2055 | } | |
2056 | ||
2057 | \f | |
2058 | ||
2059 | void | |
e078317b | 2060 | expand_partial_symbol_names (int (*fun) (const char *, void *), |
f8eba3c6 | 2061 | void *data) |
ccefe4c4 TT |
2062 | { |
2063 | struct objfile *objfile; | |
2064 | ||
2065 | ALL_OBJFILES (objfile) | |
2066 | { | |
2067 | if (objfile->sf) | |
7b08b9eb JK |
2068 | objfile->sf->qf->expand_symtabs_matching (objfile, NULL, fun, |
2069 | ALL_DOMAIN, data); | |
ccefe4c4 TT |
2070 | } |
2071 | } | |
2072 | ||
2073 | void | |
74e2f255 DE |
2074 | map_partial_symbol_filenames (symbol_filename_ftype *fun, void *data, |
2075 | int need_fullname) | |
ccefe4c4 TT |
2076 | { |
2077 | struct objfile *objfile; | |
2078 | ||
2079 | ALL_OBJFILES (objfile) | |
2080 | { | |
2081 | if (objfile->sf) | |
74e2f255 DE |
2082 | objfile->sf->qf->map_symbol_filenames (objfile, fun, data, |
2083 | need_fullname); | |
ccefe4c4 TT |
2084 | } |
2085 | } | |
dfc7bb5b YQ |
2086 | |
2087 | extern initialize_file_ftype _initialize_psymtab; | |
2088 | ||
2089 | void | |
2090 | _initialize_psymtab (void) | |
2091 | { | |
2092 | add_cmd ("psymbols", class_maintenance, maintenance_print_psymbols, _("\ | |
2093 | Print dump of current partial symbol definitions.\n\ | |
2094 | Entries in the partial symbol table are dumped to file OUTFILE.\n\ | |
2095 | If a SOURCE file is specified, dump only that file's partial symbols."), | |
2096 | &maintenanceprintlist); | |
2097 | ||
2098 | add_cmd ("psymtabs", class_maintenance, maintenance_info_psymtabs, _("\ | |
2099 | List the partial symbol tables for all object files.\n\ | |
2100 | This does not include information about individual partial symbols,\n\ | |
2101 | just the symbol table structures themselves."), | |
2102 | &maintenanceinfolist); | |
2103 | ||
2104 | add_cmd ("check-symtabs", class_maintenance, maintenance_check_symtabs, | |
2105 | _("Check consistency of psymtabs and symtabs."), | |
2106 | &maintenancelist); | |
2107 | } |