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);
430 pre_expand_symtabs_matching_psymtabs (struct objfile *objfile,
431 int kind, const char *name,
437 /* Look, in partial_symtab PST, for symbol whose natural name is NAME.
438 Check the global symbols if GLOBAL, the static symbols if not. */
440 static struct partial_symbol *
441 lookup_partial_symbol (struct partial_symtab *pst, const char *name,
442 int global, domain_enum domain)
444 struct partial_symbol **start, **psym;
445 struct partial_symbol **top, **real_top, **bottom, **center;
446 int length = (global ? pst->n_global_syms : pst->n_static_syms);
447 int do_linear_search = 1;
454 pst->objfile->global_psymbols.list + pst->globals_offset :
455 pst->objfile->static_psymbols.list + pst->statics_offset);
457 if (global) /* This means we can use a binary search. */
459 do_linear_search = 0;
461 /* Binary search. This search is guaranteed to end with center
462 pointing at the earliest partial symbol whose name might be
463 correct. At that point *all* partial symbols with an
464 appropriate name will be checked against the correct
468 top = start + length - 1;
472 center = bottom + (top - bottom) / 2;
474 internal_error (__FILE__, __LINE__, _("failed internal consistency check"));
475 if (!do_linear_search
476 && (SYMBOL_LANGUAGE (*center) == language_java))
478 do_linear_search = 1;
480 if (strcmp_iw_ordered (SYMBOL_SEARCH_NAME (*center), name) >= 0)
489 if (!(top == bottom))
490 internal_error (__FILE__, __LINE__, _("failed internal consistency check"));
492 while (top <= real_top
493 && SYMBOL_MATCHES_SEARCH_NAME (*top, name))
495 if (symbol_matches_domain (SYMBOL_LANGUAGE (*top),
496 SYMBOL_DOMAIN (*top), domain))
502 /* Can't use a binary search or else we found during the binary search that
503 we should also do a linear search. */
505 if (do_linear_search)
507 for (psym = start; psym < start + length; psym++)
509 if (symbol_matches_domain (SYMBOL_LANGUAGE (*psym),
510 SYMBOL_DOMAIN (*psym), domain)
511 && SYMBOL_MATCHES_SEARCH_NAME (*psym, name))
519 /* Get the symbol table that corresponds to a partial_symtab.
520 This is fast after the first time you do it. In fact, there
521 is an even faster macro PSYMTAB_TO_SYMTAB that does the fast
524 static struct symtab *
525 psymtab_to_symtab (struct partial_symtab *pst)
527 /* If it's been looked up before, return it. */
531 /* If it has not yet been read in, read it. */
534 struct cleanup *back_to = increment_reading_symtab ();
536 (*pst->read_symtab) (pst);
537 do_cleanups (back_to);
544 relocate_psymtabs (struct objfile *objfile,
545 struct section_offsets *new_offsets,
546 struct section_offsets *delta)
548 struct partial_symbol **psym;
549 struct partial_symtab *p;
551 ALL_OBJFILE_PSYMTABS (objfile, p)
553 p->textlow += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
554 p->texthigh += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
557 for (psym = objfile->global_psymbols.list;
558 psym < objfile->global_psymbols.next;
561 fixup_psymbol_section (*psym, objfile);
562 if (SYMBOL_SECTION (*psym) >= 0)
563 SYMBOL_VALUE_ADDRESS (*psym) += ANOFFSET (delta,
564 SYMBOL_SECTION (*psym));
566 for (psym = objfile->static_psymbols.list;
567 psym < objfile->static_psymbols.next;
570 fixup_psymbol_section (*psym, objfile);
571 if (SYMBOL_SECTION (*psym) >= 0)
572 SYMBOL_VALUE_ADDRESS (*psym) += ANOFFSET (delta,
573 SYMBOL_SECTION (*psym));
577 static struct symtab *
578 find_last_source_symtab_from_partial (struct objfile *ofp)
580 struct partial_symtab *ps;
581 struct partial_symtab *cs_pst = 0;
583 ALL_OBJFILE_PSYMTABS (ofp, ps)
585 const char *name = ps->filename;
586 int len = strlen (name);
588 if (!(len > 2 && (strcmp (&name[len - 2], ".h") == 0
589 || strcmp (name, "<<C++-namespaces>>") == 0)))
597 internal_error (__FILE__, __LINE__,
598 _("select_source_symtab: "
599 "readin pst found and no symtabs."));
602 return PSYMTAB_TO_SYMTAB (cs_pst);
608 forget_cached_source_info_partial (struct objfile *objfile)
610 struct partial_symtab *pst;
612 ALL_OBJFILE_PSYMTABS (objfile, pst)
614 if (pst->fullname != NULL)
616 xfree (pst->fullname);
617 pst->fullname = NULL;
623 print_partial_symbols (struct gdbarch *gdbarch,
624 struct partial_symbol **p, int count, char *what,
625 struct ui_file *outfile)
627 fprintf_filtered (outfile, " %s partial symbols:\n", what);
630 fprintf_filtered (outfile, " `%s'", SYMBOL_LINKAGE_NAME (*p));
631 if (SYMBOL_DEMANGLED_NAME (*p) != NULL)
633 fprintf_filtered (outfile, " `%s'", SYMBOL_DEMANGLED_NAME (*p));
635 fputs_filtered (", ", outfile);
636 switch (SYMBOL_DOMAIN (*p))
639 fputs_filtered ("undefined domain, ", outfile);
642 /* This is the usual thing -- don't print it */
645 fputs_filtered ("struct domain, ", outfile);
648 fputs_filtered ("label domain, ", outfile);
651 fputs_filtered ("<invalid domain>, ", outfile);
654 switch (SYMBOL_CLASS (*p))
657 fputs_filtered ("undefined", outfile);
660 fputs_filtered ("constant int", outfile);
663 fputs_filtered ("static", outfile);
666 fputs_filtered ("register", outfile);
669 fputs_filtered ("pass by value", outfile);
672 fputs_filtered ("pass by reference", outfile);
674 case LOC_REGPARM_ADDR:
675 fputs_filtered ("register address parameter", outfile);
678 fputs_filtered ("stack parameter", outfile);
681 fputs_filtered ("type", outfile);
684 fputs_filtered ("label", outfile);
687 fputs_filtered ("function", outfile);
689 case LOC_CONST_BYTES:
690 fputs_filtered ("constant bytes", outfile);
693 fputs_filtered ("unresolved", outfile);
695 case LOC_OPTIMIZED_OUT:
696 fputs_filtered ("optimized out", outfile);
699 fputs_filtered ("computed at runtime", outfile);
702 fputs_filtered ("<invalid location>", outfile);
705 fputs_filtered (", ", outfile);
706 fputs_filtered (paddress (gdbarch, SYMBOL_VALUE_ADDRESS (*p)), outfile);
707 fprintf_filtered (outfile, "\n");
713 dump_psymtab (struct objfile *objfile, struct partial_symtab *psymtab,
714 struct ui_file *outfile)
716 struct gdbarch *gdbarch = get_objfile_arch (objfile);
719 fprintf_filtered (outfile, "\nPartial symtab for source file %s ",
721 fprintf_filtered (outfile, "(object ");
722 gdb_print_host_address (psymtab, outfile);
723 fprintf_filtered (outfile, ")\n\n");
724 fprintf_unfiltered (outfile, " Read from object file %s (",
726 gdb_print_host_address (objfile, outfile);
727 fprintf_unfiltered (outfile, ")\n");
731 fprintf_filtered (outfile,
732 " Full symtab was read (at ");
733 gdb_print_host_address (psymtab->symtab, outfile);
734 fprintf_filtered (outfile, " by function at ");
735 gdb_print_host_address (psymtab->read_symtab, outfile);
736 fprintf_filtered (outfile, ")\n");
739 fprintf_filtered (outfile, " Relocate symbols by ");
740 for (i = 0; i < psymtab->objfile->num_sections; ++i)
743 fprintf_filtered (outfile, ", ");
745 fputs_filtered (paddress (gdbarch,
746 ANOFFSET (psymtab->section_offsets, i)),
749 fprintf_filtered (outfile, "\n");
751 fprintf_filtered (outfile, " Symbols cover text addresses ");
752 fputs_filtered (paddress (gdbarch, psymtab->textlow), outfile);
753 fprintf_filtered (outfile, "-");
754 fputs_filtered (paddress (gdbarch, psymtab->texthigh), outfile);
755 fprintf_filtered (outfile, "\n");
756 fprintf_filtered (outfile, " Depends on %d other partial symtabs.\n",
757 psymtab->number_of_dependencies);
758 for (i = 0; i < psymtab->number_of_dependencies; i++)
760 fprintf_filtered (outfile, " %d ", i);
761 gdb_print_host_address (psymtab->dependencies[i], outfile);
762 fprintf_filtered (outfile, " %s\n",
763 psymtab->dependencies[i]->filename);
765 if (psymtab->n_global_syms > 0)
767 print_partial_symbols (gdbarch,
768 objfile->global_psymbols.list
769 + psymtab->globals_offset,
770 psymtab->n_global_syms, "Global", outfile);
772 if (psymtab->n_static_syms > 0)
774 print_partial_symbols (gdbarch,
775 objfile->static_psymbols.list
776 + psymtab->statics_offset,
777 psymtab->n_static_syms, "Static", outfile);
779 fprintf_filtered (outfile, "\n");
783 print_psymtab_stats_for_objfile (struct objfile *objfile)
786 struct partial_symtab *ps;
789 ALL_OBJFILE_PSYMTABS (objfile, ps)
794 printf_filtered (_(" Number of psym tables (not yet expanded): %d\n"), i);
798 dump_psymtabs_for_objfile (struct objfile *objfile)
800 struct partial_symtab *psymtab;
802 if (objfile->psymtabs)
804 printf_filtered ("Psymtabs:\n");
805 for (psymtab = objfile->psymtabs;
807 psymtab = psymtab->next)
809 printf_filtered ("%s at ",
811 gdb_print_host_address (psymtab, gdb_stdout);
812 printf_filtered (", ");
813 if (psymtab->objfile != objfile)
815 printf_filtered ("NOT ON CHAIN! ");
819 printf_filtered ("\n\n");
823 /* Look through the partial symtabs for all symbols which begin
824 by matching FUNC_NAME. Make sure we read that symbol table in. */
827 read_symtabs_for_function (struct objfile *objfile, const char *func_name)
829 struct partial_symtab *ps;
831 ALL_OBJFILE_PSYMTABS (objfile, ps)
836 if ((lookup_partial_symbol (ps, func_name, 1, VAR_DOMAIN)
838 || (lookup_partial_symbol (ps, func_name, 0, VAR_DOMAIN)
840 psymtab_to_symtab (ps);
845 expand_partial_symbol_tables (struct objfile *objfile)
847 struct partial_symtab *psymtab;
849 for (psymtab = objfile->psymtabs;
851 psymtab = psymtab->next)
853 psymtab_to_symtab (psymtab);
858 read_psymtabs_with_filename (struct objfile *objfile, const char *filename)
860 struct partial_symtab *p;
862 ALL_OBJFILE_PSYMTABS (objfile, p)
864 if (strcmp (filename, p->filename) == 0)
865 PSYMTAB_TO_SYMTAB (p);
870 map_symbol_names_psymtab (struct objfile *objfile,
871 void (*fun) (const char *, void *), void *data)
873 struct partial_symtab *ps;
875 ALL_OBJFILE_PSYMTABS (objfile, ps)
877 struct partial_symbol **psym;
879 /* If the psymtab's been read in we'll get it when we search
880 through the blockvector. */
884 for (psym = objfile->global_psymbols.list + ps->globals_offset;
885 psym < (objfile->global_psymbols.list + ps->globals_offset
886 + ps->n_global_syms);
889 /* If interrupted, then quit. */
891 (*fun) (SYMBOL_NATURAL_NAME (*psym), data);
894 for (psym = objfile->static_psymbols.list + ps->statics_offset;
895 psym < (objfile->static_psymbols.list + ps->statics_offset
896 + ps->n_static_syms);
900 (*fun) (SYMBOL_NATURAL_NAME (*psym), data);
906 map_symbol_filenames_psymtab (struct objfile *objfile,
907 void (*fun) (const char *, const char *,
911 struct partial_symtab *ps;
913 ALL_OBJFILE_PSYMTABS (objfile, ps)
915 const char *fullname;
920 fullname = psymtab_to_fullname (ps);
921 (*fun) (ps->filename, fullname, data);
925 int find_and_open_source (const char *filename,
929 /* Finds the fullname that a partial_symtab represents.
931 If this functions finds the fullname, it will save it in ps->fullname
932 and it will also return the value.
934 If this function fails to find the file that this partial_symtab represents,
935 NULL will be returned and ps->fullname will be set to NULL. */
937 psymtab_to_fullname (struct partial_symtab *ps)
944 /* Don't check ps->fullname here, the file could have been
945 deleted/moved/..., look for it again */
946 r = find_and_open_source (ps->filename, ps->dirname, &ps->fullname);
958 find_symbol_file_from_partial (struct objfile *objfile, const char *name)
960 struct partial_symtab *pst;
962 ALL_OBJFILE_PSYMTABS (objfile, pst)
964 if (lookup_partial_symbol (pst, name, 1, VAR_DOMAIN))
965 return pst->filename;
970 /* Look, in partial_symtab PST, for symbol NAME in given namespace.
971 Check the global symbols if GLOBAL, the static symbols if not.
972 Do wild-card match if WILD. */
974 static struct partial_symbol *
975 ada_lookup_partial_symbol (struct partial_symtab *pst, const char *name,
976 int global, domain_enum namespace, int wild,
977 int (*wild_match) (const char *, int, const char *),
978 int (*is_name_suffix) (const char *))
980 struct partial_symbol **start;
981 int name_len = strlen (name);
982 int length = (global ? pst->n_global_syms : pst->n_static_syms);
991 pst->objfile->global_psymbols.list + pst->globals_offset :
992 pst->objfile->static_psymbols.list + pst->statics_offset);
996 for (i = 0; i < length; i += 1)
998 struct partial_symbol *psym = start[i];
1000 if (symbol_matches_domain (SYMBOL_LANGUAGE (psym),
1001 SYMBOL_DOMAIN (psym), namespace)
1002 && (*wild_match) (name, name_len, SYMBOL_LINKAGE_NAME (psym)))
1017 int M = (U + i) >> 1;
1018 struct partial_symbol *psym = start[M];
1020 if (SYMBOL_LINKAGE_NAME (psym)[0] < name[0])
1022 else if (SYMBOL_LINKAGE_NAME (psym)[0] > name[0])
1024 else if (strcmp (SYMBOL_LINKAGE_NAME (psym), name) < 0)
1035 struct partial_symbol *psym = start[i];
1037 if (symbol_matches_domain (SYMBOL_LANGUAGE (psym),
1038 SYMBOL_DOMAIN (psym), namespace))
1040 int cmp = strncmp (name, SYMBOL_LINKAGE_NAME (psym), name_len);
1048 && (*is_name_suffix) (SYMBOL_LINKAGE_NAME (psym)
1063 int M = (U + i) >> 1;
1064 struct partial_symbol *psym = start[M];
1066 if (SYMBOL_LINKAGE_NAME (psym)[0] < '_')
1068 else if (SYMBOL_LINKAGE_NAME (psym)[0] > '_')
1070 else if (strcmp (SYMBOL_LINKAGE_NAME (psym), "_ada_") < 0)
1081 struct partial_symbol *psym = start[i];
1083 if (symbol_matches_domain (SYMBOL_LANGUAGE (psym),
1084 SYMBOL_DOMAIN (psym), namespace))
1088 cmp = (int) '_' - (int) SYMBOL_LINKAGE_NAME (psym)[0];
1091 cmp = strncmp ("_ada_", SYMBOL_LINKAGE_NAME (psym), 5);
1093 cmp = strncmp (name, SYMBOL_LINKAGE_NAME (psym) + 5,
1103 && (*is_name_suffix) (SYMBOL_LINKAGE_NAME (psym)
1114 map_ada_symtabs (struct objfile *objfile,
1115 int (*wild_match) (const char *, int, const char *),
1116 int (*is_name_suffix) (const char *),
1117 void (*callback) (struct objfile *, struct symtab *, void *),
1118 const char *name, int global, domain_enum namespace, int wild,
1121 struct partial_symtab *ps;
1123 ALL_OBJFILE_PSYMTABS (objfile, ps)
1127 || ada_lookup_partial_symbol (ps, name, global, namespace, wild,
1128 wild_match, is_name_suffix))
1130 struct symtab *s = PSYMTAB_TO_SYMTAB (ps);
1132 if (s == NULL || !s->primary)
1134 (*callback) (objfile, s, data);
1140 expand_symtabs_matching_via_partial (struct objfile *objfile,
1141 int (*file_matcher) (const char *, void *),
1142 int (*name_matcher) (const char *, void *),
1146 struct partial_symtab *ps;
1148 ALL_OBJFILE_PSYMTABS (objfile, ps)
1150 struct partial_symbol **psym;
1151 struct partial_symbol **bound, **gbound, **sbound;
1157 if (! (*file_matcher) (ps->filename, data))
1160 gbound = objfile->global_psymbols.list + ps->globals_offset + ps->n_global_syms;
1161 sbound = objfile->static_psymbols.list + ps->statics_offset + ps->n_static_syms;
1164 /* Go through all of the symbols stored in a partial
1165 symtab in one loop. */
1166 psym = objfile->global_psymbols.list + ps->globals_offset;
1171 if (bound == gbound && ps->n_static_syms != 0)
1173 psym = objfile->static_psymbols.list + ps->statics_offset;
1184 if ((*name_matcher) (SYMBOL_NATURAL_NAME (*psym), data)
1185 && ((kind == VARIABLES_DOMAIN
1186 && SYMBOL_CLASS (*psym) != LOC_TYPEDEF
1187 && SYMBOL_CLASS (*psym) != LOC_BLOCK)
1188 || (kind == FUNCTIONS_DOMAIN
1189 && SYMBOL_CLASS (*psym) == LOC_BLOCK)
1190 || (kind == TYPES_DOMAIN
1191 && SYMBOL_CLASS (*psym) == LOC_TYPEDEF)))
1193 PSYMTAB_TO_SYMTAB (ps);
1203 objfile_has_psyms (struct objfile *objfile)
1205 return objfile->psymtabs != NULL;
1208 const struct quick_symbol_functions psym_functions =
1211 find_last_source_symtab_from_partial,
1212 forget_cached_source_info_partial,
1213 lookup_symtab_via_partial_symtab,
1214 lookup_symbol_aux_psymtabs,
1215 pre_expand_symtabs_matching_psymtabs,
1216 print_psymtab_stats_for_objfile,
1217 dump_psymtabs_for_objfile,
1219 read_symtabs_for_function,
1220 expand_partial_symbol_tables,
1221 read_psymtabs_with_filename,
1222 find_symbol_file_from_partial,
1224 expand_symtabs_matching_via_partial,
1225 find_pc_sect_symtab_from_partial,
1226 map_symbol_names_psymtab,
1227 map_symbol_filenames_psymtab
1232 /* This compares two partial symbols by names, using strcmp_iw_ordered
1233 for the comparison. */
1236 compare_psymbols (const void *s1p, const void *s2p)
1238 struct partial_symbol *const *s1 = s1p;
1239 struct partial_symbol *const *s2 = s2p;
1241 return strcmp_iw_ordered (SYMBOL_SEARCH_NAME (*s1),
1242 SYMBOL_SEARCH_NAME (*s2));
1246 sort_pst_symbols (struct partial_symtab *pst)
1248 /* Sort the global list; don't sort the static list */
1250 qsort (pst->objfile->global_psymbols.list + pst->globals_offset,
1251 pst->n_global_syms, sizeof (struct partial_symbol *),
1255 /* Allocate and partially fill a partial symtab. It will be
1256 completely filled at the end of the symbol list.
1258 FILENAME is the name of the symbol-file we are reading from. */
1260 struct partial_symtab *
1261 start_psymtab_common (struct objfile *objfile,
1262 struct section_offsets *section_offsets,
1263 const char *filename,
1264 CORE_ADDR textlow, struct partial_symbol **global_syms,
1265 struct partial_symbol **static_syms)
1267 struct partial_symtab *psymtab;
1269 psymtab = allocate_psymtab (filename, objfile);
1270 psymtab->section_offsets = section_offsets;
1271 psymtab->textlow = textlow;
1272 psymtab->texthigh = psymtab->textlow; /* default */
1273 psymtab->globals_offset = global_syms - objfile->global_psymbols.list;
1274 psymtab->statics_offset = static_syms - objfile->static_psymbols.list;
1278 /* Calculate a hash code for the given partial symbol. The hash is
1279 calculated using the symbol's value, language, domain, class
1280 and name. These are the values which are set by
1281 add_psymbol_to_bcache. */
1283 static unsigned long
1284 psymbol_hash (const void *addr, int length)
1286 unsigned long h = 0;
1287 struct partial_symbol *psymbol = (struct partial_symbol *) addr;
1288 unsigned int lang = psymbol->ginfo.language;
1289 unsigned int domain = PSYMBOL_DOMAIN (psymbol);
1290 unsigned int class = PSYMBOL_CLASS (psymbol);
1292 h = hash_continue (&psymbol->ginfo.value, sizeof (psymbol->ginfo.value), h);
1293 h = hash_continue (&lang, sizeof (unsigned int), h);
1294 h = hash_continue (&domain, sizeof (unsigned int), h);
1295 h = hash_continue (&class, sizeof (unsigned int), h);
1296 h = hash_continue (psymbol->ginfo.name, strlen (psymbol->ginfo.name), h);
1301 /* Returns true if the symbol at addr1 equals the symbol at addr2.
1302 For the comparison this function uses a symbols value,
1303 language, domain, class and name. */
1306 psymbol_compare (const void *addr1, const void *addr2, int length)
1308 struct partial_symbol *sym1 = (struct partial_symbol *) addr1;
1309 struct partial_symbol *sym2 = (struct partial_symbol *) addr2;
1311 return (memcmp (&sym1->ginfo.value, &sym1->ginfo.value,
1312 sizeof (sym1->ginfo.value)) == 0
1313 && sym1->ginfo.language == sym2->ginfo.language
1314 && PSYMBOL_DOMAIN (sym1) == PSYMBOL_DOMAIN (sym2)
1315 && PSYMBOL_CLASS (sym1) == PSYMBOL_CLASS (sym2)
1316 && sym1->ginfo.name == sym2->ginfo.name);
1319 /* Initialize a partial symbol bcache. */
1321 struct psymbol_bcache *
1322 psymbol_bcache_init (void)
1324 struct psymbol_bcache *bcache = XCALLOC (1, struct psymbol_bcache);
1325 bcache->bcache = bcache_xmalloc (psymbol_hash, psymbol_compare);
1329 /* Free a partial symbol bcache. */
1331 psymbol_bcache_free (struct psymbol_bcache *bcache)
1336 bcache_xfree (bcache->bcache);
1340 /* Return the internal bcache of the psymbol_bcache BCACHE*/
1343 psymbol_bcache_get_bcache (struct psymbol_bcache *bcache)
1345 return bcache->bcache;
1348 /* Find a copy of the SYM in BCACHE. If BCACHE has never seen this
1349 symbol before, add a copy to BCACHE. In either case, return a pointer
1350 to BCACHE's copy of the symbol. If optional ADDED is not NULL, return
1351 1 in case of new entry or 0 if returning an old entry. */
1353 static const struct partial_symbol *
1354 psymbol_bcache_full (struct partial_symbol *sym,
1355 struct psymbol_bcache *bcache,
1358 return bcache_full (sym,
1359 sizeof (struct partial_symbol),
1364 /* Helper function, initialises partial symbol structure and stashes
1365 it into objfile's bcache. Note that our caching mechanism will
1366 use all fields of struct partial_symbol to determine hash value of the
1367 structure. In other words, having two symbols with the same name but
1368 different domain (or address) is possible and correct. */
1370 static const struct partial_symbol *
1371 add_psymbol_to_bcache (char *name, int namelength, int copy_name,
1373 enum address_class class,
1374 long val, /* Value as a long */
1375 CORE_ADDR coreaddr, /* Value as a CORE_ADDR */
1376 enum language language, struct objfile *objfile,
1379 struct partial_symbol psymbol;
1381 /* We must ensure that the entire 'value' field has been zeroed
1382 before assigning to it, because an assignment may not write the
1384 memset (&psymbol.ginfo.value, 0, sizeof (psymbol.ginfo.value));
1386 /* val and coreaddr are mutually exclusive, one of them *will* be zero */
1389 SYMBOL_VALUE (&psymbol) = val;
1393 SYMBOL_VALUE_ADDRESS (&psymbol) = coreaddr;
1395 SYMBOL_SECTION (&psymbol) = 0;
1396 SYMBOL_OBJ_SECTION (&psymbol) = NULL;
1397 SYMBOL_SET_LANGUAGE (&psymbol, language);
1398 PSYMBOL_DOMAIN (&psymbol) = domain;
1399 PSYMBOL_CLASS (&psymbol) = class;
1401 SYMBOL_SET_NAMES (&psymbol, name, namelength, copy_name, objfile);
1403 /* Stash the partial symbol away in the cache */
1404 return psymbol_bcache_full (&psymbol,
1405 objfile->psymbol_cache,
1409 /* Increase the space allocated for LISTP, which is probably
1410 global_psymbols or static_psymbols. This space will eventually
1411 be freed in free_objfile(). */
1414 extend_psymbol_list (struct psymbol_allocation_list *listp,
1415 struct objfile *objfile)
1419 if (listp->size == 0)
1422 listp->list = (struct partial_symbol **)
1423 xmalloc (new_size * sizeof (struct partial_symbol *));
1427 new_size = listp->size * 2;
1428 listp->list = (struct partial_symbol **)
1429 xrealloc ((char *) listp->list,
1430 new_size * sizeof (struct partial_symbol *));
1432 /* Next assumes we only went one over. Should be good if
1433 program works correctly */
1434 listp->next = listp->list + listp->size;
1435 listp->size = new_size;
1438 /* Helper function, adds partial symbol to the given partial symbol
1442 append_psymbol_to_list (struct psymbol_allocation_list *list,
1443 const struct partial_symbol *psym,
1444 struct objfile *objfile)
1446 if (list->next >= list->list + list->size)
1447 extend_psymbol_list (list, objfile);
1448 *list->next++ = (struct partial_symbol *) psym;
1449 OBJSTAT (objfile, n_psyms++);
1452 /* Add a symbol with a long value to a psymtab.
1453 Since one arg is a struct, we pass in a ptr and deref it (sigh).
1454 Return the partial symbol that has been added. */
1456 /* NOTE: carlton/2003-09-11: The reason why we return the partial
1457 symbol is so that callers can get access to the symbol's demangled
1458 name, which they don't have any cheap way to determine otherwise.
1459 (Currenly, dwarf2read.c is the only file who uses that information,
1460 though it's possible that other readers might in the future.)
1461 Elena wasn't thrilled about that, and I don't blame her, but we
1462 couldn't come up with a better way to get that information. If
1463 it's needed in other situations, we could consider breaking up
1464 SYMBOL_SET_NAMES to provide access to the demangled name lookup
1467 const struct partial_symbol *
1468 add_psymbol_to_list (char *name, int namelength, int copy_name,
1470 enum address_class class,
1471 struct psymbol_allocation_list *list,
1472 long val, /* Value as a long */
1473 CORE_ADDR coreaddr, /* Value as a CORE_ADDR */
1474 enum language language, struct objfile *objfile)
1476 const struct partial_symbol *psym;
1480 /* Stash the partial symbol away in the cache */
1481 psym = add_psymbol_to_bcache (name, namelength, copy_name, domain, class,
1482 val, coreaddr, language, objfile, &added);
1484 /* Do not duplicate global partial symbols. */
1485 if (list == &objfile->global_psymbols
1489 /* Save pointer to partial symbol in psymtab, growing symtab if needed. */
1490 append_psymbol_to_list (list, psym, objfile);
1494 /* Initialize storage for partial symbols. */
1497 init_psymbol_list (struct objfile *objfile, int total_symbols)
1499 /* Free any previously allocated psymbol lists. */
1501 if (objfile->global_psymbols.list)
1503 xfree (objfile->global_psymbols.list);
1505 if (objfile->static_psymbols.list)
1507 xfree (objfile->static_psymbols.list);
1510 /* Current best guess is that approximately a twentieth
1511 of the total symbols (in a debugging file) are global or static
1514 objfile->global_psymbols.size = total_symbols / 10;
1515 objfile->static_psymbols.size = total_symbols / 10;
1517 if (objfile->global_psymbols.size > 0)
1519 objfile->global_psymbols.next =
1520 objfile->global_psymbols.list = (struct partial_symbol **)
1521 xmalloc ((objfile->global_psymbols.size
1522 * sizeof (struct partial_symbol *)));
1524 if (objfile->static_psymbols.size > 0)
1526 objfile->static_psymbols.next =
1527 objfile->static_psymbols.list = (struct partial_symbol **)
1528 xmalloc ((objfile->static_psymbols.size
1529 * sizeof (struct partial_symbol *)));
1533 struct partial_symtab *
1534 allocate_psymtab (const char *filename, struct objfile *objfile)
1536 struct partial_symtab *psymtab;
1538 if (objfile->free_psymtabs)
1540 psymtab = objfile->free_psymtabs;
1541 objfile->free_psymtabs = psymtab->next;
1544 psymtab = (struct partial_symtab *)
1545 obstack_alloc (&objfile->objfile_obstack,
1546 sizeof (struct partial_symtab));
1548 memset (psymtab, 0, sizeof (struct partial_symtab));
1549 psymtab->filename = obsavestring (filename, strlen (filename),
1550 &objfile->objfile_obstack);
1551 psymtab->symtab = NULL;
1553 /* Prepend it to the psymtab list for the objfile it belongs to.
1554 Psymtabs are searched in most recent inserted -> least recent
1557 psymtab->objfile = objfile;
1558 psymtab->next = objfile->psymtabs;
1559 objfile->psymtabs = psymtab;
1565 discard_psymtab (struct partial_symtab *pst)
1567 struct partial_symtab **prev_pst;
1570 Empty psymtabs happen as a result of header files which don't
1571 have any symbols in them. There can be a lot of them. But this
1572 check is wrong, in that a psymtab with N_SLINE entries but
1573 nothing else is not empty, but we don't realize that. Fixing
1574 that without slowing things down might be tricky. */
1576 /* First, snip it out of the psymtab chain */
1578 prev_pst = &(pst->objfile->psymtabs);
1579 while ((*prev_pst) != pst)
1580 prev_pst = &((*prev_pst)->next);
1581 (*prev_pst) = pst->next;
1583 /* Next, put it on a free list for recycling */
1585 pst->next = pst->objfile->free_psymtabs;
1586 pst->objfile->free_psymtabs = pst;
1592 maintenance_print_psymbols (char *args, int from_tty)
1595 struct ui_file *outfile;
1596 struct cleanup *cleanups;
1597 char *symname = NULL;
1598 char *filename = DEV_TTY;
1599 struct objfile *objfile;
1600 struct partial_symtab *ps;
1606 error (_("print-psymbols takes an output file name and optional symbol file name"));
1608 argv = gdb_buildargv (args);
1609 cleanups = make_cleanup_freeargv (argv);
1611 if (argv[0] != NULL)
1614 /* If a second arg is supplied, it is a source file name to match on */
1615 if (argv[1] != NULL)
1621 filename = tilde_expand (filename);
1622 make_cleanup (xfree, filename);
1624 outfile = gdb_fopen (filename, FOPEN_WT);
1626 perror_with_name (filename);
1627 make_cleanup_ui_file_delete (outfile);
1630 ALL_PSYMTABS (objfile, ps)
1631 if (symname == NULL || strcmp (symname, ps->filename) == 0)
1632 dump_psymtab (objfile, ps, outfile);
1634 do_cleanups (cleanups);
1637 /* List all the partial symbol tables whose names match REGEXP (optional). */
1639 maintenance_info_psymtabs (char *regexp, int from_tty)
1641 struct program_space *pspace;
1642 struct objfile *objfile;
1647 ALL_PSPACES (pspace)
1648 ALL_PSPACE_OBJFILES (pspace, objfile)
1650 struct gdbarch *gdbarch = get_objfile_arch (objfile);
1651 struct partial_symtab *psymtab;
1653 /* We don't want to print anything for this objfile until we
1654 actually find a symtab whose name matches. */
1655 int printed_objfile_start = 0;
1657 ALL_OBJFILE_PSYMTABS (objfile, psymtab)
1662 || re_exec (psymtab->filename))
1664 if (! printed_objfile_start)
1666 printf_filtered ("{ objfile %s ", objfile->name);
1668 printf_filtered ("((struct objfile *) %s)\n",
1669 host_address_to_string (objfile));
1670 printed_objfile_start = 1;
1673 printf_filtered (" { psymtab %s ", psymtab->filename);
1675 printf_filtered ("((struct partial_symtab *) %s)\n",
1676 host_address_to_string (psymtab));
1678 printf_filtered (" readin %s\n",
1679 psymtab->readin ? "yes" : "no");
1680 printf_filtered (" fullname %s\n",
1681 psymtab->fullname ? psymtab->fullname : "(null)");
1682 printf_filtered (" text addresses ");
1683 fputs_filtered (paddress (gdbarch, psymtab->textlow),
1685 printf_filtered (" -- ");
1686 fputs_filtered (paddress (gdbarch, psymtab->texthigh),
1688 printf_filtered ("\n");
1689 printf_filtered (" globals ");
1690 if (psymtab->n_global_syms)
1692 printf_filtered ("(* (struct partial_symbol **) %s @ %d)\n",
1693 host_address_to_string (psymtab->objfile->global_psymbols.list
1694 + psymtab->globals_offset),
1695 psymtab->n_global_syms);
1698 printf_filtered ("(none)\n");
1699 printf_filtered (" statics ");
1700 if (psymtab->n_static_syms)
1702 printf_filtered ("(* (struct partial_symbol **) %s @ %d)\n",
1703 host_address_to_string (psymtab->objfile->static_psymbols.list
1704 + psymtab->statics_offset),
1705 psymtab->n_static_syms);
1708 printf_filtered ("(none)\n");
1709 printf_filtered (" dependencies ");
1710 if (psymtab->number_of_dependencies)
1714 printf_filtered ("{\n");
1715 for (i = 0; i < psymtab->number_of_dependencies; i++)
1717 struct partial_symtab *dep = psymtab->dependencies[i];
1719 /* Note the string concatenation there --- no comma. */
1720 printf_filtered (" psymtab %s "
1721 "((struct partial_symtab *) %s)\n",
1723 host_address_to_string (dep));
1725 printf_filtered (" }\n");
1728 printf_filtered ("(none)\n");
1729 printf_filtered (" }\n");
1733 if (printed_objfile_start)
1734 printf_filtered ("}\n");
1738 /* Check consistency of psymtabs and symtabs. */
1741 maintenance_check_symtabs (char *ignore, int from_tty)
1744 struct partial_symbol **psym;
1745 struct symtab *s = NULL;
1746 struct partial_symtab *ps;
1747 struct blockvector *bv;
1748 struct objfile *objfile;
1752 ALL_PSYMTABS (objfile, ps)
1754 struct gdbarch *gdbarch = get_objfile_arch (objfile);
1756 s = PSYMTAB_TO_SYMTAB (ps);
1759 bv = BLOCKVECTOR (s);
1760 b = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
1761 psym = ps->objfile->static_psymbols.list + ps->statics_offset;
1762 length = ps->n_static_syms;
1765 sym = lookup_block_symbol (b, SYMBOL_LINKAGE_NAME (*psym),
1766 SYMBOL_DOMAIN (*psym));
1769 printf_filtered ("Static symbol `");
1770 puts_filtered (SYMBOL_LINKAGE_NAME (*psym));
1771 printf_filtered ("' only found in ");
1772 puts_filtered (ps->filename);
1773 printf_filtered (" psymtab\n");
1777 b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
1778 psym = ps->objfile->global_psymbols.list + ps->globals_offset;
1779 length = ps->n_global_syms;
1782 sym = lookup_block_symbol (b, SYMBOL_LINKAGE_NAME (*psym),
1783 SYMBOL_DOMAIN (*psym));
1786 printf_filtered ("Global symbol `");
1787 puts_filtered (SYMBOL_LINKAGE_NAME (*psym));
1788 printf_filtered ("' only found in ");
1789 puts_filtered (ps->filename);
1790 printf_filtered (" psymtab\n");
1794 if (ps->texthigh < ps->textlow)
1796 printf_filtered ("Psymtab ");
1797 puts_filtered (ps->filename);
1798 printf_filtered (" covers bad range ");
1799 fputs_filtered (paddress (gdbarch, ps->textlow), gdb_stdout);
1800 printf_filtered (" - ");
1801 fputs_filtered (paddress (gdbarch, ps->texthigh), gdb_stdout);
1802 printf_filtered ("\n");
1805 if (ps->texthigh == 0)
1807 if (ps->textlow < BLOCK_START (b) || ps->texthigh > BLOCK_END (b))
1809 printf_filtered ("Psymtab ");
1810 puts_filtered (ps->filename);
1811 printf_filtered (" covers ");
1812 fputs_filtered (paddress (gdbarch, ps->textlow), gdb_stdout);
1813 printf_filtered (" - ");
1814 fputs_filtered (paddress (gdbarch, ps->texthigh), gdb_stdout);
1815 printf_filtered (" but symtab covers only ");
1816 fputs_filtered (paddress (gdbarch, BLOCK_START (b)), gdb_stdout);
1817 printf_filtered (" - ");
1818 fputs_filtered (paddress (gdbarch, BLOCK_END (b)), gdb_stdout);
1819 printf_filtered ("\n");
1827 map_partial_symbol_names (void (*fun) (const char *, void *), void *data)
1829 struct objfile *objfile;
1831 ALL_OBJFILES (objfile)
1834 objfile->sf->qf->map_symbol_names (objfile, fun, data);
1839 map_partial_symbol_filenames (void (*fun) (const char *, const char *,
1843 struct objfile *objfile;
1845 ALL_OBJFILES (objfile)
1848 objfile->sf->qf->map_symbol_filenames (objfile, fun, data);