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