1 /* Partial symbol tables.
3 Copyright (C) 2009-2022 Free Software Foundation, Inc.
5 This file is part of GDB.
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.
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.
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/>. */
25 #include "filenames.h"
31 #include "readline/tilde.h"
32 #include "gdbsupport/gdb_regex.h"
33 #include "dictionary.h"
35 #include "cp-support.h"
39 #include "gdbsupport/buildargv.h"
41 static struct partial_symbol
*lookup_partial_symbol (struct objfile
*,
42 struct partial_symtab
*,
43 const lookup_name_info
&,
47 static const char *psymtab_to_fullname (struct partial_symtab
*ps
);
49 static struct partial_symbol
*find_pc_sect_psymbol (struct objfile
*,
50 struct partial_symtab
*,
52 struct obj_section
*);
54 static struct compunit_symtab
*psymtab_to_symtab (struct objfile
*objfile
,
55 struct partial_symtab
*pst
);
57 psymtab_storage::~psymtab_storage ()
59 partial_symtab
*iter
= psymtabs
;
60 while (iter
!= nullptr)
62 partial_symtab
*next
= iter
->next
;
71 psymtab_storage::install_psymtab (partial_symtab
*pst
)
81 psymtab_storage::partial_symtab_range
82 psymbol_functions::partial_symbols (struct objfile
*objfile
)
84 gdb_assert ((objfile
->flags
& OBJF_PSYMTABS_READ
) != 0);
85 return m_partial_symtabs
->range ();
88 /* Find which partial symtab contains PC and SECTION starting at psymtab PST.
89 We may find a different psymtab than PST. See FIND_PC_SECT_PSYMTAB. */
91 static struct partial_symtab
*
92 find_pc_sect_psymtab_closer (struct objfile
*objfile
,
93 CORE_ADDR pc
, struct obj_section
*section
,
94 struct partial_symtab
*pst
,
95 struct bound_minimal_symbol msymbol
)
97 struct partial_symtab
*tpst
;
98 struct partial_symtab
*best_pst
= pst
;
99 CORE_ADDR best_addr
= pst
->text_low (objfile
);
101 /* An objfile that has its functions reordered might have
102 many partial symbol tables containing the PC, but
103 we want the partial symbol table that contains the
104 function containing the PC. */
105 if (!(objfile
->flags
& OBJF_REORDERED
)
106 && section
== NULL
) /* Can't validate section this way. */
109 if (msymbol
.minsym
== NULL
)
112 /* The code range of partial symtabs sometimes overlap, so, in
113 the loop below, we need to check all partial symtabs and
114 find the one that fits better for the given PC address. We
115 select the partial symtab that contains a symbol whose
116 address is closest to the PC address. By closest we mean
117 that find_pc_sect_symbol returns the symbol with address
118 that is closest and still less than the given PC. */
119 for (tpst
= pst
; tpst
!= NULL
; tpst
= tpst
->next
)
121 if (pc
>= tpst
->text_low (objfile
) && pc
< tpst
->text_high (objfile
))
123 struct partial_symbol
*p
;
126 /* NOTE: This assumes that every psymbol has a
127 corresponding msymbol, which is not necessarily
128 true; the debug info might be much richer than the
129 object's symbol table. */
130 p
= find_pc_sect_psymbol (objfile
, tpst
, pc
, section
);
132 && (p
->address (objfile
) == msymbol
.value_address ()))
135 /* Also accept the textlow value of a psymtab as a
136 "symbol", to provide some support for partial
137 symbol tables with line information but no debug
138 symbols (e.g. those produced by an assembler). */
140 this_addr
= p
->address (objfile
);
142 this_addr
= tpst
->text_low (objfile
);
144 /* Check whether it is closer than our current
145 BEST_ADDR. Since this symbol address is
146 necessarily lower or equal to PC, the symbol closer
147 to PC is the symbol which address is the highest.
148 This way we return the psymtab which contains such
149 best match symbol. This can help in cases where the
150 symbol information/debuginfo is not complete, like
151 for instance on IRIX6 with gcc, where no debug info
152 is emitted for statics. (See also the nodebug.exp
154 if (this_addr
> best_addr
)
156 best_addr
= this_addr
;
164 /* See psympriv.h. */
166 struct partial_symtab
*
167 psymbol_functions::find_pc_sect_psymtab (struct objfile
*objfile
,
169 struct obj_section
*section
,
170 struct bound_minimal_symbol msymbol
)
172 for (partial_symtab
*pst
: partial_symbols (objfile
))
173 if (pc
>= pst
->text_low (objfile
) && pc
< pst
->text_high (objfile
))
175 struct partial_symtab
*best_pst
;
177 best_pst
= find_pc_sect_psymtab_closer (objfile
, pc
, section
, pst
,
179 if (best_pst
!= NULL
)
186 /* Psymtab version of find_pc_sect_compunit_symtab. See its definition in
187 the definition of quick_symbol_functions in symfile.h. */
189 struct compunit_symtab
*
190 psymbol_functions::find_pc_sect_compunit_symtab
191 (struct objfile
*objfile
,
192 struct bound_minimal_symbol msymbol
,
194 struct obj_section
*section
,
197 struct partial_symtab
*ps
= find_pc_sect_psymtab (objfile
,
202 if (warn_if_readin
&& ps
->readin_p (objfile
))
203 /* Might want to error() here (in case symtab is corrupt and
204 will cause a core dump), but maybe we can successfully
205 continue, so let's not. */
207 (Internal error: pc %s in read in psymtab, but not in symtab.)\n"),
208 paddress (objfile
->arch (), pc
));
209 psymtab_to_symtab (objfile
, ps
);
210 return ps
->get_compunit_symtab (objfile
);
215 /* Find which partial symbol within a psymtab matches PC and SECTION.
216 Return NULL if none. */
218 static struct partial_symbol
*
219 find_pc_sect_psymbol (struct objfile
*objfile
,
220 struct partial_symtab
*psymtab
, CORE_ADDR pc
,
221 struct obj_section
*section
)
223 struct partial_symbol
*best
= NULL
;
225 const CORE_ADDR textlow
= psymtab
->text_low (objfile
);
227 gdb_assert (psymtab
!= NULL
);
229 /* Cope with programs that start at address 0. */
230 best_pc
= (textlow
!= 0) ? textlow
- 1 : 0;
232 /* Search the global symbols as well as the static symbols, so that
233 find_pc_partial_function doesn't use a minimal symbol and thus
234 cache a bad endaddr. */
235 for (partial_symbol
*p
: psymtab
->global_psymbols
)
237 if (p
->domain
== VAR_DOMAIN
238 && p
->aclass
== LOC_BLOCK
239 && pc
>= p
->address (objfile
)
240 && (p
->address (objfile
) > best_pc
241 || (psymtab
->text_low (objfile
) == 0
242 && best_pc
== 0 && p
->address (objfile
) == 0)))
244 if (section
!= NULL
) /* Match on a specific section. */
246 if (!matching_obj_sections (p
->obj_section (objfile
),
250 best_pc
= p
->address (objfile
);
255 for (partial_symbol
*p
: psymtab
->static_psymbols
)
257 if (p
->domain
== VAR_DOMAIN
258 && p
->aclass
== LOC_BLOCK
259 && pc
>= p
->address (objfile
)
260 && (p
->address (objfile
) > best_pc
261 || (psymtab
->text_low (objfile
) == 0
262 && best_pc
== 0 && p
->address (objfile
) == 0)))
264 if (section
!= NULL
) /* Match on a specific section. */
266 if (!matching_obj_sections (p
->obj_section (objfile
),
270 best_pc
= p
->address (objfile
);
278 /* Psymtab version of lookup_global_symbol_language. See its definition in
279 the definition of quick_symbol_functions in symfile.h. */
282 psymbol_functions::lookup_global_symbol_language (struct objfile
*objfile
,
285 bool *symbol_found_p
)
287 *symbol_found_p
= false;
288 if (objfile
->sf
== NULL
)
289 return language_unknown
;
291 lookup_name_info
lookup_name (name
, symbol_name_match_type::FULL
);
293 for (partial_symtab
*ps
: partial_symbols (objfile
))
295 struct partial_symbol
*psym
;
296 if (ps
->readin_p (objfile
))
299 psym
= lookup_partial_symbol (objfile
, ps
, lookup_name
, 1, domain
);
302 *symbol_found_p
= true;
303 return psym
->ginfo
.language ();
307 return language_unknown
;
310 /* Returns true if PSYM matches LOOKUP_NAME. */
313 psymbol_name_matches (partial_symbol
*psym
,
314 const lookup_name_info
&lookup_name
)
316 const language_defn
*lang
= language_def (psym
->ginfo
.language ());
317 symbol_name_matcher_ftype
*name_match
318 = lang
->get_symbol_name_matcher (lookup_name
);
319 return name_match (psym
->ginfo
.search_name (), lookup_name
, NULL
);
322 /* Look in PST for a symbol in DOMAIN whose name matches NAME. Search
323 the global block of PST if GLOBAL, and otherwise the static block.
324 MATCH is the comparison operation that returns true iff MATCH (s,
325 NAME), where s is a SYMBOL_SEARCH_NAME. If ORDERED_COMPARE is
326 non-null, the symbols in the block are assumed to be ordered
327 according to it (allowing binary search). It must be compatible
328 with MATCH. Returns the symbol, if found, and otherwise NULL. */
330 static struct partial_symbol
*
331 match_partial_symbol (struct objfile
*objfile
,
332 struct partial_symtab
*pst
, int global
,
333 const lookup_name_info
&name
, domain_enum domain
,
334 symbol_compare_ftype
*ordered_compare
)
336 struct partial_symbol
**start
, **psym
;
337 struct partial_symbol
**top
, **real_top
, **bottom
, **center
;
339 ? pst
->global_psymbols
.size ()
340 : pst
->static_psymbols
.size ());
341 int do_linear_search
= 1;
347 &pst
->global_psymbols
[0] :
348 &pst
->static_psymbols
[0]);
350 if (global
&& ordered_compare
) /* Can use a binary search. */
352 do_linear_search
= 0;
354 /* Binary search. This search is guaranteed to end with center
355 pointing at the earliest partial symbol whose name might be
356 correct. At that point *all* partial symbols with an
357 appropriate name will be checked against the correct
361 top
= start
+ length
- 1;
365 center
= bottom
+ (top
- bottom
) / 2;
366 gdb_assert (center
< top
);
368 enum language lang
= (*center
)->ginfo
.language ();
369 const char *lang_ln
= name
.language_lookup_name (lang
);
371 if (ordered_compare ((*center
)->ginfo
.search_name (),
377 gdb_assert (top
== bottom
);
379 while (top
<= real_top
380 && psymbol_name_matches (*top
, name
))
382 if (symbol_matches_domain ((*top
)->ginfo
.language (),
383 (*top
)->domain
, domain
))
389 /* Can't use a binary search or else we found during the binary search that
390 we should also do a linear search. */
392 if (do_linear_search
)
394 for (psym
= start
; psym
< start
+ length
; psym
++)
396 if (symbol_matches_domain ((*psym
)->ginfo
.language (),
397 (*psym
)->domain
, domain
)
398 && psymbol_name_matches (*psym
, name
))
406 /* Look, in partial_symtab PST, for symbol whose natural name is
407 LOOKUP_NAME. Check the global symbols if GLOBAL, the static
410 static struct partial_symbol
*
411 lookup_partial_symbol (struct objfile
*objfile
,
412 struct partial_symtab
*pst
,
413 const lookup_name_info
&lookup_name
,
414 int global
, domain_enum domain
)
416 struct partial_symbol
**start
, **psym
;
417 struct partial_symbol
**top
, **real_top
, **bottom
, **center
;
419 ? pst
->global_psymbols
.size ()
420 : pst
->static_psymbols
.size ());
421 int do_linear_search
= 1;
427 &pst
->global_psymbols
[0] :
428 &pst
->static_psymbols
[0]);
430 if (global
) /* This means we can use a binary search. */
432 do_linear_search
= 0;
434 /* Binary search. This search is guaranteed to end with center
435 pointing at the earliest partial symbol whose name might be
436 correct. At that point *all* partial symbols with an
437 appropriate name will be checked against the correct
441 top
= start
+ length
- 1;
445 center
= bottom
+ (top
- bottom
) / 2;
447 gdb_assert (center
< top
);
449 if (strcmp_iw_ordered ((*center
)->ginfo
.search_name (),
450 lookup_name
.c_str ()) >= 0)
460 gdb_assert (top
== bottom
);
462 /* For `case_sensitivity == case_sensitive_off' strcmp_iw_ordered will
463 search more exactly than what matches SYMBOL_MATCHES_SEARCH_NAME. */
464 while (top
>= start
&& symbol_matches_search_name (&(*top
)->ginfo
,
468 /* Fixup to have a symbol which matches SYMBOL_MATCHES_SEARCH_NAME. */
471 while (top
<= real_top
&& symbol_matches_search_name (&(*top
)->ginfo
,
474 if (symbol_matches_domain ((*top
)->ginfo
.language (),
475 (*top
)->domain
, domain
))
481 /* Can't use a binary search or else we found during the binary search that
482 we should also do a linear search. */
484 if (do_linear_search
)
486 for (psym
= start
; psym
< start
+ length
; psym
++)
488 if (symbol_matches_domain ((*psym
)->ginfo
.language (),
489 (*psym
)->domain
, domain
)
490 && symbol_matches_search_name (&(*psym
)->ginfo
, lookup_name
))
498 /* Get the symbol table that corresponds to a partial_symtab.
499 This is fast after the first time you do it.
500 The result will be NULL if the primary symtab has no symbols,
501 which can happen. Otherwise the result is the primary symtab
502 that contains PST. */
504 static struct compunit_symtab
*
505 psymtab_to_symtab (struct objfile
*objfile
, struct partial_symtab
*pst
)
507 /* If it is a shared psymtab, find an unshared psymtab that includes
508 it. Any such psymtab will do. */
509 while (pst
->user
!= NULL
)
512 /* If it's been looked up before, return it. */
513 if (pst
->get_compunit_symtab (objfile
))
514 return pst
->get_compunit_symtab (objfile
);
516 /* If it has not yet been read in, read it. */
517 if (!pst
->readin_p (objfile
))
519 scoped_restore decrementer
= increment_reading_symtab ();
523 gdb_printf (_("Reading in symbols for %s...\n"),
525 gdb_flush (gdb_stdout
);
528 pst
->read_symtab (objfile
);
531 return pst
->get_compunit_symtab (objfile
);
534 /* Psymtab version of find_last_source_symtab. See its definition in
535 the definition of quick_symbol_functions in symfile.h. */
538 psymbol_functions::find_last_source_symtab (struct objfile
*ofp
)
540 struct partial_symtab
*cs_pst
= NULL
;
542 for (partial_symtab
*ps
: partial_symbols (ofp
))
544 const char *name
= ps
->filename
;
545 int len
= strlen (name
);
547 if (!(len
> 2 && (strcmp (&name
[len
- 2], ".h") == 0
548 || strcmp (name
, "<<C++-namespaces>>") == 0)))
554 if (cs_pst
->readin_p (ofp
))
556 internal_error (__FILE__
, __LINE__
,
557 _("select_source_symtab: "
558 "readin pst found and no symtabs."));
562 struct compunit_symtab
*cust
= psymtab_to_symtab (ofp
, cs_pst
);
566 return cust
->primary_filetab ();
572 /* Psymtab version of forget_cached_source_info. See its definition in
573 the definition of quick_symbol_functions in symfile.h. */
576 psymbol_functions::forget_cached_source_info (struct objfile
*objfile
)
578 for (partial_symtab
*pst
: partial_symbols (objfile
))
580 if (pst
->fullname
!= NULL
)
582 xfree (pst
->fullname
);
583 pst
->fullname
= NULL
;
589 print_partial_symbols (struct gdbarch
*gdbarch
, struct objfile
*objfile
,
590 const std::vector
<partial_symbol
*> &symbols
,
591 const char *what
, struct ui_file
*outfile
)
593 gdb_printf (outfile
, " %s partial symbols:\n", what
);
594 for (partial_symbol
*p
: symbols
)
597 gdb_printf (outfile
, " `%s'", p
->ginfo
.linkage_name ());
598 if (p
->ginfo
.demangled_name () != NULL
)
600 gdb_printf (outfile
, " `%s'",
601 p
->ginfo
.demangled_name ());
603 gdb_puts (", ", outfile
);
607 gdb_puts ("undefined domain, ", outfile
);
610 /* This is the usual thing -- don't print it. */
613 gdb_puts ("struct domain, ", outfile
);
616 gdb_puts ("module domain, ", outfile
);
619 gdb_puts ("label domain, ", outfile
);
621 case COMMON_BLOCK_DOMAIN
:
622 gdb_puts ("common block domain, ", outfile
);
625 gdb_puts ("<invalid domain>, ", outfile
);
631 gdb_puts ("undefined", outfile
);
634 gdb_puts ("constant int", outfile
);
637 gdb_puts ("static", outfile
);
640 gdb_puts ("register", outfile
);
643 gdb_puts ("pass by value", outfile
);
646 gdb_puts ("pass by reference", outfile
);
648 case LOC_REGPARM_ADDR
:
649 gdb_puts ("register address parameter", outfile
);
652 gdb_puts ("stack parameter", outfile
);
655 gdb_puts ("type", outfile
);
658 gdb_puts ("label", outfile
);
661 gdb_puts ("function", outfile
);
663 case LOC_CONST_BYTES
:
664 gdb_puts ("constant bytes", outfile
);
667 gdb_puts ("unresolved", outfile
);
669 case LOC_OPTIMIZED_OUT
:
670 gdb_puts ("optimized out", outfile
);
673 gdb_puts ("computed at runtime", outfile
);
676 gdb_puts ("<invalid location>", outfile
);
679 gdb_puts (", ", outfile
);
680 gdb_puts (paddress (gdbarch
, p
->unrelocated_address ()), outfile
);
681 gdb_printf (outfile
, "\n");
686 dump_psymtab (struct objfile
*objfile
, struct partial_symtab
*psymtab
,
687 struct ui_file
*outfile
)
689 struct gdbarch
*gdbarch
= objfile
->arch ();
692 if (psymtab
->anonymous
)
694 gdb_printf (outfile
, "\nAnonymous partial symtab (%s) ",
699 gdb_printf (outfile
, "\nPartial symtab for source file %s ",
702 gdb_printf (outfile
, "(object %s)\n\n",
703 host_address_to_string (psymtab
));
704 gdb_printf (outfile
, " Read from object file %s (%s)\n",
705 objfile_name (objfile
),
706 host_address_to_string (objfile
));
708 if (psymtab
->readin_p (objfile
))
711 " Full symtab was read (at %s)\n",
712 host_address_to_string (psymtab
->get_compunit_symtab (objfile
)));
714 gdb_printf (outfile
, " Symbols cover text addresses ");
715 gdb_puts (paddress (gdbarch
, psymtab
->text_low (objfile
)), outfile
);
716 gdb_printf (outfile
, "-");
717 gdb_puts (paddress (gdbarch
, psymtab
->text_high (objfile
)), outfile
);
718 gdb_printf (outfile
, "\n");
719 gdb_printf (outfile
, " Depends on %d other partial symtabs.\n",
720 psymtab
->number_of_dependencies
);
721 for (i
= 0; i
< psymtab
->number_of_dependencies
; i
++)
722 gdb_printf (outfile
, " %d %s\n", i
,
723 host_address_to_string (psymtab
->dependencies
[i
]));
724 if (psymtab
->user
!= NULL
)
725 gdb_printf (outfile
, " Shared partial symtab with user %s\n",
726 host_address_to_string (psymtab
->user
));
727 if (!psymtab
->global_psymbols
.empty ())
729 print_partial_symbols
730 (gdbarch
, objfile
, psymtab
->global_psymbols
,
733 if (!psymtab
->static_psymbols
.empty ())
735 print_partial_symbols
736 (gdbarch
, objfile
, psymtab
->static_psymbols
,
739 gdb_printf (outfile
, "\n");
742 /* Count the number of partial symbols in OBJFILE. */
745 psymbol_functions::count_psyms ()
748 for (partial_symtab
*pst
: m_partial_symtabs
->range ())
750 count
+= pst
->global_psymbols
.size ();
751 count
+= pst
->static_psymbols
.size ();
756 /* Psymtab version of print_stats. See its definition in
757 the definition of quick_symbol_functions in symfile.h. */
760 psymbol_functions::print_stats (struct objfile
*objfile
, bool print_bcache
)
766 int n_psyms
= count_psyms ();
768 gdb_printf (_(" Number of \"partial\" symbols read: %d\n"),
772 for (partial_symtab
*ps
: partial_symbols (objfile
))
774 if (!ps
->readin_p (objfile
))
777 gdb_printf (_(" Number of psym tables (not yet expanded): %d\n"),
779 gdb_printf (_(" Total memory used for psymbol cache: %d\n"),
780 m_partial_symtabs
->psymbol_cache
.memory_used ());
784 gdb_printf (_("Psymbol byte cache statistics:\n"));
785 m_partial_symtabs
->psymbol_cache
.print_statistics
786 ("partial symbol cache");
790 /* Psymtab version of dump. See its definition in
791 the definition of quick_symbol_functions in symfile.h. */
794 psymbol_functions::dump (struct objfile
*objfile
)
796 struct partial_symtab
*psymtab
;
798 if (m_partial_symtabs
->psymtabs
)
800 gdb_printf ("Psymtabs:\n");
801 for (psymtab
= m_partial_symtabs
->psymtabs
;
803 psymtab
= psymtab
->next
)
804 gdb_printf ("%s at %s\n",
806 host_address_to_string (psymtab
));
811 /* Psymtab version of expand_all_symtabs. See its definition in
812 the definition of quick_symbol_functions in symfile.h. */
815 psymbol_functions::expand_all_symtabs (struct objfile
*objfile
)
817 for (partial_symtab
*psymtab
: partial_symbols (objfile
))
818 psymtab_to_symtab (objfile
, psymtab
);
821 /* Psymtab version of map_symbol_filenames. See its definition in
822 the definition of quick_symbol_functions in symfile.h. */
825 psymbol_functions::map_symbol_filenames
826 (struct objfile
*objfile
,
827 gdb::function_view
<symbol_filename_ftype
> fun
,
830 for (partial_symtab
*ps
: partial_symbols (objfile
))
832 const char *fullname
;
834 if (ps
->readin_p (objfile
))
837 /* We can skip shared psymtabs here, because any file name will be
838 attached to the unshared psymtab. */
839 if (ps
->user
!= NULL
)
842 /* Anonymous psymtabs don't have a file name. */
848 fullname
= psymtab_to_fullname (ps
);
851 fun (ps
->filename
, fullname
);
855 /* Finds the fullname that a partial_symtab represents.
857 If this functions finds the fullname, it will save it in ps->fullname
858 and it will also return the value.
860 If this function fails to find the file that this partial_symtab represents,
861 NULL will be returned and ps->fullname will be set to NULL. */
864 psymtab_to_fullname (struct partial_symtab
*ps
)
866 gdb_assert (!ps
->anonymous
);
868 /* Use cached copy if we have it.
869 We rely on forget_cached_source_info being called appropriately
870 to handle cases like the file being moved. */
871 if (ps
->fullname
== NULL
)
873 gdb::unique_xmalloc_ptr
<char> fullname
874 = find_source_or_rewrite (ps
->filename
, ps
->dirname
);
875 ps
->fullname
= fullname
.release ();
881 /* Psymtab version of expand_matching_symbols. See its definition in
882 the definition of quick_symbol_functions in symfile.h. */
885 psymbol_functions::expand_matching_symbols
886 (struct objfile
*objfile
,
887 const lookup_name_info
&name
, domain_enum domain
,
889 symbol_compare_ftype
*ordered_compare
)
891 for (partial_symtab
*ps
: partial_symbols (objfile
))
894 if (!ps
->readin_p (objfile
)
895 && match_partial_symbol (objfile
, ps
, global
, name
, domain
,
897 psymtab_to_symtab (objfile
, ps
);
901 /* A helper for psym_expand_symtabs_matching that handles searching
902 included psymtabs. This returns true if a symbol is found, and
903 false otherwise. It also updates the 'searched_flag' on the
904 various psymtabs that it searches. */
907 recursively_search_psymtabs
908 (struct partial_symtab
*ps
,
909 struct objfile
*objfile
,
910 block_search_flags search_flags
,
912 enum search_domain search
,
913 const lookup_name_info
&lookup_name
,
914 gdb::function_view
<expand_symtabs_symbol_matcher_ftype
> sym_matcher
)
917 enum psymtab_search_status result
= PST_SEARCHED_AND_NOT_FOUND
;
920 if (ps
->searched_flag
!= PST_NOT_SEARCHED
)
921 return ps
->searched_flag
== PST_SEARCHED_AND_FOUND
;
923 /* Recurse into shared psymtabs first, because they may have already
924 been searched, and this could save some time. */
925 for (i
= 0; i
< ps
->number_of_dependencies
; ++i
)
929 /* Skip non-shared dependencies, these are handled elsewhere. */
930 if (ps
->dependencies
[i
]->user
== NULL
)
933 r
= recursively_search_psymtabs (ps
->dependencies
[i
],
934 objfile
, search_flags
, domain
, search
,
935 lookup_name
, sym_matcher
);
938 ps
->searched_flag
= PST_SEARCHED_AND_FOUND
;
943 partial_symbol
**gbound
= (ps
->global_psymbols
.data ()
944 + ps
->global_psymbols
.size ());
945 partial_symbol
**sbound
= (ps
->static_psymbols
.data ()
946 + ps
->static_psymbols
.size ());
947 partial_symbol
**bound
= gbound
;
949 /* Go through all of the symbols stored in a partial
950 symtab in one loop. */
951 partial_symbol
**psym
= ps
->global_psymbols
.data ();
953 if ((search_flags
& SEARCH_GLOBAL_BLOCK
) == 0)
955 if (ps
->static_psymbols
.empty ())
959 psym
= ps
->static_psymbols
.data ();
968 if (bound
== gbound
&& !ps
->static_psymbols
.empty ()
969 && (search_flags
& SEARCH_STATIC_BLOCK
) != 0)
971 psym
= ps
->static_psymbols
.data ();
982 if ((domain
== UNDEF_DOMAIN
983 || symbol_matches_domain ((*psym
)->ginfo
.language (),
984 (*psym
)->domain
, domain
))
985 && (search
== ALL_DOMAIN
986 || (search
== MODULES_DOMAIN
987 && (*psym
)->domain
== MODULE_DOMAIN
)
988 || (search
== VARIABLES_DOMAIN
989 && (*psym
)->aclass
!= LOC_TYPEDEF
990 && (*psym
)->aclass
!= LOC_BLOCK
)
991 || (search
== FUNCTIONS_DOMAIN
992 && (*psym
)->aclass
== LOC_BLOCK
)
993 || (search
== TYPES_DOMAIN
994 && (*psym
)->aclass
== LOC_TYPEDEF
))
995 && psymbol_name_matches (*psym
, lookup_name
)
996 && (sym_matcher
== NULL
997 || sym_matcher ((*psym
)->ginfo
.search_name ())))
999 /* Found a match, so notify our caller. */
1000 result
= PST_SEARCHED_AND_FOUND
;
1007 ps
->searched_flag
= result
;
1008 return result
== PST_SEARCHED_AND_FOUND
;
1011 /* Psymtab version of expand_symtabs_matching. See its definition in
1012 the definition of quick_symbol_functions in symfile.h. */
1015 psymbol_functions::expand_symtabs_matching
1016 (struct objfile
*objfile
,
1017 gdb::function_view
<expand_symtabs_file_matcher_ftype
> file_matcher
,
1018 const lookup_name_info
*lookup_name
,
1019 gdb::function_view
<expand_symtabs_symbol_matcher_ftype
> symbol_matcher
,
1020 gdb::function_view
<expand_symtabs_exp_notify_ftype
> expansion_notify
,
1021 block_search_flags search_flags
,
1023 enum search_domain search
)
1025 /* Clear the search flags. */
1026 for (partial_symtab
*ps
: partial_symbols (objfile
))
1027 ps
->searched_flag
= PST_NOT_SEARCHED
;
1029 gdb::optional
<lookup_name_info
> psym_lookup_name
;
1030 if (lookup_name
!= nullptr)
1031 psym_lookup_name
= lookup_name
->make_ignore_params ();
1033 /* This invariant is documented in quick-functions.h. */
1034 gdb_assert (lookup_name
!= nullptr || symbol_matcher
== nullptr);
1036 for (partial_symtab
*ps
: m_partial_symtabs
->range ())
1040 if (ps
->readin_p (objfile
))
1050 match
= file_matcher (ps
->filename
, false);
1053 /* Before we invoke realpath, which can get expensive when many
1054 files are involved, do a quick comparison of the basenames. */
1055 if (basenames_may_differ
1056 || file_matcher (lbasename (ps
->filename
), true))
1057 match
= file_matcher (psymtab_to_fullname (ps
), false);
1063 if (lookup_name
== nullptr
1064 || recursively_search_psymtabs (ps
, objfile
, search_flags
,
1069 compunit_symtab
*cust
= psymtab_to_symtab (objfile
, ps
);
1071 if (cust
!= nullptr && expansion_notify
!= nullptr)
1072 if (!expansion_notify (cust
))
1080 /* Psymtab version of has_symbols. See its definition in
1081 the definition of quick_symbol_functions in symfile.h. */
1084 psymbol_functions::has_symbols (struct objfile
*objfile
)
1086 return m_partial_symtabs
->psymtabs
!= NULL
;
1089 /* See quick_symbol_functions::has_unexpanded_symtabs in quick-symbol.h. */
1092 psymbol_functions::has_unexpanded_symtabs (struct objfile
*objfile
)
1094 for (partial_symtab
*psymtab
: partial_symbols (objfile
))
1096 /* Is this already expanded? */
1097 if (psymtab
->readin_p (objfile
))
1100 /* It has not yet been expanded. */
1107 /* Helper function for psym_find_compunit_symtab_by_address that fills
1108 in m_psymbol_map for a given range of psymbols. */
1111 psymbol_functions::fill_psymbol_map
1112 (struct objfile
*objfile
,
1113 struct partial_symtab
*psymtab
,
1114 std::set
<CORE_ADDR
> *seen_addrs
,
1115 const std::vector
<partial_symbol
*> &symbols
)
1117 for (partial_symbol
*psym
: symbols
)
1119 if (psym
->aclass
== LOC_STATIC
)
1121 CORE_ADDR addr
= psym
->address (objfile
);
1122 if (seen_addrs
->find (addr
) == seen_addrs
->end ())
1124 seen_addrs
->insert (addr
);
1125 m_psymbol_map
.emplace_back (addr
, psymtab
);
1131 /* See find_compunit_symtab_by_address in quick_symbol_functions, in
1135 psymbol_functions::find_compunit_symtab_by_address (struct objfile
*objfile
,
1138 if (m_psymbol_map
.empty ())
1140 std::set
<CORE_ADDR
> seen_addrs
;
1142 for (partial_symtab
*pst
: partial_symbols (objfile
))
1144 fill_psymbol_map (objfile
, pst
,
1146 pst
->global_psymbols
);
1147 fill_psymbol_map (objfile
, pst
,
1149 pst
->static_psymbols
);
1152 m_psymbol_map
.shrink_to_fit ();
1154 std::sort (m_psymbol_map
.begin (), m_psymbol_map
.end (),
1155 [] (const std::pair
<CORE_ADDR
, partial_symtab
*> &a
,
1156 const std::pair
<CORE_ADDR
, partial_symtab
*> &b
)
1158 return a
.first
< b
.first
;
1162 auto iter
= std::lower_bound
1163 (m_psymbol_map
.begin (), m_psymbol_map
.end (), address
,
1164 [] (const std::pair
<CORE_ADDR
, partial_symtab
*> &a
,
1170 if (iter
== m_psymbol_map
.end () || iter
->first
!= address
)
1173 return psymtab_to_symtab (objfile
, iter
->second
);
1178 /* Partially fill a partial symtab. It will be completely filled at
1179 the end of the symbol list. */
1181 partial_symtab::partial_symtab (const char *filename
,
1182 psymtab_storage
*partial_symtabs
,
1183 objfile_per_bfd_storage
*objfile_per_bfd
,
1185 : partial_symtab (filename
, partial_symtabs
, objfile_per_bfd
)
1187 set_text_low (textlow
);
1188 set_text_high (raw_text_low ()); /* default */
1191 /* Perform "finishing up" operations of a partial symtab. */
1194 partial_symtab::end ()
1196 global_psymbols
.shrink_to_fit ();
1197 static_psymbols
.shrink_to_fit ();
1199 /* Sort the global list; don't sort the static list. */
1200 std::sort (global_psymbols
.begin (),
1201 global_psymbols
.end (),
1202 [] (partial_symbol
*s1
, partial_symbol
*s2
)
1204 return strcmp_iw_ordered (s1
->ginfo
.search_name (),
1205 s2
->ginfo
.search_name ()) < 0;
1209 /* See psymtab.h. */
1212 psymbol_bcache::hash (const void *addr
, int length
)
1214 unsigned long h
= 0;
1215 struct partial_symbol
*psymbol
= (struct partial_symbol
*) addr
;
1216 unsigned int lang
= psymbol
->ginfo
.language ();
1217 unsigned int domain
= psymbol
->domain
;
1218 unsigned int theclass
= psymbol
->aclass
;
1220 h
= fast_hash (&psymbol
->ginfo
.m_value
, sizeof (psymbol
->ginfo
.m_value
), h
);
1221 h
= fast_hash (&lang
, sizeof (unsigned int), h
);
1222 h
= fast_hash (&domain
, sizeof (unsigned int), h
);
1223 h
= fast_hash (&theclass
, sizeof (unsigned int), h
);
1224 /* Note that psymbol names are interned via compute_and_set_names, so
1225 there's no need to hash the contents of the name here. */
1226 h
= fast_hash (&psymbol
->ginfo
.m_name
, sizeof (psymbol
->ginfo
.m_name
), h
);
1231 /* See psymtab.h. */
1234 psymbol_bcache::compare (const void *addr1
, const void *addr2
, int length
)
1236 struct partial_symbol
*sym1
= (struct partial_symbol
*) addr1
;
1237 struct partial_symbol
*sym2
= (struct partial_symbol
*) addr2
;
1239 return (memcmp (&sym1
->ginfo
.m_value
, &sym2
->ginfo
.m_value
,
1240 sizeof (sym1
->ginfo
.m_value
)) == 0
1241 && sym1
->ginfo
.language () == sym2
->ginfo
.language ()
1242 && sym1
->domain
== sym2
->domain
1243 && sym1
->aclass
== sym2
->aclass
1244 /* Note that psymbol names are interned via
1245 compute_and_set_names, so there's no need to compare the
1246 contents of the name here. */
1247 && sym1
->ginfo
.linkage_name () == sym2
->ginfo
.linkage_name ());
1250 /* See psympriv.h. */
1253 partial_symtab::add_psymbol (const partial_symbol
&psymbol
,
1254 psymbol_placement where
,
1255 psymtab_storage
*partial_symtabs
,
1256 struct objfile
*objfile
)
1260 /* Stash the partial symbol away in the cache. */
1261 partial_symbol
*psym
1262 = ((struct partial_symbol
*)
1263 partial_symtabs
->psymbol_cache
.insert
1264 (&psymbol
, sizeof (struct partial_symbol
), &added
));
1266 /* Do not duplicate global partial symbols. */
1267 if (where
== psymbol_placement::GLOBAL
&& !added
)
1270 /* Save pointer to partial symbol in psymtab, growing symtab if needed. */
1271 std::vector
<partial_symbol
*> &list
1272 = (where
== psymbol_placement::STATIC
1275 list
.push_back (psym
);
1278 /* See psympriv.h. */
1281 partial_symtab::add_psymbol (gdb::string_view name
, bool copy_name
,
1283 enum address_class theclass
,
1285 psymbol_placement where
,
1287 enum language language
,
1288 psymtab_storage
*partial_symtabs
,
1289 struct objfile
*objfile
)
1291 struct partial_symbol psymbol
;
1292 memset (&psymbol
, 0, sizeof (psymbol
));
1294 psymbol
.set_unrelocated_address (coreaddr
);
1295 psymbol
.ginfo
.set_section_index (section
);
1296 psymbol
.domain
= domain
;
1297 psymbol
.aclass
= theclass
;
1298 psymbol
.ginfo
.set_language (language
, partial_symtabs
->obstack ());
1299 psymbol
.ginfo
.compute_and_set_names (name
, copy_name
, objfile
->per_bfd
);
1301 add_psymbol (psymbol
, where
, partial_symtabs
, objfile
);
1304 /* See psympriv.h. */
1306 partial_symtab::partial_symtab (const char *filename_
,
1307 psymtab_storage
*partial_symtabs
,
1308 objfile_per_bfd_storage
*objfile_per_bfd
)
1309 : searched_flag (PST_NOT_SEARCHED
),
1313 partial_symtabs
->install_psymtab (this);
1315 filename
= objfile_per_bfd
->intern (filename_
);
1317 if (symtab_create_debug
>= 1)
1319 /* Be a bit clever with debugging messages, and don't print objfile
1320 every time, only when it changes. */
1321 static std::string last_bfd_name
;
1322 const char *this_bfd_name
1323 = bfd_get_filename (objfile_per_bfd
->get_bfd ());
1325 if (last_bfd_name
.empty () || last_bfd_name
!= this_bfd_name
)
1327 last_bfd_name
= this_bfd_name
;
1329 symtab_create_debug_printf ("creating one or more psymtabs for %s",
1333 symtab_create_debug_printf ("created psymtab %s for module %s",
1334 host_address_to_string (this), filename
);
1338 /* See psympriv.h. */
1341 partial_symtab::expand_dependencies (struct objfile
*objfile
)
1343 for (int i
= 0; i
< number_of_dependencies
; ++i
)
1345 if (!dependencies
[i
]->readin_p (objfile
)
1346 && dependencies
[i
]->user
== NULL
)
1348 /* Inform about additional files to be read in. */
1352 gdb_stdout
->wrap_here (0);
1354 gdb_stdout
->wrap_here (0);
1355 gdb_printf ("%s...", dependencies
[i
]->filename
);
1356 gdb_flush (gdb_stdout
);
1358 dependencies
[i
]->expand_psymtab (objfile
);
1365 psymtab_storage::discard_psymtab (struct partial_symtab
*pst
)
1367 struct partial_symtab
**prev_pst
;
1370 Empty psymtabs happen as a result of header files which don't
1371 have any symbols in them. There can be a lot of them. But this
1372 check is wrong, in that a psymtab with N_SLINE entries but
1373 nothing else is not empty, but we don't realize that. Fixing
1374 that without slowing things down might be tricky. */
1376 /* First, snip it out of the psymtab chain. */
1378 prev_pst
= &psymtabs
;
1379 while ((*prev_pst
) != pst
)
1380 prev_pst
= &((*prev_pst
)->next
);
1381 (*prev_pst
) = pst
->next
;
1388 maintenance_print_psymbols (const char *args
, int from_tty
)
1390 struct ui_file
*outfile
= gdb_stdout
;
1391 char *address_arg
= NULL
, *source_arg
= NULL
, *objfile_arg
= NULL
;
1392 int i
, outfile_idx
, found
;
1394 struct obj_section
*section
= NULL
;
1398 gdb_argv
argv (args
);
1400 for (i
= 0; argv
!= NULL
&& argv
[i
] != NULL
; ++i
)
1402 if (strcmp (argv
[i
], "-pc") == 0)
1404 if (argv
[i
+ 1] == NULL
)
1405 error (_("Missing pc value"));
1406 address_arg
= argv
[++i
];
1408 else if (strcmp (argv
[i
], "-source") == 0)
1410 if (argv
[i
+ 1] == NULL
)
1411 error (_("Missing source file"));
1412 source_arg
= argv
[++i
];
1414 else if (strcmp (argv
[i
], "-objfile") == 0)
1416 if (argv
[i
+ 1] == NULL
)
1417 error (_("Missing objfile name"));
1418 objfile_arg
= argv
[++i
];
1420 else if (strcmp (argv
[i
], "--") == 0)
1422 /* End of options. */
1426 else if (argv
[i
][0] == '-')
1428 /* Future proofing: Don't allow OUTFILE to begin with "-". */
1429 error (_("Unknown option: %s"), argv
[i
]);
1436 if (address_arg
!= NULL
&& source_arg
!= NULL
)
1437 error (_("Must specify at most one of -pc and -source"));
1439 stdio_file arg_outfile
;
1441 if (argv
!= NULL
&& argv
[outfile_idx
] != NULL
)
1443 if (argv
[outfile_idx
+ 1] != NULL
)
1444 error (_("Junk at end of command"));
1445 gdb::unique_xmalloc_ptr
<char> outfile_name
1446 (tilde_expand (argv
[outfile_idx
]));
1447 if (!arg_outfile
.open (outfile_name
.get (), FOPEN_WT
))
1448 perror_with_name (outfile_name
.get ());
1449 outfile
= &arg_outfile
;
1452 if (address_arg
!= NULL
)
1454 pc
= parse_and_eval_address (address_arg
);
1455 /* If we fail to find a section, that's ok, try the lookup anyway. */
1456 section
= find_pc_section (pc
);
1460 for (objfile
*objfile
: current_program_space
->objfiles ())
1462 int printed_objfile_header
= 0;
1463 int print_for_objfile
= 1;
1466 if (objfile_arg
!= NULL
)
1468 = compare_filenames_for_search (objfile_name (objfile
),
1470 if (!print_for_objfile
)
1473 for (const auto &iter
: objfile
->qf
)
1475 psymbol_functions
*psf
1476 = dynamic_cast<psymbol_functions
*> (iter
.get ());
1480 if (address_arg
!= NULL
)
1482 struct bound_minimal_symbol msymbol
;
1484 /* We don't assume each pc has a unique objfile (this is for
1486 struct partial_symtab
*ps
1487 = psf
->find_pc_sect_psymtab (objfile
, pc
, section
, msymbol
);
1490 if (!printed_objfile_header
)
1492 outfile
->printf ("\nPartial symtabs for objfile %s\n",
1493 objfile_name (objfile
));
1494 printed_objfile_header
= 1;
1496 dump_psymtab (objfile
, ps
, outfile
);
1502 for (partial_symtab
*ps
: psf
->partial_symbols (objfile
))
1504 int print_for_source
= 0;
1507 if (source_arg
!= NULL
)
1510 = compare_filenames_for_search (ps
->filename
, source_arg
);
1513 if (source_arg
== NULL
1514 || print_for_source
)
1516 if (!printed_objfile_header
)
1518 outfile
->printf ("\nPartial symtabs for objfile %s\n",
1519 objfile_name (objfile
));
1520 printed_objfile_header
= 1;
1522 dump_psymtab (objfile
, ps
, outfile
);
1531 if (address_arg
!= NULL
)
1532 error (_("No partial symtab for address: %s"), address_arg
);
1533 if (source_arg
!= NULL
)
1534 error (_("No partial symtab for source file: %s"), source_arg
);
1538 /* List all the partial symbol tables whose names match REGEXP (optional). */
1541 maintenance_info_psymtabs (const char *regexp
, int from_tty
)
1546 for (struct program_space
*pspace
: program_spaces
)
1547 for (objfile
*objfile
: pspace
->objfiles ())
1549 struct gdbarch
*gdbarch
= objfile
->arch ();
1551 /* We don't want to print anything for this objfile until we
1552 actually find a symtab whose name matches. */
1553 int printed_objfile_start
= 0;
1555 for (const auto &iter
: objfile
->qf
)
1557 psymbol_functions
*psf
1558 = dynamic_cast<psymbol_functions
*> (iter
.get ());
1561 for (partial_symtab
*psymtab
: psf
->partial_symbols (objfile
))
1566 || re_exec (psymtab
->filename
))
1568 if (! printed_objfile_start
)
1570 gdb_printf ("{ objfile %s ", objfile_name (objfile
));
1571 gdb_stdout
->wrap_here (2);
1572 gdb_printf ("((struct objfile *) %s)\n",
1573 host_address_to_string (objfile
));
1574 printed_objfile_start
= 1;
1577 gdb_printf (" { psymtab %s ", psymtab
->filename
);
1578 gdb_stdout
->wrap_here (4);
1579 gdb_printf ("((struct partial_symtab *) %s)\n",
1580 host_address_to_string (psymtab
));
1582 gdb_printf (" readin %s\n",
1583 psymtab
->readin_p (objfile
) ? "yes" : "no");
1584 gdb_printf (" fullname %s\n",
1586 ? psymtab
->fullname
: "(null)");
1587 gdb_printf (" text addresses ");
1588 gdb_puts (paddress (gdbarch
,
1589 psymtab
->text_low (objfile
)));
1590 gdb_printf (" -- ");
1591 gdb_puts (paddress (gdbarch
,
1592 psymtab
->text_high (objfile
)));
1594 gdb_printf (" globals ");
1595 if (!psymtab
->global_psymbols
.empty ())
1597 ("(* (struct partial_symbol **) %s @ %d)\n",
1598 host_address_to_string (psymtab
->global_psymbols
.data ()),
1599 (int) psymtab
->global_psymbols
.size ());
1601 gdb_printf ("(none)\n");
1602 gdb_printf (" statics ");
1603 if (!psymtab
->static_psymbols
.empty ())
1605 ("(* (struct partial_symbol **) %s @ %d)\n",
1606 host_address_to_string (psymtab
->static_psymbols
.data ()),
1607 (int) psymtab
->static_psymbols
.size ());
1609 gdb_printf ("(none)\n");
1611 gdb_printf (" user %s "
1612 "((struct partial_symtab *) %s)\n",
1613 psymtab
->user
->filename
,
1614 host_address_to_string (psymtab
->user
));
1615 gdb_printf (" dependencies ");
1616 if (psymtab
->number_of_dependencies
)
1621 for (i
= 0; i
< psymtab
->number_of_dependencies
; i
++)
1623 struct partial_symtab
*dep
= psymtab
->dependencies
[i
];
1625 /* Note the string concatenation there --- no
1627 gdb_printf (" psymtab %s "
1628 "((struct partial_symtab *) %s)\n",
1630 host_address_to_string (dep
));
1632 gdb_printf (" }\n");
1635 gdb_printf ("(none)\n");
1636 gdb_printf (" }\n");
1641 if (printed_objfile_start
)
1646 /* Check consistency of currently expanded psymtabs vs symtabs. */
1649 maintenance_check_psymtabs (const char *ignore
, int from_tty
)
1652 struct compunit_symtab
*cust
= NULL
;
1653 const struct blockvector
*bv
;
1654 const struct block
*b
;
1656 for (objfile
*objfile
: current_program_space
->objfiles ())
1658 for (const auto &iter
: objfile
->qf
)
1660 psymbol_functions
*psf
1661 = dynamic_cast<psymbol_functions
*> (iter
.get ());
1665 for (partial_symtab
*ps
: psf
->partial_symbols (objfile
))
1667 struct gdbarch
*gdbarch
= objfile
->arch ();
1669 /* We don't call psymtab_to_symtab here because that may cause symtab
1670 expansion. When debugging a problem it helps if checkers leave
1671 things unchanged. */
1672 cust
= ps
->get_compunit_symtab (objfile
);
1674 /* First do some checks that don't require the associated symtab. */
1675 if (ps
->text_high (objfile
) < ps
->text_low (objfile
))
1677 gdb_printf ("Psymtab ");
1678 gdb_puts (ps
->filename
);
1679 gdb_printf (" covers bad range ");
1680 gdb_puts (paddress (gdbarch
, ps
->text_low (objfile
)));
1682 gdb_puts (paddress (gdbarch
, ps
->text_high (objfile
)));
1687 /* Now do checks requiring the associated symtab. */
1690 bv
= cust
->blockvector ();
1691 b
= bv
->static_block ();
1692 for (partial_symbol
*psym
: ps
->static_psymbols
)
1694 /* Skip symbols for inlined functions without address. These may
1695 or may not have a match in the full symtab. */
1696 if (psym
->aclass
== LOC_BLOCK
1697 && psym
->ginfo
.value_address () == 0)
1700 sym
= block_lookup_symbol (b
, psym
->ginfo
.search_name (),
1701 symbol_name_match_type::SEARCH_NAME
,
1705 gdb_printf ("Static symbol `");
1706 gdb_puts (psym
->ginfo
.linkage_name ());
1707 gdb_printf ("' only found in ");
1708 gdb_puts (ps
->filename
);
1709 gdb_printf (" psymtab\n");
1712 b
= bv
->global_block ();
1713 for (partial_symbol
*psym
: ps
->global_psymbols
)
1715 sym
= block_lookup_symbol (b
, psym
->ginfo
.search_name (),
1716 symbol_name_match_type::SEARCH_NAME
,
1720 gdb_printf ("Global symbol `");
1721 gdb_puts (psym
->ginfo
.linkage_name ());
1722 gdb_printf ("' only found in ");
1723 gdb_puts (ps
->filename
);
1724 gdb_printf (" psymtab\n");
1727 if (ps
->raw_text_high () != 0
1728 && (ps
->text_low (objfile
) < b
->start ()
1729 || ps
->text_high (objfile
) > b
->end ()))
1731 gdb_printf ("Psymtab ");
1732 gdb_puts (ps
->filename
);
1733 gdb_printf (" covers ");
1734 gdb_puts (paddress (gdbarch
, ps
->text_low (objfile
)));
1736 gdb_puts (paddress (gdbarch
, ps
->text_high (objfile
)));
1737 gdb_printf (" but symtab covers only ");
1738 gdb_puts (paddress (gdbarch
, b
->start ()));
1740 gdb_puts (paddress (gdbarch
, b
->end ()));
1748 void _initialize_psymtab ();
1750 _initialize_psymtab ()
1752 add_cmd ("psymbols", class_maintenance
, maintenance_print_psymbols
, _("\
1753 Print dump of current partial symbol definitions.\n\
1754 Usage: mt print psymbols [-objfile OBJFILE] [-pc ADDRESS] [--] [OUTFILE]\n\
1755 mt print psymbols [-objfile OBJFILE] [-source SOURCE] [--] [OUTFILE]\n\
1756 Entries in the partial symbol table are dumped to file OUTFILE,\n\
1757 or the terminal if OUTFILE is unspecified.\n\
1758 If ADDRESS is provided, dump only the file for that address.\n\
1759 If SOURCE is provided, dump only that file's symbols.\n\
1760 If OBJFILE is provided, dump only that file's minimal symbols."),
1761 &maintenanceprintlist
);
1763 add_cmd ("psymtabs", class_maintenance
, maintenance_info_psymtabs
, _("\
1764 List the partial symbol tables for all object files.\n\
1765 This does not include information about individual partial symbols,\n\
1766 just the symbol table structures themselves."),
1767 &maintenanceinfolist
);
1769 add_cmd ("check-psymtabs", class_maintenance
, maintenance_check_psymtabs
,
1771 Check consistency of currently expanded psymtabs versus symtabs."),