25 #include "filenames.h"
32 #include "readline/readline.h"
40 #define DEV_TTY "/dev/tty"
68 struct objfile *objfile);
112 #define ALL_OBJFILE_PSYMTABS_REQUIRED(objfile, p) \
113 for ((p) = require_partial_symbols (objfile, 1)->psymtabs; \
119 #undef ALL_OBJFILE_PSYMTABS
123 #define ALL_PSYMTABS(objfile, p) \
124 ALL_OBJFILES (objfile) \
125 ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, p)
133 const char *real_path,
135 int (*callback) (
struct symtab *,
void *),
162 const char *real_path,
163 int (*callback) (
struct symtab *,
168 const char *name_basename = lbasename (name);
174 if (pst->
user != NULL)
184 pst, callback, data))
192 && FILENAME_CMP (name_basename, lbasename (pst->
filename)) != 0)
198 pst, callback, data))
205 if (real_path != NULL)
212 pst, callback, data))
245 if (msymbol.
minsym == NULL)
255 for (tpst = pst; tpst != NULL; tpst = tpst->
next)
291 if (this_addr > best_addr)
293 best_addr = this_addr;
361 && pc >= pst->
textlow && pc < pst->texthigh)
367 if (best_pst != NULL)
388 if (warn_if_readin && ps->
readin)
393 (Internal error: pc %s in read in psymtab, but not in symtab.)\n"),
507 int block_index,
const char *name,
511 const int psymtab_index = (block_index ==
GLOBAL_BLOCK ? 1 : 0);
517 psymtab_index, domain))
519 struct symbol *sym, *with_opaque = NULL;
538 if (with_opaque != NULL
567 int do_linear_search = 1;
575 if (global && ordered_compare)
577 do_linear_search = 0;
586 top = start + length - 1;
590 center = bottom + (top - bottom) / 2;
592 if (!do_linear_search
594 do_linear_search = 1;
602 while (top <= real_top
615 if (do_linear_search)
617 for (psym = start; psym < start + length; psym++)
645 if (strchr (name,
'('))
659 return xstrdup (name);
673 int do_linear_search = 1;
690 do_linear_search = 0;
699 top = start + length - 1;
703 center = bottom + (top - bottom) / 2;
706 _(
"failed internal consistency check"));
707 if (!do_linear_search
710 do_linear_search = 1;
722 if (!(top == bottom))
724 _(
"failed internal consistency check"));
749 if (do_linear_search)
751 for (psym = start; psym < start + length; psym++)
778 while (pst->
user != NULL)
815 psym < objfile->global_psymbols.next;
824 psym < objfile->static_psymbols.next;
846 int len = strlen (name);
848 if (!(len > 2 && (strcmp (&name[len - 2],
".h") == 0
849 || strcmp (name,
"<<C++-namespaces>>") == 0)))
858 _(
"select_source_symtab: "
859 "readin pst found and no symtabs."));
1010 " Full symtab was read (at ");
1033 if (psymtab->
user != NULL)
1087 psymtab = psymtab->
next)
1104 const char *func_name)
1153 || filename_cmp (lbasename (fullname), lbasename (p->
filename)) == 0)
1178 if (ps->
user != NULL)
1247 struct block *block,
1248 int (*callback) (
struct block *,
struct symbol *,
void *),
1260 if (callback (block, sym, data))
1275 int (*callback) (
struct block *,
1276 struct symbol *,
void *),
1292 struct block *block;
1297 if (
map_block (name, domain, objfile, block,
1298 callback, data, match))
1300 if (callback (block, NULL, data))
1313 struct objfile *objfile,
1338 objfile, kind, sym_matcher, data);
1399 (
struct objfile *objfile,
1423 if (ps->
user != NULL)
1433 match = (*file_matcher) (ps->
filename, data, 0);
1439 || (*file_matcher) (lbasename (ps->
filename), data, 1))
1451 if (expansion_notify != NULL)
1452 expansion_notify (symtab, data);
1536 static unsigned long
1539 unsigned long h = 0;
1637 memset (&psymbol, 0,
sizeof (psymbol));
1667 struct objfile *objfile)
1671 if (listp->
size == 0)
1679 new_size = listp->
size * 2;
1687 listp->
size = new_size;
1696 struct objfile *objfile)
1723 val, coreaddr, language, objfile, &added);
1804 static char *last_objfile_name = NULL;
1806 if (last_objfile_name == NULL
1807 || strcmp (last_objfile_name,
objfile_name (objfile)) != 0)
1809 xfree (last_objfile_name);
1812 "Creating one or more psymtabs for objfile %s ...\n",
1816 "Created psymtab %s for module %s.\n",
1838 while ((*prev_pst) != pst)
1839 prev_pst = &((*prev_pst)->next);
1840 (*prev_pst) = pst->
next;
1894 char *symname = NULL;
1896 struct objfile *objfile;
1904 print-psymbols takes an output file name and optional symbol file name"));
1909 if (argv[0] != NULL)
1913 if (argv[1] != NULL)
1919 filename = tilde_expand (filename);
1922 outfile =
gdb_fopen (filename, FOPEN_WT);
1930 if (symname == NULL || filename_cmp (symname, ps->
filename) == 0)
1941 struct objfile *objfile;
1954 int printed_objfile_start = 0;
1963 if (! printed_objfile_start)
1969 printed_objfile_start = 1;
1978 psymtab->
readin ?
"yes" :
"no");
2024 "((struct partial_symtab *) %s)\n",
2036 if (printed_objfile_start)
2051 struct objfile *objfile;
2141 Print dump of current partial symbol definitions.\n\
2142 Entries in the partial symbol table are dumped to file OUTFILE.\n\
2143 If a SOURCE file is specified, dump only that file's partial symbols."),
2147 List the partial symbol tables for all object files.\n\
2148 This does not include information about individual partial symbols,\n\
2149 just the symbol table structures themselves."),
2154 Check consistency of currently expanded psymtabs versus symtabs."),
static void psym_expand_all_symtabs(struct objfile *objfile)
struct psymbol_allocation_list static_psymbols
struct cleanup * make_cleanup_freeargv(char **arg)
static void maintenance_print_psymbols(char *args, int from_tty)
static void discard_psymtabs_upto(void *arg)
const void * bcache(const void *addr, int length, struct bcache *cache)
unsigned long hash_continue(const void *addr, int length, unsigned long h)
#define SECT_OFF_TEXT(objfile)
struct psymbol_bcache * psymbol_bcache_init(void)
int block_find_non_opaque_type_preferred(struct symbol *sym, void *data)
static struct partial_symbol * match_partial_symbol(struct objfile *, struct partial_symtab *, int, const char *, domain_enum, symbol_compare_ftype *, symbol_compare_ftype *)
static struct compunit_symtab * psym_find_pc_sect_compunit_symtab(struct objfile *objfile, struct bound_minimal_symbol msymbol, CORE_ADDR pc, struct obj_section *section, int warn_if_readin)
static struct partial_symtab * find_pc_sect_psymtab(struct objfile *objfile, CORE_ADDR pc, struct obj_section *section, struct bound_minimal_symbol msymbol)
struct bcache * psymbol_bcache_get_bcache(struct psymbol_bcache *bcache)
void psymbol_bcache_free(struct psymbol_bcache *bcache)
static void append_psymbol_to_list(struct psymbol_allocation_list *list, const struct partial_symbol *psym, struct objfile *objfile)
int find_and_open_source(const char *filename, const char *dirname, char **fullname)
int strcmp_iw(const char *string1, const char *string2)
char * rewrite_source_path(const char *path)
static char * psymtab_search_name(const char *name)
#define BMSYMBOL_VALUE_ADDRESS(symbol)
void warning(const char *fmt,...)
struct psymbol_allocation_list global_psymbols
#define ALL_OBJFILE_PSYMTABS_REQUIRED(objfile, p)
int objfile_has_symbols(struct objfile *objfile)
static void print_partial_symbols(struct gdbarch *gdbarch, struct partial_symbol **p, int count, char *what, struct ui_file *outfile)
struct partial_symtab * allocate_psymtab(const char *filename, struct objfile *objfile)
static int psym_has_symbols(struct objfile *objfile)
initialize_file_ftype _initialize_psymtab
static int psymbol_compare(const void *addr1, const void *addr2, int length)
struct cmd_list_element * maintenanceinfolist
static struct partial_symtab * find_pc_sect_psymtab_closer(struct objfile *objfile, CORE_ADDR pc, struct obj_section *section, struct partial_symtab *pst, struct bound_minimal_symbol msymbol)
enum domain_enum_tag domain_enum
int compare_filenames_for_search(const char *filename, const char *search_name)
struct ui_file * gdb_stdout
#define PSYMBOL_DOMAIN(psymbol)
struct ui_file * gdb_fopen(const char *name, const char *mode)
void( expand_symtabs_exp_notify_ftype)(struct compunit_symtab *symtab, void *data)
void internal_error(const char *file, int line, const char *fmt,...)
static void maintenance_check_psymtabs(char *ignore, int from_tty)
enum language la_language
static void psym_relocate(struct objfile *objfile, const struct section_offsets *new_offsets, const struct section_offsets *delta)
#define BLOCKVECTOR_BLOCK(blocklist, n)
static void keep_going(struct execution_control_state *ecs)
const void * bcache_full(const void *addr, int length, struct bcache *bcache, int *added)
struct general_symbol_info ginfo
__extension__ enum domain_enum_tag domain
static void psym_map_matching_symbols(struct objfile *objfile, const char *name, domain_enum domain, int global, int(*callback)(struct block *, struct symbol *, void *), void *data, symbol_compare_ftype *match, symbol_compare_ftype *ordered_compare)
struct objfile_per_bfd_storage * per_bfd
void printf_filtered(const char *format,...)
const char * paddress(struct gdbarch *gdbarch, CORE_ADDR addr)
#define SYMBOL_OBJ_SECTION(objfile, symbol)
struct obstack objfile_obstack
static unsigned long psymbol_hash(const void *addr, int length)
union general_symbol_info::@158 value
#define PSYMBOL_CLASS(psymbol)
#define ALL_PSYMTABS(objfile, p)
#define SYMBOL_VALUE_ADDRESS(symbol)
struct cleanup * make_cleanup_dtor(make_cleanup_ftype *function, void *arg, make_cleanup_dtor_ftype *dtor)
static void psym_forget_cached_source_info(struct objfile *objfile)
#define SYMBOL_DOMAIN(symbol)
void initialize_file_ftype(void)
char * cp_remove_params(const char *demangled_name)
static void maintenance_info_psymtabs(char *regexp, int from_tty)
static void fixup_psymbol_section(struct partial_symbol *psym, struct objfile *objfile)
#define SYMBOL_MATCHES_SEARCH_NAME(symbol, name)
void fprintf_filtered(struct ui_file *stream, const char *format,...)
static void psym_dump(struct objfile *objfile)
#define SYMBOL_DEMANGLED_NAME(symbol)
#define SYMBOL_SET_LANGUAGE(symbol, language, obstack)
struct partial_symbol ** next
static struct partial_symbol * lookup_partial_symbol(struct objfile *, struct partial_symtab *, const char *, int, domain_enum)
static struct partial_symbol * find_pc_sect_psymbol(struct objfile *, struct partial_symtab *, CORE_ADDR, struct obj_section *)
struct cleanup * make_cleanup_discard_psymtabs(struct objfile *objfile)
void fprintf_unfiltered(struct ui_file *stream, const char *format,...)
struct symtab * compunit_primary_filetab(const struct compunit_symtab *cust)
void fputs_filtered(const char *linebuffer, struct ui_file *stream)
void puts_filtered(const char *string)
struct cmd_list_element * add_cmd(const char *name, enum command_class theclass, cmd_cfunc_ftype *fun, const char *doc, struct cmd_list_element **list)
const struct sym_fns * sf
static void psym_map_symbol_filenames(struct objfile *objfile, symbol_filename_ftype *fun, void *data, int need_fullname)
static void extend_psymbol_list(struct psymbol_allocation_list *listp, struct objfile *objfile)
int( expand_symtabs_symbol_matcher_ftype)(const char *name, void *data)
struct cleanup * make_cleanup(make_cleanup_ftype *function, void *arg)
#define ANOFFSET(secoff, whichone)
struct gdbarch * get_objfile_arch(const struct objfile *objfile)
struct bcache * bcache_xmalloc(unsigned long(*hash_function)(const void *, int length), int(*compare_function)(const void *, const void *, int length))
static void psym_expand_symtabs_for_function(struct objfile *objfile, const char *func_name)
__extension__ enum psymtab_search_status searched_flag
#define SYMBOL_LINKAGE_NAME(symbol)
struct compunit_symtab * compunit_symtabs
static void dump_psymtab(struct objfile *objfile, struct partial_symtab *psymtab, struct ui_file *outfile)
struct partial_symtab * save
int iterate_over_some_symtabs(const char *name, const char *real_path, int(*callback)(struct symtab *symtab, void *data), void *data, struct compunit_symtab *first, struct compunit_symtab *after_last)
struct symbol * block_lookup_symbol(const struct block *block, const char *name, const domain_enum domain)
void wrap_here(char *indent)
void printf_unfiltered(const char *format,...)
int number_of_dependencies
unsigned char psymtabs_addrmap_supported
const char * objfile_name(const struct objfile *objfile)
struct ui_file * gdb_stdlog
struct partial_symtab * user
struct cmd_list_element * maintenanceprintlist
void(* sym_read_psymbols)(struct objfile *)
#define SYMBOL_VALUE(symbol)
static struct symtab * psym_find_last_source_symtab(struct objfile *ofp)
static int map_block(const char *name, domain_enum domain, struct objfile *objfile, struct block *block, int(*callback)(struct block *, struct symbol *, void *), void *data, symbol_compare_ftype *match)
static const struct partial_symbol * add_psymbol_to_bcache(const char *name, int namelength, int copy_name, domain_enum domain, enum address_class theclass, long val, CORE_ADDR coreaddr, enum language language, struct objfile *objfile, int *added)
struct bcache * filename_cache
struct symbol * block_iter_match_next(const char *name, symbol_compare_ftype *compare, struct block_iterator *iterator)
static int recursively_search_psymtabs(struct partial_symtab *ps, struct objfile *objfile, enum search_domain kind, expand_symtabs_symbol_matcher_ftype *sym_matcher, void *data)
PTR xrealloc(PTR ptr, size_t size)
#define OBJF_PSYMTABS_READ
#define COMPUNIT_BLOCKVECTOR(cust)
int( symbol_compare_ftype)(const char *string1, const char *string2)
#define SYMBOL_SET_NAMES(symbol, linkage_name, len, copy_name, objfile)
void add_psymbol_to_list(const char *name, int namelength, int copy_name, domain_enum domain, enum address_class theclass, struct psymbol_allocation_list *list, long val, CORE_ADDR coreaddr, enum language language, struct objfile *objfile)
struct symbol * block_find_symbol(const struct block *block, const char *name, const domain_enum domain, block_symbol_matcher_ftype *matcher, void *data)
void discard_psymtab(struct objfile *objfile, struct partial_symtab *pst)
int strcmp_iw_ordered(const char *string1, const char *string2)
const struct language_defn * current_language
void gdb_print_host_address(const void *addr, struct ui_file *stream)
void void void void void void void void void perror_with_name(const char *string) ATTRIBUTE_NORETURN
#define ALL_PSPACES(pspace)
static int partial_map_expand_apply(struct objfile *objfile, const char *name, const char *real_path, struct partial_symtab *pst, int(*callback)(struct symtab *, void *), void *data)
static void psym_expand_symtabs_with_fullname(struct objfile *objfile, const char *fullname)
struct cleanup * make_cleanup_ui_file_delete(struct ui_file *arg)
struct partial_symtab * next
int( expand_symtabs_file_matcher_ftype)(const char *filename, void *data, int basenames)
struct partial_symtab ** dependencies
static int compare_psymbols(const void *s1p, const void *s2p)
struct minimal_symbol * minsym
__extension__ enum language language
const char * host_address_to_string(const void *addr)
#define OBJSTAT(objfile, expr)
static const char * psymtab_to_fullname(struct partial_symtab *ps)
#define SYMBOL_LANGUAGE(symbol)
char ** gdb_buildargv(const char *s)
static void psym_print_stats(struct objfile *objfile)
struct partial_symtab * free_psymtabs
int symbol_matches_domain(enum language symbol_language, domain_enum symbol_domain, domain_enum domain)
void bcache_xfree(struct bcache *bcache)
struct partial_symbol ** list
void fixup_section(struct general_symbol_info *ginfo, CORE_ADDR addr, struct objfile *objfile)
enum overlay_debugging_state overlay_debugging
EXTERN_C char * re_comp(const char *)
void(* read_symtab)(struct partial_symtab *, struct objfile *)
unsigned int symtab_create_debug
static int ignore(struct target_ops *ops, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
static struct compunit_symtab * psym_lookup_symbol(struct objfile *objfile, int block_index, const char *name, const domain_enum domain)
struct cleanup * increment_reading_symtab(void)
struct addrmap * psymtabs_addrmap
#define SYMBOL_SEARCH_NAME(symbol)
struct partial_symtab * start_psymtab_common(struct objfile *objfile, const char *filename, CORE_ADDR textlow, struct partial_symbol **global_syms, struct partial_symbol **static_syms)
struct cmd_list_element * maintenancelist
static void psym_expand_symtabs_matching(struct objfile *objfile, expand_symtabs_file_matcher_ftype *file_matcher, expand_symtabs_symbol_matcher_ftype *symbol_matcher, expand_symtabs_exp_notify_ftype *expansion_notify, enum search_domain kind, void *data)
void * addrmap_find(struct addrmap *map, CORE_ADDR addr)
int matching_obj_sections(struct obj_section *obj_first, struct obj_section *obj_second)
#define SYMBOL_SECTION(symbol)
static struct compunit_symtab * psymtab_to_symtab(struct objfile *objfile, struct partial_symtab *pst)
struct compunit_symtab * compunit_symtab
void gdb_flush(struct ui_file *file)
static int psym_map_symtabs_matching_filename(struct objfile *objfile, const char *name, const char *real_path, int(*callback)(struct symtab *, void *), void *data)
struct symbol * block_iter_match_first(const struct block *block, const char *name, symbol_compare_ftype *compare, struct block_iterator *iterator)
void init_psymbol_list(struct objfile *objfile, int total_symbols)
#define ALL_PSPACE_OBJFILES(ss, obj)
struct psymbol_bcache * psymbol_cache
void error(const char *fmt,...)
void sort_pst_symbols(struct objfile *objfile, struct partial_symtab *pst)
static const struct partial_symbol * psymbol_bcache_full(struct partial_symbol *sym, struct psymbol_bcache *bcache, int *added)
struct objfile * require_partial_symbols(struct objfile *objfile, int verbose)
void( symbol_filename_ftype)(const char *filename, const char *fullname, void *data)
void do_cleanups(struct cleanup *old_chain)
char * copy_name(struct stoken token)
struct partial_symtab * psymtabs
const ULONGEST const LONGEST len