1 /* Partial symbol tables.
3 Copyright (C) 2009, 2010 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/>. */
24 #include "gdb_assert.h"
26 #include "filenames.h"
33 #include "readline/readline.h"
34 #include "gdb_regex.h"
37 #define DEV_TTY "/dev/tty"
42 struct bcache *bcache;
45 /* A fast way to get from a psymtab to its symtab (after the first time). */
46 #define PSYMTAB_TO_SYMTAB(pst) \
47 ((pst) -> symtab != NULL ? (pst) -> symtab : psymtab_to_symtab (pst))
49 /* Lookup a partial symbol. */
50 static struct partial_symbol *lookup_partial_symbol (struct partial_symtab *,
54 static char *psymtab_to_fullname (struct partial_symtab *ps);
56 static struct partial_symbol *find_pc_sect_psymbol (struct partial_symtab *,
58 struct obj_section *);
60 static struct partial_symbol *fixup_psymbol_section (struct partial_symbol
62 struct objfile *objfile);
64 static struct symtab *psymtab_to_symtab (struct partial_symtab *pst);
66 /* Lookup the partial symbol table of a source file named NAME.
67 *If* there is no '/' in the name, a match after a '/'
68 in the psymtab filename will also work. */
70 static struct partial_symtab *
71 lookup_partial_symtab (struct objfile *objfile, const char *name,
72 const char *full_path, const char *real_path)
74 struct partial_symtab *pst;
76 ALL_OBJFILE_PSYMTABS (objfile, pst)
78 if (FILENAME_CMP (name, pst->filename) == 0)
83 /* If the user gave us an absolute path, try to find the file in
84 this symtab and use its absolute path. */
85 if (full_path != NULL)
87 psymtab_to_fullname (pst);
88 if (pst->fullname != NULL
89 && FILENAME_CMP (full_path, pst->fullname) == 0)
95 if (real_path != NULL)
98 psymtab_to_fullname (pst);
99 if (pst->fullname != NULL)
101 rp = gdb_realpath (pst->fullname);
102 make_cleanup (xfree, rp);
104 if (rp != NULL && FILENAME_CMP (real_path, rp) == 0)
111 /* Now, search for a matching tail (only if name doesn't have any dirs) */
113 if (lbasename (name) == name)
114 ALL_OBJFILE_PSYMTABS (objfile, pst)
116 if (FILENAME_CMP (lbasename (pst->filename), name) == 0)
124 lookup_symtab_via_partial_symtab (struct objfile *objfile, const char *name,
125 const char *full_path, const char *real_path,
126 struct symtab **result)
128 struct partial_symtab *ps;
130 ps = lookup_partial_symtab (objfile, name, full_path, real_path);
135 error (_("Internal: readin %s pst for `%s' found when no symtab found."),
138 *result = PSYMTAB_TO_SYMTAB (ps);
142 /* Find which partial symtab contains PC and SECTION starting at psymtab PST.
143 We may find a different psymtab than PST. See FIND_PC_SECT_PSYMTAB. */
145 static struct partial_symtab *
146 find_pc_sect_psymtab_closer (CORE_ADDR pc, struct obj_section *section,
147 struct partial_symtab *pst,
148 struct minimal_symbol *msymbol)
150 struct objfile *objfile = pst->objfile;
151 struct partial_symtab *tpst;
152 struct partial_symtab *best_pst = pst;
153 CORE_ADDR best_addr = pst->textlow;
155 /* An objfile that has its functions reordered might have
156 many partial symbol tables containing the PC, but
157 we want the partial symbol table that contains the
158 function containing the PC. */
159 if (!(objfile->flags & OBJF_REORDERED) &&
160 section == 0) /* can't validate section this way */
166 /* The code range of partial symtabs sometimes overlap, so, in
167 the loop below, we need to check all partial symtabs and
168 find the one that fits better for the given PC address. We
169 select the partial symtab that contains a symbol whose
170 address is closest to the PC address. By closest we mean
171 that find_pc_sect_symbol returns the symbol with address
172 that is closest and still less than the given PC. */
173 for (tpst = pst; tpst != NULL; tpst = tpst->next)
175 if (pc >= tpst->textlow && pc < tpst->texthigh)
177 struct partial_symbol *p;
180 /* NOTE: This assumes that every psymbol has a
181 corresponding msymbol, which is not necessarily
182 true; the debug info might be much richer than the
183 object's symbol table. */
184 p = find_pc_sect_psymbol (tpst, pc, section);
186 && SYMBOL_VALUE_ADDRESS (p)
187 == SYMBOL_VALUE_ADDRESS (msymbol))
190 /* Also accept the textlow value of a psymtab as a
191 "symbol", to provide some support for partial
192 symbol tables with line information but no debug
193 symbols (e.g. those produced by an assembler). */
195 this_addr = SYMBOL_VALUE_ADDRESS (p);
197 this_addr = tpst->textlow;
199 /* Check whether it is closer than our current
200 BEST_ADDR. Since this symbol address is
201 necessarily lower or equal to PC, the symbol closer
202 to PC is the symbol which address is the highest.
203 This way we return the psymtab which contains such
204 best match symbol. This can help in cases where the
205 symbol information/debuginfo is not complete, like
206 for instance on IRIX6 with gcc, where no debug info
207 is emitted for statics. (See also the nodebug.exp
209 if (this_addr > best_addr)
211 best_addr = this_addr;
219 /* Find which partial symtab contains PC and SECTION. Return 0 if
220 none. We return the psymtab that contains a symbol whose address
221 exactly matches PC, or, if we cannot find an exact match, the
222 psymtab that contains a symbol whose address is closest to PC. */
223 static struct partial_symtab *
224 find_pc_sect_psymtab (struct objfile *objfile, CORE_ADDR pc,
225 struct obj_section *section,
226 struct minimal_symbol *msymbol)
228 struct partial_symtab *pst;
230 /* Try just the PSYMTABS_ADDRMAP mapping first as it has better granularity
231 than the later used TEXTLOW/TEXTHIGH one. */
233 if (objfile->psymtabs_addrmap != NULL)
235 pst = addrmap_find (objfile->psymtabs_addrmap, pc);
238 /* FIXME: addrmaps currently do not handle overlayed sections,
239 so fall back to the non-addrmap case if we're debugging
240 overlays and the addrmap returned the wrong section. */
241 if (overlay_debugging && msymbol && section)
243 struct partial_symbol *p;
245 /* NOTE: This assumes that every psymbol has a
246 corresponding msymbol, which is not necessarily
247 true; the debug info might be much richer than the
248 object's symbol table. */
249 p = find_pc_sect_psymbol (pst, pc, section);
251 || SYMBOL_VALUE_ADDRESS (p)
252 != SYMBOL_VALUE_ADDRESS (msymbol))
256 /* We do not try to call FIND_PC_SECT_PSYMTAB_CLOSER as
257 PSYMTABS_ADDRMAP we used has already the best 1-byte
258 granularity and FIND_PC_SECT_PSYMTAB_CLOSER may mislead us into
259 a worse chosen section due to the TEXTLOW/TEXTHIGH ranges
268 /* Existing PSYMTABS_ADDRMAP mapping is present even for PARTIAL_SYMTABs
269 which still have no corresponding full SYMTABs read. But it is not
270 present for non-DWARF2 debug infos not supporting PSYMTABS_ADDRMAP in GDB
273 /* Check even OBJFILE with non-zero PSYMTABS_ADDRMAP as only several of
274 its CUs may be missing in PSYMTABS_ADDRMAP as they may be varying
275 debug info type in single OBJFILE. */
277 ALL_OBJFILE_PSYMTABS (objfile, pst)
278 if (pc >= pst->textlow && pc < pst->texthigh)
280 struct partial_symtab *best_pst;
282 best_pst = find_pc_sect_psymtab_closer (pc, section, pst, msymbol);
283 if (best_pst != NULL)
290 static struct symtab *
291 find_pc_sect_symtab_from_partial (struct objfile *objfile,
292 struct minimal_symbol *msymbol,
293 CORE_ADDR pc, struct obj_section *section,
296 struct partial_symtab *ps = find_pc_sect_psymtab (objfile, pc, section,
300 if (warn_if_readin && ps->readin)
301 /* Might want to error() here (in case symtab is corrupt and
302 will cause a core dump), but maybe we can successfully
303 continue, so let's not. */
305 (Internal error: pc %s in read in psymtab, but not in symtab.)\n"),
306 paddress (get_objfile_arch (ps->objfile), pc));
307 return PSYMTAB_TO_SYMTAB (ps);
312 /* Find which partial symbol within a psymtab matches PC and SECTION.
315 static struct partial_symbol *
316 find_pc_sect_psymbol (struct partial_symtab *psymtab, CORE_ADDR pc,
317 struct obj_section *section)
319 struct partial_symbol *best = NULL, *p, **pp;
322 gdb_assert (psymtab != NULL);
324 /* Cope with programs that start at address 0 */
325 best_pc = (psymtab->textlow != 0) ? psymtab->textlow - 1 : 0;
327 /* Search the global symbols as well as the static symbols, so that
328 find_pc_partial_function doesn't use a minimal symbol and thus
329 cache a bad endaddr. */
330 for (pp = psymtab->objfile->global_psymbols.list + psymtab->globals_offset;
331 (pp - (psymtab->objfile->global_psymbols.list + psymtab->globals_offset)
332 < psymtab->n_global_syms);
336 if (SYMBOL_DOMAIN (p) == VAR_DOMAIN
337 && SYMBOL_CLASS (p) == LOC_BLOCK
338 && pc >= SYMBOL_VALUE_ADDRESS (p)
339 && (SYMBOL_VALUE_ADDRESS (p) > best_pc
340 || (psymtab->textlow == 0
341 && best_pc == 0 && SYMBOL_VALUE_ADDRESS (p) == 0)))
343 if (section) /* match on a specific section */
345 fixup_psymbol_section (p, psymtab->objfile);
346 if (!matching_obj_sections (SYMBOL_OBJ_SECTION (p), section))
349 best_pc = SYMBOL_VALUE_ADDRESS (p);
354 for (pp = psymtab->objfile->static_psymbols.list + psymtab->statics_offset;
355 (pp - (psymtab->objfile->static_psymbols.list + psymtab->statics_offset)
356 < psymtab->n_static_syms);
360 if (SYMBOL_DOMAIN (p) == VAR_DOMAIN
361 && SYMBOL_CLASS (p) == LOC_BLOCK
362 && pc >= SYMBOL_VALUE_ADDRESS (p)
363 && (SYMBOL_VALUE_ADDRESS (p) > best_pc
364 || (psymtab->textlow == 0
365 && best_pc == 0 && SYMBOL_VALUE_ADDRESS (p) == 0)))
367 if (section) /* match on a specific section */
369 fixup_psymbol_section (p, psymtab->objfile);
370 if (!matching_obj_sections (SYMBOL_OBJ_SECTION (p), section))
373 best_pc = SYMBOL_VALUE_ADDRESS (p);
381 static struct partial_symbol *
382 fixup_psymbol_section (struct partial_symbol *psym, struct objfile *objfile)
389 if (SYMBOL_OBJ_SECTION (psym))
392 gdb_assert (objfile);
394 switch (SYMBOL_CLASS (psym))
399 addr = SYMBOL_VALUE_ADDRESS (psym);
402 /* Nothing else will be listed in the minsyms -- no use looking
407 fixup_section (&psym->ginfo, addr, objfile);
412 static struct symtab *
413 lookup_symbol_aux_psymtabs (struct objfile *objfile,
414 int block_index, const char *name,
415 const domain_enum domain)
417 struct partial_symtab *ps;
418 const int psymtab_index = (block_index == GLOBAL_BLOCK ? 1 : 0);
420 ALL_OBJFILE_PSYMTABS (objfile, ps)
422 if (!ps->readin && lookup_partial_symbol (ps, name, psymtab_index, domain))
423 return PSYMTAB_TO_SYMTAB (ps);
429 static struct symbol *
430 expand_one_symtab_matching_psymtabs (struct objfile *objfile,
431 int kind, const char *name,
433 struct symbol *(*matcher) (struct symtab *,
443 /* Look, in partial_symtab PST, for symbol whose natural name is NAME.
444 Check the global symbols if GLOBAL, the static symbols if not. */
446 static struct partial_symbol *
447 lookup_partial_symbol (struct partial_symtab *pst, const char *name,
448 int global, domain_enum domain)
450 struct partial_symbol **start, **psym;
451 struct partial_symbol **top, **real_top, **bottom, **center;
452 int length = (global ? pst->n_global_syms : pst->n_static_syms);
453 int do_linear_search = 1;
460 pst->objfile->global_psymbols.list + pst->globals_offset :
461 pst->objfile->static_psymbols.list + pst->statics_offset);
463 if (global) /* This means we can use a binary search. */
465 do_linear_search = 0;
467 /* Binary search. This search is guaranteed to end with center
468 pointing at the earliest partial symbol whose name might be
469 correct. At that point *all* partial symbols with an
470 appropriate name will be checked against the correct
474 top = start + length - 1;
478 center = bottom + (top - bottom) / 2;
480 internal_error (__FILE__, __LINE__, _("failed internal consistency check"));
481 if (!do_linear_search
482 && (SYMBOL_LANGUAGE (*center) == language_java))
484 do_linear_search = 1;
486 if (strcmp_iw_ordered (SYMBOL_SEARCH_NAME (*center), name) >= 0)
495 if (!(top == bottom))
496 internal_error (__FILE__, __LINE__, _("failed internal consistency check"));
498 while (top <= real_top
499 && SYMBOL_MATCHES_SEARCH_NAME (*top, name))
501 if (symbol_matches_domain (SYMBOL_LANGUAGE (*top),
502 SYMBOL_DOMAIN (*top), domain))
508 /* Can't use a binary search or else we found during the binary search that
509 we should also do a linear search. */
511 if (do_linear_search)
513 for (psym = start; psym < start + length; psym++)
515 if (symbol_matches_domain (SYMBOL_LANGUAGE (*psym),
516 SYMBOL_DOMAIN (*psym), domain)
517 && SYMBOL_MATCHES_SEARCH_NAME (*psym, name))
525 /* Get the symbol table that corresponds to a partial_symtab.
526 This is fast after the first time you do it. In fact, there
527 is an even faster macro PSYMTAB_TO_SYMTAB that does the fast
530 static struct symtab *
531 psymtab_to_symtab (struct partial_symtab *pst)
533 /* If it's been looked up before, return it. */
537 /* If it has not yet been read in, read it. */
540 struct cleanup *back_to = increment_reading_symtab ();
542 (*pst->read_symtab) (pst);
543 do_cleanups (back_to);
550 relocate_psymtabs (struct objfile *objfile,
551 struct section_offsets *new_offsets,
552 struct section_offsets *delta)
554 struct partial_symbol **psym;
555 struct partial_symtab *p;
557 ALL_OBJFILE_PSYMTABS (objfile, p)
559 p->textlow += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
560 p->texthigh += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
563 for (psym = objfile->global_psymbols.list;
564 psym < objfile->global_psymbols.next;
567 fixup_psymbol_section (*psym, objfile);
568 if (SYMBOL_SECTION (*psym) >= 0)
569 SYMBOL_VALUE_ADDRESS (*psym) += ANOFFSET (delta,
570 SYMBOL_SECTION (*psym));
572 for (psym = objfile->static_psymbols.list;
573 psym < objfile->static_psymbols.next;
576 fixup_psymbol_section (*psym, objfile);
577 if (SYMBOL_SECTION (*psym) >= 0)
578 SYMBOL_VALUE_ADDRESS (*psym) += ANOFFSET (delta,
579 SYMBOL_SECTION (*psym));
583 static struct symtab *
584 find_last_source_symtab_from_partial (struct objfile *ofp)
586 struct partial_symtab *ps;
587 struct partial_symtab *cs_pst = 0;
589 ALL_OBJFILE_PSYMTABS (ofp, ps)
591 const char *name = ps->filename;
592 int len = strlen (name);
594 if (!(len > 2 && (strcmp (&name[len - 2], ".h") == 0
595 || strcmp (name, "<<C++-namespaces>>") == 0)))
603 internal_error (__FILE__, __LINE__,
604 _("select_source_symtab: "
605 "readin pst found and no symtabs."));
608 return PSYMTAB_TO_SYMTAB (cs_pst);
614 forget_cached_source_info_partial (struct objfile *objfile)
616 struct partial_symtab *pst;
618 ALL_OBJFILE_PSYMTABS (objfile, pst)
620 if (pst->fullname != NULL)
622 xfree (pst->fullname);
623 pst->fullname = NULL;
629 print_partial_symbols (struct gdbarch *gdbarch,
630 struct partial_symbol **p, int count, char *what,
631 struct ui_file *outfile)
633 fprintf_filtered (outfile, " %s partial symbols:\n", what);
636 fprintf_filtered (outfile, " `%s'", SYMBOL_LINKAGE_NAME (*p));
637 if (SYMBOL_DEMANGLED_NAME (*p) != NULL)
639 fprintf_filtered (outfile, " `%s'", SYMBOL_DEMANGLED_NAME (*p));
641 fputs_filtered (", ", outfile);
642 switch (SYMBOL_DOMAIN (*p))
645 fputs_filtered ("undefined domain, ", outfile);
648 /* This is the usual thing -- don't print it */
651 fputs_filtered ("struct domain, ", outfile);
654 fputs_filtered ("label domain, ", outfile);
657 fputs_filtered ("<invalid domain>, ", outfile);
660 switch (SYMBOL_CLASS (*p))
663 fputs_filtered ("undefined", outfile);
666 fputs_filtered ("constant int", outfile);
669 fputs_filtered ("static", outfile);
672 fputs_filtered ("register", outfile);
675 fputs_filtered ("pass by value", outfile);
678 fputs_filtered ("pass by reference", outfile);
680 case LOC_REGPARM_ADDR:
681 fputs_filtered ("register address parameter", outfile);
684 fputs_filtered ("stack parameter", outfile);
687 fputs_filtered ("type", outfile);
690 fputs_filtered ("label", outfile);
693 fputs_filtered ("function", outfile);
695 case LOC_CONST_BYTES:
696 fputs_filtered ("constant bytes", outfile);
699 fputs_filtered ("unresolved", outfile);
701 case LOC_OPTIMIZED_OUT:
702 fputs_filtered ("optimized out", outfile);
705 fputs_filtered ("computed at runtime", outfile);
708 fputs_filtered ("<invalid location>", outfile);
711 fputs_filtered (", ", outfile);
712 fputs_filtered (paddress (gdbarch, SYMBOL_VALUE_ADDRESS (*p)), outfile);
713 fprintf_filtered (outfile, "\n");
719 dump_psymtab (struct objfile *objfile, struct partial_symtab *psymtab,
720 struct ui_file *outfile)
722 struct gdbarch *gdbarch = get_objfile_arch (objfile);
725 fprintf_filtered (outfile, "\nPartial symtab for source file %s ",
727 fprintf_filtered (outfile, "(object ");
728 gdb_print_host_address (psymtab, outfile);
729 fprintf_filtered (outfile, ")\n\n");
730 fprintf_unfiltered (outfile, " Read from object file %s (",
732 gdb_print_host_address (objfile, outfile);
733 fprintf_unfiltered (outfile, ")\n");
737 fprintf_filtered (outfile,
738 " Full symtab was read (at ");
739 gdb_print_host_address (psymtab->symtab, outfile);
740 fprintf_filtered (outfile, " by function at ");
741 gdb_print_host_address (psymtab->read_symtab, outfile);
742 fprintf_filtered (outfile, ")\n");
745 fprintf_filtered (outfile, " Relocate symbols by ");
746 for (i = 0; i < psymtab->objfile->num_sections; ++i)
749 fprintf_filtered (outfile, ", ");
751 fputs_filtered (paddress (gdbarch,
752 ANOFFSET (psymtab->section_offsets, i)),
755 fprintf_filtered (outfile, "\n");
757 fprintf_filtered (outfile, " Symbols cover text addresses ");
758 fputs_filtered (paddress (gdbarch, psymtab->textlow), outfile);
759 fprintf_filtered (outfile, "-");
760 fputs_filtered (paddress (gdbarch, psymtab->texthigh), outfile);
761 fprintf_filtered (outfile, "\n");
762 fprintf_filtered (outfile, " Depends on %d other partial symtabs.\n",
763 psymtab->number_of_dependencies);
764 for (i = 0; i < psymtab->number_of_dependencies; i++)
766 fprintf_filtered (outfile, " %d ", i);
767 gdb_print_host_address (psymtab->dependencies[i], outfile);
768 fprintf_filtered (outfile, " %s\n",
769 psymtab->dependencies[i]->filename);
771 if (psymtab->n_global_syms > 0)
773 print_partial_symbols (gdbarch,
774 objfile->global_psymbols.list
775 + psymtab->globals_offset,
776 psymtab->n_global_syms, "Global", outfile);
778 if (psymtab->n_static_syms > 0)
780 print_partial_symbols (gdbarch,
781 objfile->static_psymbols.list
782 + psymtab->statics_offset,
783 psymtab->n_static_syms, "Static", outfile);
785 fprintf_filtered (outfile, "\n");
789 print_psymtab_stats_for_objfile (struct objfile *objfile)
792 struct partial_symtab *ps;
795 ALL_OBJFILE_PSYMTABS (objfile, ps)
800 printf_filtered (_(" Number of psym tables (not yet expanded): %d\n"), i);
804 dump_psymtabs_for_objfile (struct objfile *objfile)
806 struct partial_symtab *psymtab;
808 if (objfile->psymtabs)
810 printf_filtered ("Psymtabs:\n");
811 for (psymtab = objfile->psymtabs;
813 psymtab = psymtab->next)
815 printf_filtered ("%s at ",
817 gdb_print_host_address (psymtab, gdb_stdout);
818 printf_filtered (", ");
819 if (psymtab->objfile != objfile)
821 printf_filtered ("NOT ON CHAIN! ");
825 printf_filtered ("\n\n");
829 /* Look through the partial symtabs for all symbols which begin
830 by matching FUNC_NAME. Make sure we read that symbol table in. */
833 read_symtabs_for_function (struct objfile *objfile, const char *func_name)
835 struct partial_symtab *ps;
837 ALL_OBJFILE_PSYMTABS (objfile, ps)
842 if ((lookup_partial_symbol (ps, func_name, 1, VAR_DOMAIN)
844 || (lookup_partial_symbol (ps, func_name, 0, VAR_DOMAIN)
846 psymtab_to_symtab (ps);
851 expand_partial_symbol_tables (struct objfile *objfile)
853 struct partial_symtab *psymtab;
855 for (psymtab = objfile->psymtabs;
857 psymtab = psymtab->next)
859 psymtab_to_symtab (psymtab);
864 read_psymtabs_with_filename (struct objfile *objfile, const char *filename)
866 struct partial_symtab *p;
868 ALL_OBJFILE_PSYMTABS (objfile, p)
870 if (strcmp (filename, p->filename) == 0)
871 PSYMTAB_TO_SYMTAB (p);
876 map_symbol_names_psymtab (struct objfile *objfile,
877 void (*fun) (const char *, void *), void *data)
879 struct partial_symtab *ps;
881 ALL_OBJFILE_PSYMTABS (objfile, ps)
883 struct partial_symbol **psym;
885 /* If the psymtab's been read in we'll get it when we search
886 through the blockvector. */
890 for (psym = objfile->global_psymbols.list + ps->globals_offset;
891 psym < (objfile->global_psymbols.list + ps->globals_offset
892 + ps->n_global_syms);
895 /* If interrupted, then quit. */
897 (*fun) (SYMBOL_NATURAL_NAME (*psym), data);
900 for (psym = objfile->static_psymbols.list + ps->statics_offset;
901 psym < (objfile->static_psymbols.list + ps->statics_offset
902 + ps->n_static_syms);
906 (*fun) (SYMBOL_NATURAL_NAME (*psym), data);
912 map_symbol_filenames_psymtab (struct objfile *objfile,
913 void (*fun) (const char *, const char *,
917 struct partial_symtab *ps;
919 ALL_OBJFILE_PSYMTABS (objfile, ps)
921 const char *fullname;
926 fullname = psymtab_to_fullname (ps);
927 (*fun) (ps->filename, fullname, data);
931 int find_and_open_source (const char *filename,
935 /* Finds the fullname that a partial_symtab represents.
937 If this functions finds the fullname, it will save it in ps->fullname
938 and it will also return the value.
940 If this function fails to find the file that this partial_symtab represents,
941 NULL will be returned and ps->fullname will be set to NULL. */
943 psymtab_to_fullname (struct partial_symtab *ps)
950 /* Don't check ps->fullname here, the file could have been
951 deleted/moved/..., look for it again */
952 r = find_and_open_source (ps->filename, ps->dirname, &ps->fullname);
964 find_symbol_file_from_partial (struct objfile *objfile, const char *name)
966 struct partial_symtab *pst;
968 ALL_OBJFILE_PSYMTABS (objfile, pst)
970 if (lookup_partial_symbol (pst, name, 1, VAR_DOMAIN))
971 return pst->filename;
976 /* Look, in partial_symtab PST, for symbol NAME in given namespace.
977 Check the global symbols if GLOBAL, the static symbols if not.
978 Do wild-card match if WILD. */
980 static struct partial_symbol *
981 ada_lookup_partial_symbol (struct partial_symtab *pst, const char *name,
982 int global, domain_enum namespace, int wild,
983 int (*wild_match) (const char *, int, const char *),
984 int (*is_name_suffix) (const char *))
986 struct partial_symbol **start;
987 int name_len = strlen (name);
988 int length = (global ? pst->n_global_syms : pst->n_static_syms);
997 pst->objfile->global_psymbols.list + pst->globals_offset :
998 pst->objfile->static_psymbols.list + pst->statics_offset);
1002 for (i = 0; i < length; i += 1)
1004 struct partial_symbol *psym = start[i];
1006 if (symbol_matches_domain (SYMBOL_LANGUAGE (psym),
1007 SYMBOL_DOMAIN (psym), namespace)
1008 && (*wild_match) (name, name_len, SYMBOL_LINKAGE_NAME (psym)))
1023 int M = (U + i) >> 1;
1024 struct partial_symbol *psym = start[M];
1026 if (SYMBOL_LINKAGE_NAME (psym)[0] < name[0])
1028 else if (SYMBOL_LINKAGE_NAME (psym)[0] > name[0])
1030 else if (strcmp (SYMBOL_LINKAGE_NAME (psym), name) < 0)
1041 struct partial_symbol *psym = start[i];
1043 if (symbol_matches_domain (SYMBOL_LANGUAGE (psym),
1044 SYMBOL_DOMAIN (psym), namespace))
1046 int cmp = strncmp (name, SYMBOL_LINKAGE_NAME (psym), name_len);
1054 && (*is_name_suffix) (SYMBOL_LINKAGE_NAME (psym)
1069 int M = (U + i) >> 1;
1070 struct partial_symbol *psym = start[M];
1072 if (SYMBOL_LINKAGE_NAME (psym)[0] < '_')
1074 else if (SYMBOL_LINKAGE_NAME (psym)[0] > '_')
1076 else if (strcmp (SYMBOL_LINKAGE_NAME (psym), "_ada_") < 0)
1087 struct partial_symbol *psym = start[i];
1089 if (symbol_matches_domain (SYMBOL_LANGUAGE (psym),
1090 SYMBOL_DOMAIN (psym), namespace))
1094 cmp = (int) '_' - (int) SYMBOL_LINKAGE_NAME (psym)[0];
1097 cmp = strncmp ("_ada_", SYMBOL_LINKAGE_NAME (psym), 5);
1099 cmp = strncmp (name, SYMBOL_LINKAGE_NAME (psym) + 5,
1109 && (*is_name_suffix) (SYMBOL_LINKAGE_NAME (psym)
1120 map_ada_symtabs (struct objfile *objfile,
1121 int (*wild_match) (const char *, int, const char *),
1122 int (*is_name_suffix) (const char *),
1123 void (*callback) (struct objfile *, struct symtab *, void *),
1124 const char *name, int global, domain_enum namespace, int wild,
1127 struct partial_symtab *ps;
1129 ALL_OBJFILE_PSYMTABS (objfile, ps)
1133 || ada_lookup_partial_symbol (ps, name, global, namespace, wild,
1134 wild_match, is_name_suffix))
1136 struct symtab *s = PSYMTAB_TO_SYMTAB (ps);
1138 if (s == NULL || !s->primary)
1140 (*callback) (objfile, s, data);
1146 expand_symtabs_matching_via_partial (struct objfile *objfile,
1147 int (*file_matcher) (const char *, void *),
1148 int (*name_matcher) (const char *, void *),
1152 struct partial_symtab *ps;
1154 ALL_OBJFILE_PSYMTABS (objfile, ps)
1156 struct partial_symbol **psym;
1157 struct partial_symbol **bound, **gbound, **sbound;
1163 if (! (*file_matcher) (ps->filename, data))
1166 gbound = objfile->global_psymbols.list + ps->globals_offset + ps->n_global_syms;
1167 sbound = objfile->static_psymbols.list + ps->statics_offset + ps->n_static_syms;
1170 /* Go through all of the symbols stored in a partial
1171 symtab in one loop. */
1172 psym = objfile->global_psymbols.list + ps->globals_offset;
1177 if (bound == gbound && ps->n_static_syms != 0)
1179 psym = objfile->static_psymbols.list + ps->statics_offset;
1190 if ((*name_matcher) (SYMBOL_NATURAL_NAME (*psym), data)
1191 && ((kind == VARIABLES_DOMAIN
1192 && SYMBOL_CLASS (*psym) != LOC_TYPEDEF
1193 && SYMBOL_CLASS (*psym) != LOC_BLOCK)
1194 || (kind == FUNCTIONS_DOMAIN
1195 && SYMBOL_CLASS (*psym) == LOC_BLOCK)
1196 || (kind == TYPES_DOMAIN
1197 && SYMBOL_CLASS (*psym) == LOC_TYPEDEF)))
1199 PSYMTAB_TO_SYMTAB (ps);
1209 objfile_has_psyms (struct objfile *objfile)
1211 return objfile->psymtabs != NULL;
1214 const struct quick_symbol_functions psym_functions =
1217 find_last_source_symtab_from_partial,
1218 forget_cached_source_info_partial,
1219 lookup_symtab_via_partial_symtab,
1220 lookup_symbol_aux_psymtabs,
1221 expand_one_symtab_matching_psymtabs,
1222 print_psymtab_stats_for_objfile,
1223 dump_psymtabs_for_objfile,
1225 read_symtabs_for_function,
1226 expand_partial_symbol_tables,
1227 read_psymtabs_with_filename,
1228 find_symbol_file_from_partial,
1230 expand_symtabs_matching_via_partial,
1231 find_pc_sect_symtab_from_partial,
1232 map_symbol_names_psymtab,
1233 map_symbol_filenames_psymtab
1238 /* This compares two partial symbols by names, using strcmp_iw_ordered
1239 for the comparison. */
1242 compare_psymbols (const void *s1p, const void *s2p)
1244 struct partial_symbol *const *s1 = s1p;
1245 struct partial_symbol *const *s2 = s2p;
1247 return strcmp_iw_ordered (SYMBOL_SEARCH_NAME (*s1),
1248 SYMBOL_SEARCH_NAME (*s2));
1252 sort_pst_symbols (struct partial_symtab *pst)
1254 /* Sort the global list; don't sort the static list */
1256 qsort (pst->objfile->global_psymbols.list + pst->globals_offset,
1257 pst->n_global_syms, sizeof (struct partial_symbol *),
1261 /* Allocate and partially fill a partial symtab. It will be
1262 completely filled at the end of the symbol list.
1264 FILENAME is the name of the symbol-file we are reading from. */
1266 struct partial_symtab *
1267 start_psymtab_common (struct objfile *objfile,
1268 struct section_offsets *section_offsets,
1269 const char *filename,
1270 CORE_ADDR textlow, struct partial_symbol **global_syms,
1271 struct partial_symbol **static_syms)
1273 struct partial_symtab *psymtab;
1275 psymtab = allocate_psymtab (filename, objfile);
1276 psymtab->section_offsets = section_offsets;
1277 psymtab->textlow = textlow;
1278 psymtab->texthigh = psymtab->textlow; /* default */
1279 psymtab->globals_offset = global_syms - objfile->global_psymbols.list;
1280 psymtab->statics_offset = static_syms - objfile->static_psymbols.list;
1284 /* Calculate a hash code for the given partial symbol. The hash is
1285 calculated using the symbol's value, language, domain, class
1286 and name. These are the values which are set by
1287 add_psymbol_to_bcache. */
1289 static unsigned long
1290 psymbol_hash (const void *addr, int length)
1292 unsigned long h = 0;
1293 struct partial_symbol *psymbol = (struct partial_symbol *) addr;
1294 unsigned int lang = psymbol->ginfo.language;
1295 unsigned int domain = PSYMBOL_DOMAIN (psymbol);
1296 unsigned int class = PSYMBOL_CLASS (psymbol);
1298 h = hash_continue (&psymbol->ginfo.value, sizeof (psymbol->ginfo.value), h);
1299 h = hash_continue (&lang, sizeof (unsigned int), h);
1300 h = hash_continue (&domain, sizeof (unsigned int), h);
1301 h = hash_continue (&class, sizeof (unsigned int), h);
1302 h = hash_continue (psymbol->ginfo.name, strlen (psymbol->ginfo.name), h);
1307 /* Returns true if the symbol at addr1 equals the symbol at addr2.
1308 For the comparison this function uses a symbols value,
1309 language, domain, class and name. */
1312 psymbol_compare (const void *addr1, const void *addr2, int length)
1314 struct partial_symbol *sym1 = (struct partial_symbol *) addr1;
1315 struct partial_symbol *sym2 = (struct partial_symbol *) addr2;
1317 return (memcmp (&sym1->ginfo.value, &sym1->ginfo.value,
1318 sizeof (sym1->ginfo.value)) == 0
1319 && sym1->ginfo.language == sym2->ginfo.language
1320 && PSYMBOL_DOMAIN (sym1) == PSYMBOL_DOMAIN (sym2)
1321 && PSYMBOL_CLASS (sym1) == PSYMBOL_CLASS (sym2)
1322 && sym1->ginfo.name == sym2->ginfo.name);
1325 /* Initialize a partial symbol bcache. */
1327 struct psymbol_bcache *
1328 psymbol_bcache_init (void)
1330 struct psymbol_bcache *bcache = XCALLOC (1, struct psymbol_bcache);
1331 bcache->bcache = bcache_xmalloc (psymbol_hash, psymbol_compare);
1335 /* Free a partial symbol bcache. */
1337 psymbol_bcache_free (struct psymbol_bcache *bcache)
1342 bcache_xfree (bcache->bcache);
1346 /* Return the internal bcache of the psymbol_bcache BCACHE*/
1349 psymbol_bcache_get_bcache (struct psymbol_bcache *bcache)
1351 return bcache->bcache;
1354 /* Find a copy of the SYM in BCACHE. If BCACHE has never seen this
1355 symbol before, add a copy to BCACHE. In either case, return a pointer
1356 to BCACHE's copy of the symbol. If optional ADDED is not NULL, return
1357 1 in case of new entry or 0 if returning an old entry. */
1359 static const struct partial_symbol *
1360 psymbol_bcache_full (struct partial_symbol *sym,
1361 struct psymbol_bcache *bcache,
1364 return bcache_full (sym,
1365 sizeof (struct partial_symbol),
1370 /* Helper function, initialises partial symbol structure and stashes
1371 it into objfile's bcache. Note that our caching mechanism will
1372 use all fields of struct partial_symbol to determine hash value of the
1373 structure. In other words, having two symbols with the same name but
1374 different domain (or address) is possible and correct. */
1376 static const struct partial_symbol *
1377 add_psymbol_to_bcache (char *name, int namelength, int copy_name,
1379 enum address_class class,
1380 long val, /* Value as a long */
1381 CORE_ADDR coreaddr, /* Value as a CORE_ADDR */
1382 enum language language, struct objfile *objfile,
1385 struct partial_symbol psymbol;
1387 /* We must ensure that the entire 'value' field has been zeroed
1388 before assigning to it, because an assignment may not write the
1390 memset (&psymbol.ginfo.value, 0, sizeof (psymbol.ginfo.value));
1392 /* val and coreaddr are mutually exclusive, one of them *will* be zero */
1395 SYMBOL_VALUE (&psymbol) = val;
1399 SYMBOL_VALUE_ADDRESS (&psymbol) = coreaddr;
1401 SYMBOL_SECTION (&psymbol) = 0;
1402 SYMBOL_OBJ_SECTION (&psymbol) = NULL;
1403 SYMBOL_SET_LANGUAGE (&psymbol, language);
1404 PSYMBOL_DOMAIN (&psymbol) = domain;
1405 PSYMBOL_CLASS (&psymbol) = class;
1407 SYMBOL_SET_NAMES (&psymbol, name, namelength, copy_name, objfile);
1409 /* Stash the partial symbol away in the cache */
1410 return psymbol_bcache_full (&psymbol,
1411 objfile->psymbol_cache,
1415 /* Helper function, adds partial symbol to the given partial symbol
1419 append_psymbol_to_list (struct psymbol_allocation_list *list,
1420 const struct partial_symbol *psym,
1421 struct objfile *objfile)
1423 if (list->next >= list->list + list->size)
1424 extend_psymbol_list (list, objfile);
1425 *list->next++ = (struct partial_symbol *) psym;
1426 OBJSTAT (objfile, n_psyms++);
1429 /* Add a symbol with a long value to a psymtab.
1430 Since one arg is a struct, we pass in a ptr and deref it (sigh).
1431 Return the partial symbol that has been added. */
1433 /* NOTE: carlton/2003-09-11: The reason why we return the partial
1434 symbol is so that callers can get access to the symbol's demangled
1435 name, which they don't have any cheap way to determine otherwise.
1436 (Currenly, dwarf2read.c is the only file who uses that information,
1437 though it's possible that other readers might in the future.)
1438 Elena wasn't thrilled about that, and I don't blame her, but we
1439 couldn't come up with a better way to get that information. If
1440 it's needed in other situations, we could consider breaking up
1441 SYMBOL_SET_NAMES to provide access to the demangled name lookup
1444 const struct partial_symbol *
1445 add_psymbol_to_list (char *name, int namelength, int copy_name,
1447 enum address_class class,
1448 struct psymbol_allocation_list *list,
1449 long val, /* Value as a long */
1450 CORE_ADDR coreaddr, /* Value as a CORE_ADDR */
1451 enum language language, struct objfile *objfile)
1453 const struct partial_symbol *psym;
1457 /* Stash the partial symbol away in the cache */
1458 psym = add_psymbol_to_bcache (name, namelength, copy_name, domain, class,
1459 val, coreaddr, language, objfile, &added);
1461 /* Do not duplicate global partial symbols. */
1462 if (list == &objfile->global_psymbols
1466 /* Save pointer to partial symbol in psymtab, growing symtab if needed. */
1467 append_psymbol_to_list (list, psym, objfile);
1471 /* Initialize storage for partial symbols. */
1474 init_psymbol_list (struct objfile *objfile, int total_symbols)
1476 /* Free any previously allocated psymbol lists. */
1478 if (objfile->global_psymbols.list)
1480 xfree (objfile->global_psymbols.list);
1482 if (objfile->static_psymbols.list)
1484 xfree (objfile->static_psymbols.list);
1487 /* Current best guess is that approximately a twentieth
1488 of the total symbols (in a debugging file) are global or static
1491 objfile->global_psymbols.size = total_symbols / 10;
1492 objfile->static_psymbols.size = total_symbols / 10;
1494 if (objfile->global_psymbols.size > 0)
1496 objfile->global_psymbols.next =
1497 objfile->global_psymbols.list = (struct partial_symbol **)
1498 xmalloc ((objfile->global_psymbols.size
1499 * sizeof (struct partial_symbol *)));
1501 if (objfile->static_psymbols.size > 0)
1503 objfile->static_psymbols.next =
1504 objfile->static_psymbols.list = (struct partial_symbol **)
1505 xmalloc ((objfile->static_psymbols.size
1506 * sizeof (struct partial_symbol *)));
1510 struct partial_symtab *
1511 allocate_psymtab (const char *filename, struct objfile *objfile)
1513 struct partial_symtab *psymtab;
1515 if (objfile->free_psymtabs)
1517 psymtab = objfile->free_psymtabs;
1518 objfile->free_psymtabs = psymtab->next;
1521 psymtab = (struct partial_symtab *)
1522 obstack_alloc (&objfile->objfile_obstack,
1523 sizeof (struct partial_symtab));
1525 memset (psymtab, 0, sizeof (struct partial_symtab));
1526 psymtab->filename = obsavestring (filename, strlen (filename),
1527 &objfile->objfile_obstack);
1528 psymtab->symtab = NULL;
1530 /* Prepend it to the psymtab list for the objfile it belongs to.
1531 Psymtabs are searched in most recent inserted -> least recent
1534 psymtab->objfile = objfile;
1535 psymtab->next = objfile->psymtabs;
1536 objfile->psymtabs = psymtab;
1542 discard_psymtab (struct partial_symtab *pst)
1544 struct partial_symtab **prev_pst;
1547 Empty psymtabs happen as a result of header files which don't
1548 have any symbols in them. There can be a lot of them. But this
1549 check is wrong, in that a psymtab with N_SLINE entries but
1550 nothing else is not empty, but we don't realize that. Fixing
1551 that without slowing things down might be tricky. */
1553 /* First, snip it out of the psymtab chain */
1555 prev_pst = &(pst->objfile->psymtabs);
1556 while ((*prev_pst) != pst)
1557 prev_pst = &((*prev_pst)->next);
1558 (*prev_pst) = pst->next;
1560 /* Next, put it on a free list for recycling */
1562 pst->next = pst->objfile->free_psymtabs;
1563 pst->objfile->free_psymtabs = pst;
1566 /* Increase the space allocated for LISTP, which is probably
1567 global_psymbols or static_psymbols. This space will eventually
1568 be freed in free_objfile(). */
1571 extend_psymbol_list (struct psymbol_allocation_list *listp,
1572 struct objfile *objfile)
1576 if (listp->size == 0)
1579 listp->list = (struct partial_symbol **)
1580 xmalloc (new_size * sizeof (struct partial_symbol *));
1584 new_size = listp->size * 2;
1585 listp->list = (struct partial_symbol **)
1586 xrealloc ((char *) listp->list,
1587 new_size * sizeof (struct partial_symbol *));
1589 /* Next assumes we only went one over. Should be good if
1590 program works correctly */
1591 listp->next = listp->list + listp->size;
1592 listp->size = new_size;
1598 maintenance_print_psymbols (char *args, int from_tty)
1601 struct ui_file *outfile;
1602 struct cleanup *cleanups;
1603 char *symname = NULL;
1604 char *filename = DEV_TTY;
1605 struct objfile *objfile;
1606 struct partial_symtab *ps;
1612 error (_("print-psymbols takes an output file name and optional symbol file name"));
1614 argv = gdb_buildargv (args);
1615 cleanups = make_cleanup_freeargv (argv);
1617 if (argv[0] != NULL)
1620 /* If a second arg is supplied, it is a source file name to match on */
1621 if (argv[1] != NULL)
1627 filename = tilde_expand (filename);
1628 make_cleanup (xfree, filename);
1630 outfile = gdb_fopen (filename, FOPEN_WT);
1632 perror_with_name (filename);
1633 make_cleanup_ui_file_delete (outfile);
1636 ALL_PSYMTABS (objfile, ps)
1637 if (symname == NULL || strcmp (symname, ps->filename) == 0)
1638 dump_psymtab (objfile, ps, outfile);
1640 do_cleanups (cleanups);
1643 /* List all the partial symbol tables whose names match REGEXP (optional). */
1645 maintenance_info_psymtabs (char *regexp, int from_tty)
1647 struct program_space *pspace;
1648 struct objfile *objfile;
1653 ALL_PSPACES (pspace)
1654 ALL_PSPACE_OBJFILES (pspace, objfile)
1656 struct gdbarch *gdbarch = get_objfile_arch (objfile);
1657 struct partial_symtab *psymtab;
1659 /* We don't want to print anything for this objfile until we
1660 actually find a symtab whose name matches. */
1661 int printed_objfile_start = 0;
1663 ALL_OBJFILE_PSYMTABS (objfile, psymtab)
1668 || re_exec (psymtab->filename))
1670 if (! printed_objfile_start)
1672 printf_filtered ("{ objfile %s ", objfile->name);
1674 printf_filtered ("((struct objfile *) %s)\n",
1675 host_address_to_string (objfile));
1676 printed_objfile_start = 1;
1679 printf_filtered (" { psymtab %s ", psymtab->filename);
1681 printf_filtered ("((struct partial_symtab *) %s)\n",
1682 host_address_to_string (psymtab));
1684 printf_filtered (" readin %s\n",
1685 psymtab->readin ? "yes" : "no");
1686 printf_filtered (" fullname %s\n",
1687 psymtab->fullname ? psymtab->fullname : "(null)");
1688 printf_filtered (" text addresses ");
1689 fputs_filtered (paddress (gdbarch, psymtab->textlow),
1691 printf_filtered (" -- ");
1692 fputs_filtered (paddress (gdbarch, psymtab->texthigh),
1694 printf_filtered ("\n");
1695 printf_filtered (" globals ");
1696 if (psymtab->n_global_syms)
1698 printf_filtered ("(* (struct partial_symbol **) %s @ %d)\n",
1699 host_address_to_string (psymtab->objfile->global_psymbols.list
1700 + psymtab->globals_offset),
1701 psymtab->n_global_syms);
1704 printf_filtered ("(none)\n");
1705 printf_filtered (" statics ");
1706 if (psymtab->n_static_syms)
1708 printf_filtered ("(* (struct partial_symbol **) %s @ %d)\n",
1709 host_address_to_string (psymtab->objfile->static_psymbols.list
1710 + psymtab->statics_offset),
1711 psymtab->n_static_syms);
1714 printf_filtered ("(none)\n");
1715 printf_filtered (" dependencies ");
1716 if (psymtab->number_of_dependencies)
1720 printf_filtered ("{\n");
1721 for (i = 0; i < psymtab->number_of_dependencies; i++)
1723 struct partial_symtab *dep = psymtab->dependencies[i];
1725 /* Note the string concatenation there --- no comma. */
1726 printf_filtered (" psymtab %s "
1727 "((struct partial_symtab *) %s)\n",
1729 host_address_to_string (dep));
1731 printf_filtered (" }\n");
1734 printf_filtered ("(none)\n");
1735 printf_filtered (" }\n");
1739 if (printed_objfile_start)
1740 printf_filtered ("}\n");
1744 /* Check consistency of psymtabs and symtabs. */
1747 maintenance_check_symtabs (char *ignore, int from_tty)
1750 struct partial_symbol **psym;
1751 struct symtab *s = NULL;
1752 struct partial_symtab *ps;
1753 struct blockvector *bv;
1754 struct objfile *objfile;
1758 ALL_PSYMTABS (objfile, ps)
1760 struct gdbarch *gdbarch = get_objfile_arch (objfile);
1762 s = PSYMTAB_TO_SYMTAB (ps);
1765 bv = BLOCKVECTOR (s);
1766 b = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
1767 psym = ps->objfile->static_psymbols.list + ps->statics_offset;
1768 length = ps->n_static_syms;
1771 sym = lookup_block_symbol (b, SYMBOL_LINKAGE_NAME (*psym),
1772 SYMBOL_DOMAIN (*psym));
1775 printf_filtered ("Static symbol `");
1776 puts_filtered (SYMBOL_LINKAGE_NAME (*psym));
1777 printf_filtered ("' only found in ");
1778 puts_filtered (ps->filename);
1779 printf_filtered (" psymtab\n");
1783 b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
1784 psym = ps->objfile->global_psymbols.list + ps->globals_offset;
1785 length = ps->n_global_syms;
1788 sym = lookup_block_symbol (b, SYMBOL_LINKAGE_NAME (*psym),
1789 SYMBOL_DOMAIN (*psym));
1792 printf_filtered ("Global symbol `");
1793 puts_filtered (SYMBOL_LINKAGE_NAME (*psym));
1794 printf_filtered ("' only found in ");
1795 puts_filtered (ps->filename);
1796 printf_filtered (" psymtab\n");
1800 if (ps->texthigh < ps->textlow)
1802 printf_filtered ("Psymtab ");
1803 puts_filtered (ps->filename);
1804 printf_filtered (" covers bad range ");
1805 fputs_filtered (paddress (gdbarch, ps->textlow), gdb_stdout);
1806 printf_filtered (" - ");
1807 fputs_filtered (paddress (gdbarch, ps->texthigh), gdb_stdout);
1808 printf_filtered ("\n");
1811 if (ps->texthigh == 0)
1813 if (ps->textlow < BLOCK_START (b) || ps->texthigh > BLOCK_END (b))
1815 printf_filtered ("Psymtab ");
1816 puts_filtered (ps->filename);
1817 printf_filtered (" covers ");
1818 fputs_filtered (paddress (gdbarch, ps->textlow), gdb_stdout);
1819 printf_filtered (" - ");
1820 fputs_filtered (paddress (gdbarch, ps->texthigh), gdb_stdout);
1821 printf_filtered (" but symtab covers only ");
1822 fputs_filtered (paddress (gdbarch, BLOCK_START (b)), gdb_stdout);
1823 printf_filtered (" - ");
1824 fputs_filtered (paddress (gdbarch, BLOCK_END (b)), gdb_stdout);
1825 printf_filtered ("\n");
1833 map_partial_symbol_names (void (*fun) (const char *, void *), void *data)
1835 struct objfile *objfile;
1837 ALL_OBJFILES (objfile)
1840 objfile->sf->qf->map_symbol_names (objfile, fun, data);
1845 map_partial_symbol_filenames (void (*fun) (const char *, const char *,
1849 struct objfile *objfile;
1851 ALL_OBJFILES (objfile)
1854 objfile->sf->qf->map_symbol_filenames (objfile, fun, data);