gdb
* xcoffread.c: Include psymtab.h. (xcoff_sym_fns): Update. * symtab.h (struct partial_symbol): Remove. (PSYMBOL_DOMAIN, PSYMBOL_CLASS): Remove. (struct partial_symtab): Remove. (PSYMTAB_TO_SYMTAB): Remove. (lookup_partial_symbol, lookup_partial_symtab, find_pc_psymtab) (find_pc_sect_psymtab): Remove. (find_pc_sect_symtab_via_partial): Declare. (find_pc_psymtab, find_pc_sect_psymbol, psymtab_to_symtab) (find_main_psymtab): Remove. (find_main_filename): Declare. (fixup_psymbol_section): Remove. (fixup_section): Declare. * symtab.c: Include psymtab.h. (lookup_symtab): Use lookup_symtab method. (lookup_partial_symtab): Remove. (find_pc_sect_psymtab_closer): Remove. (find_pc_sect_psymtab): Remove. (find_pc_sect_symtab_via_partial): New function. (find_pc_psymtab, find_pc_sect_psymbol, find_pc_psymbol): Remove. (fixup_section): No longer static. (fixup_psymbol_section): Remove. (lookup_symbol_aux): Use lookup_symbol_aux_quick. (lookup_global_symbol_from_objfile): Likewise. (lookup_symbol_aux_psymtabs): Remove. (lookup_symbol_aux_quick): New function. (lookup_symbol_global): Use lookup_symbol_aux_quick. (lookup_partial_symbol): Remove. (basic_lookup_transparent_type_quick): New function. (basic_lookup_transparent_type): Use it. (find_main_psymtab): Remove. (find_main_filename): New function. (find_pc_sect_symtab): Use find_pc_sect_symtab method. (find_line_symtab): Use expand_symtabs_with_filename method. (output_partial_symbol_filename): New function. (sources_info): Use map_partial_symbol_filenames. (struct search_symbols_data): New type. (search_symbols_file_matches): New function. (search_symbols_name_matches): Likewise. (search_symbols): Use expand_symtabs_matching method. (struct add_name_data): Rename from add_macro_name_data. (add_macro_name): Update. (add_partial_symbol_name): New function. (default_make_symbol_completion_list): Use map_partial_symbol_names. (struct add_partial_symbol_name): New type. (maybe_add_partial_symtab_filename): New function. (make_source_files_completion_list): Use map_partial_symbol_filenames. (expand_line_sal): Use expand_symtabs_with_filename method. * symmisc.c: Include psymtab.h. (print_objfile_statistics): Use print_stats method. (dump_objfile): Use dump method. (dump_psymtab, maintenance_print_psymbols) (maintenance_info_psymtabs, maintenance_check_symtabs) (extend_psymbol_list): Remove. * symfile.h (struct quick_symbol_functions): New struct. (struct sym_fns) <qf>: New field. (sort_pst_symbols): Remove. (increment_reading_symtab): Declare. * symfile.c: Include psymtab.h. (compare_psymbols, sort_pst_symbols): Remove. (psymtab_to_symtab): Remove. (increment_reading_symtab): New function. (symbol_file_add_with_addrs_or_offsets): Use expand_all_symtabs method. (set_initial_language): Use find_main_filename. (allocate_psymtab, discard_psymtab, cashier_psymtab): Remove. (free_named_symtabs): Remove unused code. (start_psymtab_common, add_psymbol_to_bcache) (append_psymbol_to_list, add_psymbol_to_list, init_psymbol_list): Remove. * stack.c: Include psymtab.h, symfile.h. (backtrace_command_1): Use find_pc_sect_symtab_via_partial. * source.h (psymtab_to_fullname): Don't declare. * source.c: Include psymtab.h. (select_source_symtab): Use find_last_source_symtab method. (forget_cached_source_info): Use forget_cached_source_info method. (find_and_open_source): No longer static. (psymtab_to_fullname): Remove. * somread.c: Include psymtab.h. (som_sym_fns): Update. * psympriv.h: New file. * psymtab.h: New file. * psymtab.c: New file. * objfiles.h: (ALL_OBJFILE_PSYMTABS): Remove. (ALL_PSYMTABS, ALL_PSPACE_PSYMTABS): Likewise. * objfiles.c: Include psymtab.h. (objfile_relocate1): Use relocate method. (objfile_has_partial_symbols): Use has_symbols method. * mipsread.c: Include psymtab.h. (ecoff_sym_fns): Update. * mi/mi-cmd-file.c: Include psymtab.h. (print_partial_file_name): New function. (mi_cmd_file_list_exec_source_files): Use map_partial_symbol_filenames. * mdebugread.c: Include psympriv.h. * machoread.c: Include psympriv.h. (macho_sym_fns): Update. * m2-exp.y (yylex): Use lookup_symtab. * elfread.c: Include psympriv.h. (elf_sym_fns): Update. * dwarf2read.c: Include psympriv.h. * dbxread.c: Include psympriv.h. (aout_sym_fns): Update. * cp-support.c: Include psymtab.h. (read_in_psymtabs): Remove. (make_symbol_overload_list_qualified): Use expand_symtabs_for_function method. * coffread.c: Include psympriv.h. (coff_sym_fns): Update. * blockframe.c: Include psymtab.h. (find_pc_partial_function): Use find_pc_sect_symtab method. * ada-lang.h (ada_update_initial_language): Update. * ada-lang.c: Include psymtab.h. (ada_update_initial_language): Remove 'main_pst' argument. (ada_lookup_partial_symbol): Remove. (struct ada_psym_data): New type. (ada_add_psyms): New function. (ada_add_non_local_symbols): Use map_ada_symtabs method. (struct add_partial_datum): New type. (ada_add_partial_symbol_completions): New function. (ada_make_symbol_completion_list): Use map_partial_symbol_names. (ada_exception_support_info_sniffer): Update. * Makefile.in (SFILES): Add psymtab.c. (COMMON_OBS): Add psymtab.o. (HFILES_NO_SRCDIR): Add psymtab.h, psympriv.h. gdb/doc * gdbint.texinfo (Symbol Handling): Update.
This commit is contained in:
parent
a2a5469e79
commit
ccefe4c44c
32 changed files with 2773 additions and 2064 deletions
132
gdb/ChangeLog
132
gdb/ChangeLog
|
@ -1,3 +1,135 @@
|
||||||
|
2010-03-10 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
|
* xcoffread.c: Include psymtab.h.
|
||||||
|
(xcoff_sym_fns): Update.
|
||||||
|
* symtab.h (struct partial_symbol): Remove.
|
||||||
|
(PSYMBOL_DOMAIN, PSYMBOL_CLASS): Remove.
|
||||||
|
(struct partial_symtab): Remove.
|
||||||
|
(PSYMTAB_TO_SYMTAB): Remove.
|
||||||
|
(lookup_partial_symbol, lookup_partial_symtab, find_pc_psymtab)
|
||||||
|
(find_pc_sect_psymtab): Remove.
|
||||||
|
(find_pc_sect_symtab_via_partial): Declare.
|
||||||
|
(find_pc_psymtab, find_pc_sect_psymbol, psymtab_to_symtab)
|
||||||
|
(find_main_psymtab): Remove.
|
||||||
|
(find_main_filename): Declare.
|
||||||
|
(fixup_psymbol_section): Remove.
|
||||||
|
(fixup_section): Declare.
|
||||||
|
* symtab.c: Include psymtab.h.
|
||||||
|
(lookup_symtab): Use lookup_symtab method.
|
||||||
|
(lookup_partial_symtab): Remove.
|
||||||
|
(find_pc_sect_psymtab_closer): Remove.
|
||||||
|
(find_pc_sect_psymtab): Remove.
|
||||||
|
(find_pc_sect_symtab_via_partial): New function.
|
||||||
|
(find_pc_psymtab, find_pc_sect_psymbol, find_pc_psymbol): Remove.
|
||||||
|
(fixup_section): No longer static.
|
||||||
|
(fixup_psymbol_section): Remove.
|
||||||
|
(lookup_symbol_aux): Use lookup_symbol_aux_quick.
|
||||||
|
(lookup_global_symbol_from_objfile): Likewise.
|
||||||
|
(lookup_symbol_aux_psymtabs): Remove.
|
||||||
|
(lookup_symbol_aux_quick): New function.
|
||||||
|
(lookup_symbol_global): Use lookup_symbol_aux_quick.
|
||||||
|
(lookup_partial_symbol): Remove.
|
||||||
|
(basic_lookup_transparent_type_quick): New function.
|
||||||
|
(basic_lookup_transparent_type): Use it.
|
||||||
|
(find_main_psymtab): Remove.
|
||||||
|
(find_main_filename): New function.
|
||||||
|
(find_pc_sect_symtab): Use find_pc_sect_symtab method.
|
||||||
|
(find_line_symtab): Use expand_symtabs_with_filename method.
|
||||||
|
(output_partial_symbol_filename): New function.
|
||||||
|
(sources_info): Use map_partial_symbol_filenames.
|
||||||
|
(struct search_symbols_data): New type.
|
||||||
|
(search_symbols_file_matches): New function.
|
||||||
|
(search_symbols_name_matches): Likewise.
|
||||||
|
(search_symbols): Use expand_symtabs_matching method.
|
||||||
|
(struct add_name_data): Rename from add_macro_name_data.
|
||||||
|
(add_macro_name): Update.
|
||||||
|
(add_partial_symbol_name): New function.
|
||||||
|
(default_make_symbol_completion_list): Use
|
||||||
|
map_partial_symbol_names.
|
||||||
|
(struct add_partial_symbol_name): New type.
|
||||||
|
(maybe_add_partial_symtab_filename): New function.
|
||||||
|
(make_source_files_completion_list): Use
|
||||||
|
map_partial_symbol_filenames.
|
||||||
|
(expand_line_sal): Use expand_symtabs_with_filename method.
|
||||||
|
* symmisc.c: Include psymtab.h.
|
||||||
|
(print_objfile_statistics): Use print_stats method.
|
||||||
|
(dump_objfile): Use dump method.
|
||||||
|
(dump_psymtab, maintenance_print_psymbols)
|
||||||
|
(maintenance_info_psymtabs, maintenance_check_symtabs)
|
||||||
|
(extend_psymbol_list): Remove.
|
||||||
|
* symfile.h (struct quick_symbol_functions): New struct.
|
||||||
|
(struct sym_fns) <qf>: New field.
|
||||||
|
(sort_pst_symbols): Remove.
|
||||||
|
(increment_reading_symtab): Declare.
|
||||||
|
* symfile.c: Include psymtab.h.
|
||||||
|
(compare_psymbols, sort_pst_symbols): Remove.
|
||||||
|
(psymtab_to_symtab): Remove.
|
||||||
|
(increment_reading_symtab): New function.
|
||||||
|
(symbol_file_add_with_addrs_or_offsets): Use expand_all_symtabs
|
||||||
|
method.
|
||||||
|
(set_initial_language): Use find_main_filename.
|
||||||
|
(allocate_psymtab, discard_psymtab, cashier_psymtab): Remove.
|
||||||
|
(free_named_symtabs): Remove unused code.
|
||||||
|
(start_psymtab_common, add_psymbol_to_bcache)
|
||||||
|
(append_psymbol_to_list, add_psymbol_to_list, init_psymbol_list):
|
||||||
|
Remove.
|
||||||
|
* stack.c: Include psymtab.h, symfile.h.
|
||||||
|
(backtrace_command_1): Use find_pc_sect_symtab_via_partial.
|
||||||
|
* source.h (psymtab_to_fullname): Don't declare.
|
||||||
|
* source.c: Include psymtab.h.
|
||||||
|
(select_source_symtab): Use find_last_source_symtab method.
|
||||||
|
(forget_cached_source_info): Use forget_cached_source_info
|
||||||
|
method.
|
||||||
|
(find_and_open_source): No longer static.
|
||||||
|
(psymtab_to_fullname): Remove.
|
||||||
|
* somread.c: Include psymtab.h.
|
||||||
|
(som_sym_fns): Update.
|
||||||
|
* psympriv.h: New file.
|
||||||
|
* psymtab.h: New file.
|
||||||
|
* psymtab.c: New file.
|
||||||
|
* objfiles.h: (ALL_OBJFILE_PSYMTABS): Remove.
|
||||||
|
(ALL_PSYMTABS, ALL_PSPACE_PSYMTABS): Likewise.
|
||||||
|
* objfiles.c: Include psymtab.h.
|
||||||
|
(objfile_relocate1): Use relocate method.
|
||||||
|
(objfile_has_partial_symbols): Use has_symbols method.
|
||||||
|
* mipsread.c: Include psymtab.h.
|
||||||
|
(ecoff_sym_fns): Update.
|
||||||
|
* mi/mi-cmd-file.c: Include psymtab.h.
|
||||||
|
(print_partial_file_name): New function.
|
||||||
|
(mi_cmd_file_list_exec_source_files): Use
|
||||||
|
map_partial_symbol_filenames.
|
||||||
|
* mdebugread.c: Include psympriv.h.
|
||||||
|
* machoread.c: Include psympriv.h.
|
||||||
|
(macho_sym_fns): Update.
|
||||||
|
* m2-exp.y (yylex): Use lookup_symtab.
|
||||||
|
* elfread.c: Include psympriv.h.
|
||||||
|
(elf_sym_fns): Update.
|
||||||
|
* dwarf2read.c: Include psympriv.h.
|
||||||
|
* dbxread.c: Include psympriv.h.
|
||||||
|
(aout_sym_fns): Update.
|
||||||
|
* cp-support.c: Include psymtab.h.
|
||||||
|
(read_in_psymtabs): Remove.
|
||||||
|
(make_symbol_overload_list_qualified): Use
|
||||||
|
expand_symtabs_for_function method.
|
||||||
|
* coffread.c: Include psympriv.h.
|
||||||
|
(coff_sym_fns): Update.
|
||||||
|
* blockframe.c: Include psymtab.h.
|
||||||
|
(find_pc_partial_function): Use find_pc_sect_symtab method.
|
||||||
|
* ada-lang.h (ada_update_initial_language): Update.
|
||||||
|
* ada-lang.c: Include psymtab.h.
|
||||||
|
(ada_update_initial_language): Remove 'main_pst' argument.
|
||||||
|
(ada_lookup_partial_symbol): Remove.
|
||||||
|
(struct ada_psym_data): New type.
|
||||||
|
(ada_add_psyms): New function.
|
||||||
|
(ada_add_non_local_symbols): Use map_ada_symtabs method.
|
||||||
|
(struct add_partial_datum): New type.
|
||||||
|
(ada_add_partial_symbol_completions): New function.
|
||||||
|
(ada_make_symbol_completion_list): Use map_partial_symbol_names.
|
||||||
|
(ada_exception_support_info_sniffer): Update.
|
||||||
|
* Makefile.in (SFILES): Add psymtab.c.
|
||||||
|
(COMMON_OBS): Add psymtab.o.
|
||||||
|
(HFILES_NO_SRCDIR): Add psymtab.h, psympriv.h.
|
||||||
|
|
||||||
2010-03-10 Pierre Muller <muller@ics.u-strasbg.fr>
|
2010-03-10 Pierre Muller <muller@ics.u-strasbg.fr>
|
||||||
|
|
||||||
* remote-fileio.c (cygwin_conv_path): Define macro for old cygwin API.
|
* remote-fileio.c (cygwin_conv_path): Define macro for old cygwin API.
|
||||||
|
|
|
@ -674,7 +674,7 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \
|
||||||
objfiles.c osabi.c observer.c osdata.c \
|
objfiles.c osabi.c observer.c osdata.c \
|
||||||
p-exp.y p-lang.c p-typeprint.c p-valprint.c parse.c printcmd.c \
|
p-exp.y p-lang.c p-typeprint.c p-valprint.c parse.c printcmd.c \
|
||||||
progspace.c \
|
progspace.c \
|
||||||
prologue-value.c \
|
prologue-value.c psymtab.c \
|
||||||
regcache.c reggroups.c remote.c remote-fileio.c reverse.c \
|
regcache.c reggroups.c remote.c remote-fileio.c reverse.c \
|
||||||
scm-exp.c scm-lang.c scm-valprint.c \
|
scm-exp.c scm-lang.c scm-valprint.c \
|
||||||
sentinel-frame.c \
|
sentinel-frame.c \
|
||||||
|
@ -764,7 +764,8 @@ config/rs6000/nm-rs6000.h top.h bsd-kvm.h gdb-stabs.h reggroups.h \
|
||||||
annotate.h sim-regno.h dictionary.h dfp.h main.h frame-unwind.h \
|
annotate.h sim-regno.h dictionary.h dfp.h main.h frame-unwind.h \
|
||||||
remote-fileio.h i386-linux-tdep.h vax-tdep.h objc-lang.h \
|
remote-fileio.h i386-linux-tdep.h vax-tdep.h objc-lang.h \
|
||||||
sentinel-frame.h bcache.h symfile.h windows-tdep.h linux-tdep.h \
|
sentinel-frame.h bcache.h symfile.h windows-tdep.h linux-tdep.h \
|
||||||
gdb_usleep.h jit.h xml-syscall.h ada-operator.inc microblaze-tdep.h
|
gdb_usleep.h jit.h xml-syscall.h ada-operator.inc microblaze-tdep.h \
|
||||||
|
psymtab.h psympriv.h
|
||||||
|
|
||||||
# Header files that already have srcdir in them, or which are in objdir.
|
# Header files that already have srcdir in them, or which are in objdir.
|
||||||
|
|
||||||
|
@ -801,7 +802,7 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \
|
||||||
blockframe.o breakpoint.o findvar.o regcache.o \
|
blockframe.o breakpoint.o findvar.o regcache.o \
|
||||||
charset.o disasm.o dummy-frame.o dfp.o \
|
charset.o disasm.o dummy-frame.o dfp.o \
|
||||||
source.o value.o eval.o valops.o valarith.o valprint.o printcmd.o \
|
source.o value.o eval.o valops.o valarith.o valprint.o printcmd.o \
|
||||||
block.o symtab.o symfile.o symmisc.o linespec.o dictionary.o \
|
block.o symtab.o psymtab.o symfile.o symmisc.o linespec.o dictionary.o \
|
||||||
infcall.o \
|
infcall.o \
|
||||||
infcmd.o infrun.o \
|
infcmd.o infrun.o \
|
||||||
expprint.o environ.o stack.o thread.o \
|
expprint.o environ.o stack.o thread.o \
|
||||||
|
|
265
gdb/ada-lang.c
265
gdb/ada-lang.c
|
@ -58,6 +58,8 @@
|
||||||
#include "vec.h"
|
#include "vec.h"
|
||||||
#include "stack.h"
|
#include "stack.h"
|
||||||
|
|
||||||
|
#include "psymtab.h"
|
||||||
|
|
||||||
/* Define whether or not the C operator '/' truncates towards zero for
|
/* Define whether or not the C operator '/' truncates towards zero for
|
||||||
differently signed operands (truncation direction is undefined in C).
|
differently signed operands (truncation direction is undefined in C).
|
||||||
Copied from valarith.c. */
|
Copied from valarith.c. */
|
||||||
|
@ -119,10 +121,6 @@ static int num_defns_collected (struct obstack *);
|
||||||
|
|
||||||
static struct ada_symbol_info *defns_collected (struct obstack *, int);
|
static struct ada_symbol_info *defns_collected (struct obstack *, int);
|
||||||
|
|
||||||
static struct partial_symbol *ada_lookup_partial_symbol (struct partial_symtab
|
|
||||||
*, const char *, int,
|
|
||||||
domain_enum, int);
|
|
||||||
|
|
||||||
static struct value *resolve_subexp (struct expression **, int *, int,
|
static struct value *resolve_subexp (struct expression **, int *, int,
|
||||||
struct type *);
|
struct type *);
|
||||||
|
|
||||||
|
@ -638,13 +636,10 @@ base_type (struct type *type)
|
||||||
/* Language Selection */
|
/* Language Selection */
|
||||||
|
|
||||||
/* If the main program is in Ada, return language_ada, otherwise return LANG
|
/* If the main program is in Ada, return language_ada, otherwise return LANG
|
||||||
(the main program is in Ada iif the adainit symbol is found).
|
(the main program is in Ada iif the adainit symbol is found). */
|
||||||
|
|
||||||
MAIN_PST is not used. */
|
|
||||||
|
|
||||||
enum language
|
enum language
|
||||||
ada_update_initial_language (enum language lang,
|
ada_update_initial_language (enum language lang)
|
||||||
struct partial_symtab *main_pst)
|
|
||||||
{
|
{
|
||||||
if (lookup_minimal_symbol ("adainit", (const char *) NULL,
|
if (lookup_minimal_symbol ("adainit", (const char *) NULL,
|
||||||
(struct objfile *) NULL) != NULL)
|
(struct objfile *) NULL) != NULL)
|
||||||
|
@ -4096,143 +4091,6 @@ defns_collected (struct obstack *obstackp, int finish)
|
||||||
return (struct ada_symbol_info *) obstack_base (obstackp);
|
return (struct ada_symbol_info *) obstack_base (obstackp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Look, in partial_symtab PST, for symbol NAME in given namespace.
|
|
||||||
Check the global symbols if GLOBAL, the static symbols if not.
|
|
||||||
Do wild-card match if WILD. */
|
|
||||||
|
|
||||||
static struct partial_symbol *
|
|
||||||
ada_lookup_partial_symbol (struct partial_symtab *pst, const char *name,
|
|
||||||
int global, domain_enum namespace, int wild)
|
|
||||||
{
|
|
||||||
struct partial_symbol **start;
|
|
||||||
int name_len = strlen (name);
|
|
||||||
int length = (global ? pst->n_global_syms : pst->n_static_syms);
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (length == 0)
|
|
||||||
{
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
start = (global ?
|
|
||||||
pst->objfile->global_psymbols.list + pst->globals_offset :
|
|
||||||
pst->objfile->static_psymbols.list + pst->statics_offset);
|
|
||||||
|
|
||||||
if (wild)
|
|
||||||
{
|
|
||||||
for (i = 0; i < length; i += 1)
|
|
||||||
{
|
|
||||||
struct partial_symbol *psym = start[i];
|
|
||||||
|
|
||||||
if (symbol_matches_domain (SYMBOL_LANGUAGE (psym),
|
|
||||||
SYMBOL_DOMAIN (psym), namespace)
|
|
||||||
&& wild_match (name, name_len, SYMBOL_LINKAGE_NAME (psym)))
|
|
||||||
return psym;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (global)
|
|
||||||
{
|
|
||||||
int U;
|
|
||||||
i = 0;
|
|
||||||
U = length - 1;
|
|
||||||
while (U - i > 4)
|
|
||||||
{
|
|
||||||
int M = (U + i) >> 1;
|
|
||||||
struct partial_symbol *psym = start[M];
|
|
||||||
if (SYMBOL_LINKAGE_NAME (psym)[0] < name[0])
|
|
||||||
i = M + 1;
|
|
||||||
else if (SYMBOL_LINKAGE_NAME (psym)[0] > name[0])
|
|
||||||
U = M - 1;
|
|
||||||
else if (strcmp (SYMBOL_LINKAGE_NAME (psym), name) < 0)
|
|
||||||
i = M + 1;
|
|
||||||
else
|
|
||||||
U = M;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
i = 0;
|
|
||||||
|
|
||||||
while (i < length)
|
|
||||||
{
|
|
||||||
struct partial_symbol *psym = start[i];
|
|
||||||
|
|
||||||
if (symbol_matches_domain (SYMBOL_LANGUAGE (psym),
|
|
||||||
SYMBOL_DOMAIN (psym), namespace))
|
|
||||||
{
|
|
||||||
int cmp = strncmp (name, SYMBOL_LINKAGE_NAME (psym), name_len);
|
|
||||||
|
|
||||||
if (cmp < 0)
|
|
||||||
{
|
|
||||||
if (global)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if (cmp == 0
|
|
||||||
&& is_name_suffix (SYMBOL_LINKAGE_NAME (psym)
|
|
||||||
+ name_len))
|
|
||||||
return psym;
|
|
||||||
}
|
|
||||||
i += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (global)
|
|
||||||
{
|
|
||||||
int U;
|
|
||||||
i = 0;
|
|
||||||
U = length - 1;
|
|
||||||
while (U - i > 4)
|
|
||||||
{
|
|
||||||
int M = (U + i) >> 1;
|
|
||||||
struct partial_symbol *psym = start[M];
|
|
||||||
if (SYMBOL_LINKAGE_NAME (psym)[0] < '_')
|
|
||||||
i = M + 1;
|
|
||||||
else if (SYMBOL_LINKAGE_NAME (psym)[0] > '_')
|
|
||||||
U = M - 1;
|
|
||||||
else if (strcmp (SYMBOL_LINKAGE_NAME (psym), "_ada_") < 0)
|
|
||||||
i = M + 1;
|
|
||||||
else
|
|
||||||
U = M;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
i = 0;
|
|
||||||
|
|
||||||
while (i < length)
|
|
||||||
{
|
|
||||||
struct partial_symbol *psym = start[i];
|
|
||||||
|
|
||||||
if (symbol_matches_domain (SYMBOL_LANGUAGE (psym),
|
|
||||||
SYMBOL_DOMAIN (psym), namespace))
|
|
||||||
{
|
|
||||||
int cmp;
|
|
||||||
|
|
||||||
cmp = (int) '_' - (int) SYMBOL_LINKAGE_NAME (psym)[0];
|
|
||||||
if (cmp == 0)
|
|
||||||
{
|
|
||||||
cmp = strncmp ("_ada_", SYMBOL_LINKAGE_NAME (psym), 5);
|
|
||||||
if (cmp == 0)
|
|
||||||
cmp = strncmp (name, SYMBOL_LINKAGE_NAME (psym) + 5,
|
|
||||||
name_len);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cmp < 0)
|
|
||||||
{
|
|
||||||
if (global)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if (cmp == 0
|
|
||||||
&& is_name_suffix (SYMBOL_LINKAGE_NAME (psym)
|
|
||||||
+ name_len + 5))
|
|
||||||
return psym;
|
|
||||||
}
|
|
||||||
i += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return a minimal symbol matching NAME according to Ada decoding
|
/* Return a minimal symbol matching NAME according to Ada decoding
|
||||||
rules. Returns NULL if there is no such minimal symbol. Names
|
rules. Returns NULL if there is no such minimal symbol. Names
|
||||||
prefixed with "standard__" are handled specially: "standard__" is
|
prefixed with "standard__" are handled specially: "standard__" is
|
||||||
|
@ -4611,6 +4469,30 @@ ada_add_local_symbols (struct obstack *obstackp, const char *name,
|
||||||
add_symbols_from_enclosing_procs (obstackp, name, domain, wild_match);
|
add_symbols_from_enclosing_procs (obstackp, name, domain, wild_match);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* An object of this type is used as the user_data argument when
|
||||||
|
calling the map_ada_symtabs method. */
|
||||||
|
|
||||||
|
struct ada_psym_data
|
||||||
|
{
|
||||||
|
struct obstack *obstackp;
|
||||||
|
const char *name;
|
||||||
|
domain_enum domain;
|
||||||
|
int global;
|
||||||
|
int wild_match;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Callback function for map_ada_symtabs. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
ada_add_psyms (struct objfile *objfile, struct symtab *s, void *user_data)
|
||||||
|
{
|
||||||
|
struct ada_psym_data *data = user_data;
|
||||||
|
const int block_kind = data->global ? GLOBAL_BLOCK : STATIC_BLOCK;
|
||||||
|
ada_add_block_symbols (data->obstackp,
|
||||||
|
BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), block_kind),
|
||||||
|
data->name, data->domain, objfile, data->wild_match);
|
||||||
|
}
|
||||||
|
|
||||||
/* Add to OBSTACKP all non-local symbols whose name and domain match
|
/* Add to OBSTACKP all non-local symbols whose name and domain match
|
||||||
NAME and DOMAIN respectively. The search is performed on GLOBAL_BLOCK
|
NAME and DOMAIN respectively. The search is performed on GLOBAL_BLOCK
|
||||||
symbols if GLOBAL is non-zero, or on STATIC_BLOCK symbols otherwise. */
|
symbols if GLOBAL is non-zero, or on STATIC_BLOCK symbols otherwise. */
|
||||||
|
@ -4618,26 +4500,24 @@ ada_add_local_symbols (struct obstack *obstackp, const char *name,
|
||||||
static void
|
static void
|
||||||
ada_add_non_local_symbols (struct obstack *obstackp, const char *name,
|
ada_add_non_local_symbols (struct obstack *obstackp, const char *name,
|
||||||
domain_enum domain, int global,
|
domain_enum domain, int global,
|
||||||
int wild_match)
|
int is_wild_match)
|
||||||
{
|
{
|
||||||
struct objfile *objfile;
|
struct objfile *objfile;
|
||||||
struct partial_symtab *ps;
|
struct ada_psym_data data;
|
||||||
|
|
||||||
ALL_PSYMTABS (objfile, ps)
|
data.obstackp = obstackp;
|
||||||
{
|
data.name = name;
|
||||||
QUIT;
|
data.domain = domain;
|
||||||
if (ps->readin
|
data.global = global;
|
||||||
|| ada_lookup_partial_symbol (ps, name, global, domain, wild_match))
|
data.wild_match = is_wild_match;
|
||||||
{
|
|
||||||
struct symtab *s = PSYMTAB_TO_SYMTAB (ps);
|
|
||||||
const int block_kind = global ? GLOBAL_BLOCK : STATIC_BLOCK;
|
|
||||||
|
|
||||||
if (s == NULL || !s->primary)
|
ALL_OBJFILES (objfile)
|
||||||
continue;
|
{
|
||||||
ada_add_block_symbols (obstackp,
|
if (objfile->sf)
|
||||||
BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), block_kind),
|
objfile->sf->qf->map_ada_symtabs (objfile, wild_match, is_name_suffix,
|
||||||
name, domain, objfile, wild_match);
|
ada_add_psyms, name,
|
||||||
}
|
global, domain,
|
||||||
|
is_wild_match, &data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5254,6 +5134,29 @@ symbol_completion_add (VEC(char_ptr) **sv,
|
||||||
VEC_safe_push (char_ptr, *sv, completion);
|
VEC_safe_push (char_ptr, *sv, completion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* An object of this type is passed as the user_data argument to the
|
||||||
|
map_partial_symbol_names method. */
|
||||||
|
struct add_partial_datum
|
||||||
|
{
|
||||||
|
VEC(char_ptr) **completions;
|
||||||
|
char *text;
|
||||||
|
int text_len;
|
||||||
|
char *text0;
|
||||||
|
char *word;
|
||||||
|
int wild_match;
|
||||||
|
int encoded;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* A callback for map_partial_symbol_names. */
|
||||||
|
static void
|
||||||
|
ada_add_partial_symbol_completions (const char *name, void *user_data)
|
||||||
|
{
|
||||||
|
struct add_partial_datum *data = user_data;
|
||||||
|
symbol_completion_add (data->completions, name,
|
||||||
|
data->text, data->text_len, data->text0, data->word,
|
||||||
|
data->wild_match, data->encoded);
|
||||||
|
}
|
||||||
|
|
||||||
/* Return a list of possible symbol names completing TEXT0. The list
|
/* Return a list of possible symbol names completing TEXT0. The list
|
||||||
is NULL terminated. WORD is the entire command on which completion
|
is NULL terminated. WORD is the entire command on which completion
|
||||||
is made. */
|
is made. */
|
||||||
|
@ -5268,7 +5171,6 @@ ada_make_symbol_completion_list (char *text0, char *word)
|
||||||
VEC(char_ptr) *completions = VEC_alloc (char_ptr, 128);
|
VEC(char_ptr) *completions = VEC_alloc (char_ptr, 128);
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
struct symtab *s;
|
struct symtab *s;
|
||||||
struct partial_symtab *ps;
|
|
||||||
struct minimal_symbol *msymbol;
|
struct minimal_symbol *msymbol;
|
||||||
struct objfile *objfile;
|
struct objfile *objfile;
|
||||||
struct block *b, *surrounding_static_block = 0;
|
struct block *b, *surrounding_static_block = 0;
|
||||||
|
@ -5300,34 +5202,17 @@ ada_make_symbol_completion_list (char *text0, char *word)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* First, look at the partial symtab symbols. */
|
/* First, look at the partial symtab symbols. */
|
||||||
ALL_PSYMTABS (objfile, ps)
|
|
||||||
{
|
{
|
||||||
struct partial_symbol **psym;
|
struct add_partial_datum data;
|
||||||
|
|
||||||
/* If the psymtab's been read in we'll get it when we search
|
data.completions = &completions;
|
||||||
through the blockvector. */
|
data.text = text;
|
||||||
if (ps->readin)
|
data.text_len = text_len;
|
||||||
continue;
|
data.text0 = text0;
|
||||||
|
data.word = word;
|
||||||
for (psym = objfile->global_psymbols.list + ps->globals_offset;
|
data.wild_match = wild_match;
|
||||||
psym < (objfile->global_psymbols.list + ps->globals_offset
|
data.encoded = encoded;
|
||||||
+ ps->n_global_syms); psym++)
|
map_partial_symbol_names (ada_add_partial_symbol_completions, &data);
|
||||||
{
|
|
||||||
QUIT;
|
|
||||||
symbol_completion_add (&completions, SYMBOL_LINKAGE_NAME (*psym),
|
|
||||||
text, text_len, text0, word,
|
|
||||||
wild_match, encoded);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (psym = objfile->static_psymbols.list + ps->statics_offset;
|
|
||||||
psym < (objfile->static_psymbols.list + ps->statics_offset
|
|
||||||
+ ps->n_static_syms); psym++)
|
|
||||||
{
|
|
||||||
QUIT;
|
|
||||||
symbol_completion_add (&completions, SYMBOL_LINKAGE_NAME (*psym),
|
|
||||||
text, text_len, text0, word,
|
|
||||||
wild_match, encoded);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* At this point scan through the misc symbol vectors and add each
|
/* At this point scan through the misc symbol vectors and add each
|
||||||
|
@ -10120,7 +10005,7 @@ ada_exception_support_info_sniffer (void)
|
||||||
started yet. Inform the user of these two possible causes if
|
started yet. Inform the user of these two possible causes if
|
||||||
applicable. */
|
applicable. */
|
||||||
|
|
||||||
if (ada_update_initial_language (language_unknown, NULL) != language_ada)
|
if (ada_update_initial_language (language_unknown) != language_ada)
|
||||||
error (_("Unable to insert catchpoint. Is this an Ada main program?"));
|
error (_("Unable to insert catchpoint. Is this an Ada main program?"));
|
||||||
|
|
||||||
/* If the symbol does not exist, then check that the program is
|
/* If the symbol does not exist, then check that the program is
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#if !defined (ADA_LANG_H)
|
#if !defined (ADA_LANG_H)
|
||||||
#define ADA_LANG_H 1
|
#define ADA_LANG_H 1
|
||||||
|
|
||||||
struct partial_symbol;
|
|
||||||
struct frame_info;
|
struct frame_info;
|
||||||
|
|
||||||
#include "value.h"
|
#include "value.h"
|
||||||
|
@ -207,8 +206,7 @@ extern char *ada_decode_symbol (const struct general_symbol_info*);
|
||||||
|
|
||||||
extern const char *ada_decode (const char*);
|
extern const char *ada_decode (const char*);
|
||||||
|
|
||||||
extern enum language ada_update_initial_language (enum language,
|
extern enum language ada_update_initial_language (enum language);
|
||||||
struct partial_symtab*);
|
|
||||||
|
|
||||||
extern void clear_ada_sym_cache (void);
|
extern void clear_ada_sym_cache (void);
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "gdbcmd.h"
|
#include "gdbcmd.h"
|
||||||
#include "block.h"
|
#include "block.h"
|
||||||
#include "inline-frame.h"
|
#include "inline-frame.h"
|
||||||
|
#include "psymtab.h"
|
||||||
|
|
||||||
/* Return the innermost lexical block in execution
|
/* Return the innermost lexical block in execution
|
||||||
in a specified stack frame. The frame address is assumed valid.
|
in a specified stack frame. The frame address is assumed valid.
|
||||||
|
@ -188,10 +189,10 @@ find_pc_partial_function (CORE_ADDR pc, char **name, CORE_ADDR *address,
|
||||||
CORE_ADDR *endaddr)
|
CORE_ADDR *endaddr)
|
||||||
{
|
{
|
||||||
struct obj_section *section;
|
struct obj_section *section;
|
||||||
struct partial_symtab *pst;
|
|
||||||
struct symbol *f;
|
struct symbol *f;
|
||||||
struct minimal_symbol *msymbol;
|
struct minimal_symbol *msymbol;
|
||||||
struct partial_symbol *psb;
|
struct symtab *symtab = NULL;
|
||||||
|
struct objfile *objfile;
|
||||||
int i;
|
int i;
|
||||||
CORE_ADDR mapped_pc;
|
CORE_ADDR mapped_pc;
|
||||||
|
|
||||||
|
@ -212,19 +213,16 @@ find_pc_partial_function (CORE_ADDR pc, char **name, CORE_ADDR *address,
|
||||||
goto return_cached_value;
|
goto return_cached_value;
|
||||||
|
|
||||||
msymbol = lookup_minimal_symbol_by_pc_section (mapped_pc, section);
|
msymbol = lookup_minimal_symbol_by_pc_section (mapped_pc, section);
|
||||||
pst = find_pc_sect_psymtab (mapped_pc, section);
|
ALL_OBJFILES (objfile)
|
||||||
if (pst)
|
|
||||||
{
|
{
|
||||||
/* Need to read the symbols to get a good value for the end address. */
|
if (objfile->sf)
|
||||||
if (endaddr != NULL && !pst->readin)
|
symtab = objfile->sf->qf->find_pc_sect_symtab (objfile, msymbol,
|
||||||
{
|
mapped_pc, section, 0);
|
||||||
/* Need to get the terminal in case symbol-reading produces
|
if (symtab)
|
||||||
output. */
|
break;
|
||||||
target_terminal_ours_for_output ();
|
|
||||||
PSYMTAB_TO_SYMTAB (pst);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pst->readin)
|
if (symtab)
|
||||||
{
|
{
|
||||||
/* Checking whether the msymbol has a larger value is for the
|
/* Checking whether the msymbol has a larger value is for the
|
||||||
"pathological" case mentioned in print_frame_info. */
|
"pathological" case mentioned in print_frame_info. */
|
||||||
|
@ -241,28 +239,6 @@ find_pc_partial_function (CORE_ADDR pc, char **name, CORE_ADDR *address,
|
||||||
goto return_cached_value;
|
goto return_cached_value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Now that static symbols go in the minimal symbol table, perhaps
|
|
||||||
we could just ignore the partial symbols. But at least for now
|
|
||||||
we use the partial or minimal symbol, whichever is larger. */
|
|
||||||
psb = find_pc_sect_psymbol (pst, mapped_pc, section);
|
|
||||||
|
|
||||||
if (psb
|
|
||||||
&& (msymbol == NULL
|
|
||||||
|| (SYMBOL_VALUE_ADDRESS (psb)
|
|
||||||
>= SYMBOL_VALUE_ADDRESS (msymbol))))
|
|
||||||
{
|
|
||||||
/* This case isn't being cached currently. */
|
|
||||||
if (address)
|
|
||||||
*address = SYMBOL_VALUE_ADDRESS (psb);
|
|
||||||
if (name)
|
|
||||||
*name = SYMBOL_LINKAGE_NAME (psb);
|
|
||||||
/* endaddr non-NULL can't happen here. */
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Not in the normal symbol tables, see if the pc is in a known section.
|
/* Not in the normal symbol tables, see if the pc is in a known section.
|
||||||
If it's not, then give up. This ensures that anything beyond the end
|
If it's not, then give up. This ensures that anything beyond the end
|
||||||
|
|
|
@ -45,6 +45,8 @@
|
||||||
|
|
||||||
#include "coff-pe-read.h"
|
#include "coff-pe-read.h"
|
||||||
|
|
||||||
|
#include "psymtab.h"
|
||||||
|
|
||||||
extern void _initialize_coffread (void);
|
extern void _initialize_coffread (void);
|
||||||
|
|
||||||
struct coff_symfile_info
|
struct coff_symfile_info
|
||||||
|
@ -2129,6 +2131,7 @@ static struct sym_fns coff_sym_fns =
|
||||||
a file. */
|
a file. */
|
||||||
NULL, /* sym_read_linetable */
|
NULL, /* sym_read_linetable */
|
||||||
default_symfile_relocate, /* sym_relocate: Relocate a debug section. */
|
default_symfile_relocate, /* sym_relocate: Relocate a debug section. */
|
||||||
|
&psym_functions,
|
||||||
NULL /* next: pointer to next struct sym_fns */
|
NULL /* next: pointer to next struct sym_fns */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,8 @@
|
||||||
|
|
||||||
#include "safe-ctype.h"
|
#include "safe-ctype.h"
|
||||||
|
|
||||||
|
#include "psymtab.h"
|
||||||
|
|
||||||
#define d_left(dc) (dc)->u.s_binary.left
|
#define d_left(dc) (dc)->u.s_binary.left
|
||||||
#define d_right(dc) (dc)->u.s_binary.right
|
#define d_right(dc) (dc)->u.s_binary.right
|
||||||
|
|
||||||
|
@ -62,8 +64,6 @@ static void make_symbol_overload_list_using (const char *func_name,
|
||||||
|
|
||||||
static void make_symbol_overload_list_qualified (const char *func_name);
|
static void make_symbol_overload_list_qualified (const char *func_name);
|
||||||
|
|
||||||
static void read_in_psymtabs (const char *oload_name);
|
|
||||||
|
|
||||||
/* The list of "maint cplus" commands. */
|
/* The list of "maint cplus" commands. */
|
||||||
|
|
||||||
struct cmd_list_element *maint_cplus_cmd_list = NULL;
|
struct cmd_list_element *maint_cplus_cmd_list = NULL;
|
||||||
|
@ -772,7 +772,11 @@ make_symbol_overload_list_qualified (const char *func_name)
|
||||||
/* Look through the partial symtabs for all symbols which begin
|
/* Look through the partial symtabs for all symbols which begin
|
||||||
by matching FUNC_NAME. Make sure we read that symbol table in. */
|
by matching FUNC_NAME. Make sure we read that symbol table in. */
|
||||||
|
|
||||||
read_in_psymtabs (func_name);
|
ALL_OBJFILES (objfile)
|
||||||
|
{
|
||||||
|
if (objfile->sf)
|
||||||
|
objfile->sf->qf->expand_symtabs_for_function (objfile, func_name);
|
||||||
|
}
|
||||||
|
|
||||||
/* Search upwards from currently selected frame (so that we can
|
/* Search upwards from currently selected frame (so that we can
|
||||||
complete on local vars. */
|
complete on local vars. */
|
||||||
|
@ -826,28 +830,6 @@ make_symbol_overload_list_qualified (const char *func_name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Look through the partial symtabs for all symbols which begin
|
|
||||||
by matching FUNC_NAME. Make sure we read that symbol table in. */
|
|
||||||
|
|
||||||
static void
|
|
||||||
read_in_psymtabs (const char *func_name)
|
|
||||||
{
|
|
||||||
struct partial_symtab *ps;
|
|
||||||
struct objfile *objfile;
|
|
||||||
|
|
||||||
ALL_PSYMTABS (objfile, ps)
|
|
||||||
{
|
|
||||||
if (ps->readin)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if ((lookup_partial_symbol (ps, func_name, 1, VAR_DOMAIN)
|
|
||||||
!= NULL)
|
|
||||||
|| (lookup_partial_symbol (ps, func_name, 0, VAR_DOMAIN)
|
|
||||||
!= NULL))
|
|
||||||
psymtab_to_symtab (ps);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Lookup the rtti type for a class name. */
|
/* Lookup the rtti type for a class name. */
|
||||||
|
|
||||||
struct type *
|
struct type *
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* Read dbx symbol tables and convert to internal format, for GDB.
|
/* Read dbx symbol tables and convert to internal format, for GDB.
|
||||||
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
|
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
|
||||||
1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2008, 2009.
|
1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2008, 2009, 2010.
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GDB.
|
This file is part of GDB.
|
||||||
|
@ -55,6 +55,7 @@
|
||||||
#include "complaints.h"
|
#include "complaints.h"
|
||||||
#include "cp-abi.h"
|
#include "cp-abi.h"
|
||||||
#include "cp-support.h"
|
#include "cp-support.h"
|
||||||
|
#include "psympriv.h"
|
||||||
|
|
||||||
#include "gdb_assert.h"
|
#include "gdb_assert.h"
|
||||||
#include "gdb_string.h"
|
#include "gdb_string.h"
|
||||||
|
@ -3572,6 +3573,7 @@ static struct sym_fns aout_sym_fns =
|
||||||
a file. */
|
a file. */
|
||||||
NULL, /* sym_read_linetable */
|
NULL, /* sym_read_linetable */
|
||||||
default_symfile_relocate, /* sym_relocate: Relocate a debug section. */
|
default_symfile_relocate, /* sym_relocate: Relocate a debug section. */
|
||||||
|
&psym_functions,
|
||||||
NULL /* next: pointer to next struct sym_fns */
|
NULL /* next: pointer to next struct sym_fns */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
2010-03-10 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
|
* gdbint.texinfo (Symbol Handling): Update.
|
||||||
|
|
||||||
2010-03-08 Tom Tromey <tromey@redhat.com>
|
2010-03-08 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
PR cli/9591:
|
PR cli/9591:
|
||||||
|
|
|
@ -2294,6 +2294,12 @@ and all the psymbols themselves are allocated in a pair of large arrays
|
||||||
on an obstack, so there is little to be gained by trying to free them
|
on an obstack, so there is little to be gained by trying to free them
|
||||||
unless you want to do a lot more work.
|
unless you want to do a lot more work.
|
||||||
|
|
||||||
|
Whether or not psymtabs are created depends on the objfile's symbol
|
||||||
|
reader. The core of @value{GDBN} hides the details of partial symbols
|
||||||
|
and partial symbol tables behind a set of function pointers known as
|
||||||
|
the @dfn{quick symbol functions}. These are documented in
|
||||||
|
@file{symfile.h}.
|
||||||
|
|
||||||
@section Types
|
@section Types
|
||||||
|
|
||||||
@unnumberedsubsec Fundamental Types (e.g., @code{FT_VOID}, @code{FT_BOOLEAN}).
|
@unnumberedsubsec Fundamental Types (e.g., @code{FT_VOID}, @code{FT_BOOLEAN}).
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
#include "addrmap.h"
|
#include "addrmap.h"
|
||||||
#include "typeprint.h"
|
#include "typeprint.h"
|
||||||
#include "jv-lang.h"
|
#include "jv-lang.h"
|
||||||
|
#include "psympriv.h"
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "gdb_string.h"
|
#include "gdb_string.h"
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "gdb-stabs.h"
|
#include "gdb-stabs.h"
|
||||||
#include "complaints.h"
|
#include "complaints.h"
|
||||||
#include "demangle.h"
|
#include "demangle.h"
|
||||||
|
#include "psympriv.h"
|
||||||
|
|
||||||
extern void _initialize_elfread (void);
|
extern void _initialize_elfread (void);
|
||||||
|
|
||||||
|
@ -1058,6 +1059,7 @@ static struct sym_fns elf_sym_fns =
|
||||||
a file. */
|
a file. */
|
||||||
NULL, /* sym_read_linetable */
|
NULL, /* sym_read_linetable */
|
||||||
default_symfile_relocate, /* sym_relocate: Relocate a debug section. */
|
default_symfile_relocate, /* sym_relocate: Relocate a debug section. */
|
||||||
|
&psym_functions,
|
||||||
NULL /* next: pointer to next struct sym_fns */
|
NULL /* next: pointer to next struct sym_fns */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1022,7 +1022,7 @@ yylex ()
|
||||||
char *tmp = copy_name (yylval.sval);
|
char *tmp = copy_name (yylval.sval);
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
|
|
||||||
if (lookup_partial_symtab (tmp))
|
if (lookup_symtab (tmp))
|
||||||
return BLOCKNAME;
|
return BLOCKNAME;
|
||||||
sym = lookup_symbol (tmp, expression_context_block, VAR_DOMAIN, 0);
|
sym = lookup_symbol (tmp, expression_context_block, VAR_DOMAIN, 0);
|
||||||
if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
|
if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "gdb_assert.h"
|
#include "gdb_assert.h"
|
||||||
#include "aout/stab_gnu.h"
|
#include "aout/stab_gnu.h"
|
||||||
#include "vec.h"
|
#include "vec.h"
|
||||||
|
#include "psympriv.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -848,7 +849,7 @@ static struct sym_fns macho_sym_fns = {
|
||||||
a file. */
|
a file. */
|
||||||
NULL, /* sym_read_linetable */
|
NULL, /* sym_read_linetable */
|
||||||
macho_symfile_relocate, /* sym_relocate: Relocate a debug section. */
|
macho_symfile_relocate, /* sym_relocate: Relocate a debug section. */
|
||||||
|
&psym_functions,
|
||||||
NULL /* next: pointer to next struct sym_fns */
|
NULL /* next: pointer to next struct sym_fns */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@
|
||||||
#include "mdebugread.h"
|
#include "mdebugread.h"
|
||||||
#include "gdb_stat.h"
|
#include "gdb_stat.h"
|
||||||
#include "gdb_string.h"
|
#include "gdb_string.h"
|
||||||
|
#include "psympriv.h"
|
||||||
|
|
||||||
#include "bfd.h"
|
#include "bfd.h"
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "symtab.h"
|
#include "symtab.h"
|
||||||
#include "source.h"
|
#include "source.h"
|
||||||
#include "objfiles.h"
|
#include "objfiles.h"
|
||||||
|
#include "psymtab.h"
|
||||||
|
|
||||||
/* Return to the client the absolute path and line number of the
|
/* Return to the client the absolute path and line number of the
|
||||||
current file being executed. */
|
current file being executed. */
|
||||||
|
@ -63,6 +64,21 @@ mi_cmd_file_list_exec_source_file (char *command, char **argv, int argc)
|
||||||
ui_out_field_int (uiout, "macro-info", st.symtab->macro_table ? 1 : 0);
|
ui_out_field_int (uiout, "macro-info", st.symtab->macro_table ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* A callback for map_partial_symbol_filenames. */
|
||||||
|
static void
|
||||||
|
print_partial_file_name (const char *filename, const char *fullname,
|
||||||
|
void *ignore)
|
||||||
|
{
|
||||||
|
ui_out_begin (uiout, ui_out_type_tuple, NULL);
|
||||||
|
|
||||||
|
ui_out_field_string (uiout, "file", filename);
|
||||||
|
|
||||||
|
if (fullname)
|
||||||
|
ui_out_field_string (uiout, "fullname", fullname);
|
||||||
|
|
||||||
|
ui_out_end (uiout, ui_out_type_tuple);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_cmd_file_list_exec_source_files (char *command, char **argv, int argc)
|
mi_cmd_file_list_exec_source_files (char *command, char **argv, int argc)
|
||||||
{
|
{
|
||||||
|
@ -92,24 +108,7 @@ mi_cmd_file_list_exec_source_files (char *command, char **argv, int argc)
|
||||||
ui_out_end (uiout, ui_out_type_tuple);
|
ui_out_end (uiout, ui_out_type_tuple);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Look at all of the psymtabs */
|
map_partial_symbol_filenames (print_partial_file_name, NULL);
|
||||||
ALL_PSYMTABS (objfile, ps)
|
|
||||||
{
|
|
||||||
if (!ps->readin)
|
|
||||||
{
|
|
||||||
ui_out_begin (uiout, ui_out_type_tuple, NULL);
|
|
||||||
|
|
||||||
ui_out_field_string (uiout, "file", ps->filename);
|
|
||||||
|
|
||||||
/* Extract the fullname if it is not known yet */
|
|
||||||
psymtab_to_fullname (ps);
|
|
||||||
|
|
||||||
if (ps->fullname)
|
|
||||||
ui_out_field_string (uiout, "fullname", ps->fullname);
|
|
||||||
|
|
||||||
ui_out_end (uiout, ui_out_type_tuple);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ui_out_end (uiout, ui_out_type_list);
|
ui_out_end (uiout, ui_out_type_list);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,8 @@
|
||||||
#include "elf/internal.h"
|
#include "elf/internal.h"
|
||||||
#include "elf/mips.h"
|
#include "elf/mips.h"
|
||||||
|
|
||||||
|
#include "psymtab.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
read_alphacoff_dynamic_symtab (struct section_offsets *,
|
read_alphacoff_dynamic_symtab (struct section_offsets *,
|
||||||
struct objfile *objfile);
|
struct objfile *objfile);
|
||||||
|
@ -400,6 +402,7 @@ static struct sym_fns ecoff_sym_fns =
|
||||||
a file. */
|
a file. */
|
||||||
NULL, /* sym_read_linetable */
|
NULL, /* sym_read_linetable */
|
||||||
default_symfile_relocate, /* sym_relocate: Relocate a debug section. */
|
default_symfile_relocate, /* sym_relocate: Relocate a debug section. */
|
||||||
|
&psym_functions,
|
||||||
NULL /* next: pointer to next struct sym_fns */
|
NULL /* next: pointer to next struct sym_fns */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
#include "exec.h"
|
#include "exec.h"
|
||||||
#include "observer.h"
|
#include "observer.h"
|
||||||
#include "complaints.h"
|
#include "complaints.h"
|
||||||
|
#include "psymtab.h"
|
||||||
|
|
||||||
/* Prototypes for local functions */
|
/* Prototypes for local functions */
|
||||||
|
|
||||||
|
@ -782,38 +783,8 @@ objfile_relocate1 (struct objfile *objfile, struct section_offsets *new_offsets)
|
||||||
addrmap_relocate (objfile->psymtabs_addrmap,
|
addrmap_relocate (objfile->psymtabs_addrmap,
|
||||||
ANOFFSET (delta, SECT_OFF_TEXT (objfile)));
|
ANOFFSET (delta, SECT_OFF_TEXT (objfile)));
|
||||||
|
|
||||||
{
|
if (objfile->sf)
|
||||||
struct partial_symtab *p;
|
objfile->sf->qf->relocate (objfile, new_offsets, delta);
|
||||||
|
|
||||||
ALL_OBJFILE_PSYMTABS (objfile, p)
|
|
||||||
{
|
|
||||||
p->textlow += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
|
|
||||||
p->texthigh += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
struct partial_symbol **psym;
|
|
||||||
|
|
||||||
for (psym = objfile->global_psymbols.list;
|
|
||||||
psym < objfile->global_psymbols.next;
|
|
||||||
psym++)
|
|
||||||
{
|
|
||||||
fixup_psymbol_section (*psym, objfile);
|
|
||||||
if (SYMBOL_SECTION (*psym) >= 0)
|
|
||||||
SYMBOL_VALUE_ADDRESS (*psym) += ANOFFSET (delta,
|
|
||||||
SYMBOL_SECTION (*psym));
|
|
||||||
}
|
|
||||||
for (psym = objfile->static_psymbols.list;
|
|
||||||
psym < objfile->static_psymbols.next;
|
|
||||||
psym++)
|
|
||||||
{
|
|
||||||
fixup_psymbol_section (*psym, objfile);
|
|
||||||
if (SYMBOL_SECTION (*psym) >= 0)
|
|
||||||
SYMBOL_VALUE_ADDRESS (*psym) += ANOFFSET (delta,
|
|
||||||
SYMBOL_SECTION (*psym));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
struct minimal_symbol *msym;
|
struct minimal_symbol *msym;
|
||||||
|
@ -917,7 +888,7 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
|
||||||
int
|
int
|
||||||
objfile_has_partial_symbols (struct objfile *objfile)
|
objfile_has_partial_symbols (struct objfile *objfile)
|
||||||
{
|
{
|
||||||
return objfile->psymtabs != NULL;
|
return objfile->sf ? objfile->sf->qf->has_symbols (objfile) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return non-zero if OBJFILE has full symbols. */
|
/* Return non-zero if OBJFILE has full symbols. */
|
||||||
|
|
|
@ -564,11 +564,6 @@ extern void gdb_bfd_unref (struct bfd *abfd);
|
||||||
#define ALL_OBJFILE_SYMTABS(objfile, s) \
|
#define ALL_OBJFILE_SYMTABS(objfile, s) \
|
||||||
for ((s) = (objfile) -> symtabs; (s) != NULL; (s) = (s) -> next)
|
for ((s) = (objfile) -> symtabs; (s) != NULL; (s) = (s) -> next)
|
||||||
|
|
||||||
/* Traverse all psymtabs in one objfile. */
|
|
||||||
|
|
||||||
#define ALL_OBJFILE_PSYMTABS(objfile, p) \
|
|
||||||
for ((p) = (objfile) -> psymtabs; (p) != NULL; (p) = (p) -> next)
|
|
||||||
|
|
||||||
/* Traverse all minimal symbols in one objfile. */
|
/* Traverse all minimal symbols in one objfile. */
|
||||||
|
|
||||||
#define ALL_OBJFILE_MSYMBOLS(objfile, m) \
|
#define ALL_OBJFILE_MSYMBOLS(objfile, m) \
|
||||||
|
@ -599,17 +594,6 @@ extern void gdb_bfd_unref (struct bfd *abfd);
|
||||||
ALL_OBJFILE_SYMTABS (objfile, s) \
|
ALL_OBJFILE_SYMTABS (objfile, s) \
|
||||||
if ((s)->primary)
|
if ((s)->primary)
|
||||||
|
|
||||||
/* Traverse all psymtabs in all objfiles in the current symbol
|
|
||||||
space. */
|
|
||||||
|
|
||||||
#define ALL_PSYMTABS(objfile, p) \
|
|
||||||
ALL_OBJFILES (objfile) \
|
|
||||||
ALL_OBJFILE_PSYMTABS (objfile, p)
|
|
||||||
|
|
||||||
#define ALL_PSPACE_PSYMTABS(ss, objfile, p) \
|
|
||||||
ALL_PSPACE_OBJFILES (ss, objfile) \
|
|
||||||
ALL_OBJFILE_PSYMTABS (objfile, p)
|
|
||||||
|
|
||||||
/* Traverse all minimal symbols in all objfiles in the current symbol
|
/* Traverse all minimal symbols in all objfiles in the current symbol
|
||||||
space. */
|
space. */
|
||||||
|
|
||||||
|
|
166
gdb/psympriv.h
Normal file
166
gdb/psympriv.h
Normal file
|
@ -0,0 +1,166 @@
|
||||||
|
/* Private partial symbol table definitions.
|
||||||
|
|
||||||
|
Copyright (C) 2009 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is part of GDB.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
#ifndef PSYMPRIV_H
|
||||||
|
#define PSYMPRIV_H
|
||||||
|
|
||||||
|
#include "psymtab.h"
|
||||||
|
|
||||||
|
/* A partial_symbol records the name, domain, and address class of
|
||||||
|
symbols whose types we have not parsed yet. For functions, it also
|
||||||
|
contains their memory address, so we can find them from a PC value.
|
||||||
|
Each partial_symbol sits in a partial_symtab, all of which are chained
|
||||||
|
on a partial symtab list and which points to the corresponding
|
||||||
|
normal symtab once the partial_symtab has been referenced. */
|
||||||
|
|
||||||
|
/* This structure is space critical. See space comments at the top of
|
||||||
|
symtab.h. */
|
||||||
|
|
||||||
|
struct partial_symbol
|
||||||
|
{
|
||||||
|
|
||||||
|
/* The general symbol info required for all types of symbols. */
|
||||||
|
|
||||||
|
struct general_symbol_info ginfo;
|
||||||
|
|
||||||
|
/* Name space code. */
|
||||||
|
|
||||||
|
ENUM_BITFIELD(domain_enum_tag) domain : 6;
|
||||||
|
|
||||||
|
/* Address class (for info_symbols) */
|
||||||
|
|
||||||
|
ENUM_BITFIELD(address_class) aclass : 6;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#define PSYMBOL_DOMAIN(psymbol) (psymbol)->domain
|
||||||
|
#define PSYMBOL_CLASS(psymbol) (psymbol)->aclass
|
||||||
|
|
||||||
|
/* Each source file that has not been fully read in is represented by
|
||||||
|
a partial_symtab. This contains the information on where in the
|
||||||
|
executable the debugging symbols for a specific file are, and a
|
||||||
|
list of names of global symbols which are located in this file.
|
||||||
|
They are all chained on partial symtab lists.
|
||||||
|
|
||||||
|
Even after the source file has been read into a symtab, the
|
||||||
|
partial_symtab remains around. They are allocated on an obstack,
|
||||||
|
objfile_obstack. */
|
||||||
|
|
||||||
|
struct partial_symtab
|
||||||
|
{
|
||||||
|
|
||||||
|
/* Chain of all existing partial symtabs. */
|
||||||
|
|
||||||
|
struct partial_symtab *next;
|
||||||
|
|
||||||
|
/* Name of the source file which this partial_symtab defines */
|
||||||
|
|
||||||
|
char *filename;
|
||||||
|
|
||||||
|
/* Full path of the source file. NULL if not known. */
|
||||||
|
|
||||||
|
char *fullname;
|
||||||
|
|
||||||
|
/* Directory in which it was compiled, or NULL if we don't know. */
|
||||||
|
|
||||||
|
char *dirname;
|
||||||
|
|
||||||
|
/* Information about the object file from which symbols should be read. */
|
||||||
|
|
||||||
|
struct objfile *objfile;
|
||||||
|
|
||||||
|
/* Set of relocation offsets to apply to each section. */
|
||||||
|
|
||||||
|
struct section_offsets *section_offsets;
|
||||||
|
|
||||||
|
/* Range of text addresses covered by this file; texthigh is the
|
||||||
|
beginning of the next section. */
|
||||||
|
|
||||||
|
CORE_ADDR textlow;
|
||||||
|
CORE_ADDR texthigh;
|
||||||
|
|
||||||
|
/* Array of pointers to all of the partial_symtab's which this one
|
||||||
|
depends on. Since this array can only be set to previous or
|
||||||
|
the current (?) psymtab, this dependency tree is guaranteed not
|
||||||
|
to have any loops. "depends on" means that symbols must be read
|
||||||
|
for the dependencies before being read for this psymtab; this is
|
||||||
|
for type references in stabs, where if foo.c includes foo.h, declarations
|
||||||
|
in foo.h may use type numbers defined in foo.c. For other debugging
|
||||||
|
formats there may be no need to use dependencies. */
|
||||||
|
|
||||||
|
struct partial_symtab **dependencies;
|
||||||
|
|
||||||
|
int number_of_dependencies;
|
||||||
|
|
||||||
|
/* Global symbol list. This list will be sorted after readin to
|
||||||
|
improve access. Binary search will be the usual method of
|
||||||
|
finding a symbol within it. globals_offset is an integer offset
|
||||||
|
within global_psymbols[]. */
|
||||||
|
|
||||||
|
int globals_offset;
|
||||||
|
int n_global_syms;
|
||||||
|
|
||||||
|
/* Static symbol list. This list will *not* be sorted after readin;
|
||||||
|
to find a symbol in it, exhaustive search must be used. This is
|
||||||
|
reasonable because searches through this list will eventually
|
||||||
|
lead to either the read in of a files symbols for real (assumed
|
||||||
|
to take a *lot* of time; check) or an error (and we don't care
|
||||||
|
how long errors take). This is an offset and size within
|
||||||
|
static_psymbols[]. */
|
||||||
|
|
||||||
|
int statics_offset;
|
||||||
|
int n_static_syms;
|
||||||
|
|
||||||
|
/* Pointer to symtab eventually allocated for this source file, 0 if
|
||||||
|
!readin or if we haven't looked for the symtab after it was readin. */
|
||||||
|
|
||||||
|
struct symtab *symtab;
|
||||||
|
|
||||||
|
/* Pointer to function which will read in the symtab corresponding to
|
||||||
|
this psymtab. */
|
||||||
|
|
||||||
|
void (*read_symtab) (struct partial_symtab *);
|
||||||
|
|
||||||
|
/* Information that lets read_symtab() locate the part of the symbol table
|
||||||
|
that this psymtab corresponds to. This information is private to the
|
||||||
|
format-dependent symbol reading routines. For further detail examine
|
||||||
|
the various symbol reading modules. Should really be (void *) but is
|
||||||
|
(char *) as with other such gdb variables. (FIXME) */
|
||||||
|
|
||||||
|
char *read_symtab_private;
|
||||||
|
|
||||||
|
/* Non-zero if the symtab corresponding to this psymtab has been readin */
|
||||||
|
|
||||||
|
unsigned char readin;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern void sort_pst_symbols (struct partial_symtab *);
|
||||||
|
|
||||||
|
/* Traverse all psymtabs in one objfile. */
|
||||||
|
|
||||||
|
#define ALL_OBJFILE_PSYMTABS(objfile, p) \
|
||||||
|
for ((p) = (objfile) -> psymtabs; (p) != NULL; (p) = (p) -> next)
|
||||||
|
|
||||||
|
/* Traverse all psymtabs in all objfiles. */
|
||||||
|
|
||||||
|
#define ALL_PSYMTABS(objfile, p) \
|
||||||
|
ALL_OBJFILES (objfile) \
|
||||||
|
ALL_OBJFILE_PSYMTABS (objfile, p)
|
||||||
|
|
||||||
|
#endif /* PSYMPRIV_H */
|
1751
gdb/psymtab.c
Normal file
1751
gdb/psymtab.c
Normal file
File diff suppressed because it is too large
Load diff
31
gdb/psymtab.h
Normal file
31
gdb/psymtab.h
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
/* Public partial symbol table definitions.
|
||||||
|
|
||||||
|
Copyright (C) 2009 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is part of GDB.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
#ifndef PSYMTAB_H
|
||||||
|
#define PSYMTAB_H
|
||||||
|
|
||||||
|
void map_partial_symbol_names (void (*) (const char *, void *), void *);
|
||||||
|
|
||||||
|
void map_partial_symbol_filenames (void (*) (const char *, const char *,
|
||||||
|
void *),
|
||||||
|
void *);
|
||||||
|
|
||||||
|
extern const struct quick_symbol_functions psym_functions;
|
||||||
|
|
||||||
|
#endif /* PSYMTAB_H */
|
|
@ -32,6 +32,7 @@
|
||||||
#include "demangle.h"
|
#include "demangle.h"
|
||||||
#include "som.h"
|
#include "som.h"
|
||||||
#include "libhppa.h"
|
#include "libhppa.h"
|
||||||
|
#include "psymtab.h"
|
||||||
|
|
||||||
#include "solib-som.h"
|
#include "solib-som.h"
|
||||||
|
|
||||||
|
@ -438,6 +439,7 @@ static struct sym_fns som_sym_fns =
|
||||||
a file. */
|
a file. */
|
||||||
NULL, /* sym_read_linetable */
|
NULL, /* sym_read_linetable */
|
||||||
default_symfile_relocate, /* sym_relocate: Relocate a debug section. */
|
default_symfile_relocate, /* sym_relocate: Relocate a debug section. */
|
||||||
|
&psym_functions,
|
||||||
NULL /* next: pointer to next struct sym_fns */
|
NULL /* next: pointer to next struct sym_fns */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
73
gdb/source.c
73
gdb/source.c
|
@ -46,6 +46,8 @@
|
||||||
#include "ui-out.h"
|
#include "ui-out.h"
|
||||||
#include "readline/readline.h"
|
#include "readline/readline.h"
|
||||||
|
|
||||||
|
#include "psymtab.h"
|
||||||
|
|
||||||
|
|
||||||
#define OPEN_MODE (O_RDONLY | O_BINARY)
|
#define OPEN_MODE (O_RDONLY | O_BINARY)
|
||||||
#define FDOPEN_MODE FOPEN_RB
|
#define FDOPEN_MODE FOPEN_RB
|
||||||
|
@ -229,8 +231,6 @@ select_source_symtab (struct symtab *s)
|
||||||
{
|
{
|
||||||
struct symtabs_and_lines sals;
|
struct symtabs_and_lines sals;
|
||||||
struct symtab_and_line sal;
|
struct symtab_and_line sal;
|
||||||
struct partial_symtab *ps;
|
|
||||||
struct partial_symtab *cs_pst = 0;
|
|
||||||
struct objfile *ofp;
|
struct objfile *ofp;
|
||||||
|
|
||||||
if (s)
|
if (s)
|
||||||
|
@ -281,32 +281,12 @@ select_source_symtab (struct symtab *s)
|
||||||
if (current_source_symtab)
|
if (current_source_symtab)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* How about the partial symbol tables? */
|
|
||||||
|
|
||||||
ALL_OBJFILES (ofp)
|
ALL_OBJFILES (ofp)
|
||||||
{
|
{
|
||||||
for (ps = ofp->psymtabs; ps != NULL; ps = ps->next)
|
if (ofp->sf)
|
||||||
{
|
s = ofp->sf->qf->find_last_source_symtab (ofp);
|
||||||
const char *name = ps->filename;
|
if (s)
|
||||||
int len = strlen (name);
|
current_source_symtab = s;
|
||||||
if (!(len > 2 && (strcmp (&name[len - 2], ".h") == 0
|
|
||||||
|| strcmp (name, "<<C++-namespaces>>") == 0)))
|
|
||||||
cs_pst = ps;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (cs_pst)
|
|
||||||
{
|
|
||||||
if (cs_pst->readin)
|
|
||||||
{
|
|
||||||
internal_error (__FILE__, __LINE__,
|
|
||||||
_("select_source_symtab: "
|
|
||||||
"readin pst found and no symtabs."));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
current_source_pspace = current_program_space;
|
|
||||||
current_source_symtab = PSYMTAB_TO_SYMTAB (cs_pst);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (current_source_symtab)
|
if (current_source_symtab)
|
||||||
return;
|
return;
|
||||||
|
@ -332,7 +312,6 @@ forget_cached_source_info (void)
|
||||||
struct program_space *pspace;
|
struct program_space *pspace;
|
||||||
struct symtab *s;
|
struct symtab *s;
|
||||||
struct objfile *objfile;
|
struct objfile *objfile;
|
||||||
struct partial_symtab *pst;
|
|
||||||
|
|
||||||
ALL_PSPACES (pspace)
|
ALL_PSPACES (pspace)
|
||||||
ALL_PSPACE_OBJFILES (pspace, objfile)
|
ALL_PSPACE_OBJFILES (pspace, objfile)
|
||||||
|
@ -351,14 +330,8 @@ forget_cached_source_info (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ALL_OBJFILE_PSYMTABS (objfile, pst)
|
if (objfile->sf)
|
||||||
{
|
objfile->sf->qf->forget_cached_source_info (objfile);
|
||||||
if (pst->fullname != NULL)
|
|
||||||
{
|
|
||||||
xfree (pst->fullname);
|
|
||||||
pst->fullname = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
last_source_visited = NULL;
|
last_source_visited = NULL;
|
||||||
|
@ -964,7 +937,7 @@ rewrite_source_path (const char *path)
|
||||||
An invalid file descriptor is returned. ( the return value is negative )
|
An invalid file descriptor is returned. ( the return value is negative )
|
||||||
FULLNAME is set to NULL. */
|
FULLNAME is set to NULL. */
|
||||||
|
|
||||||
static int
|
int
|
||||||
find_and_open_source (const char *filename,
|
find_and_open_source (const char *filename,
|
||||||
const char *dirname,
|
const char *dirname,
|
||||||
char **fullname)
|
char **fullname)
|
||||||
|
@ -1094,34 +1067,6 @@ symtab_to_fullname (struct symtab *s)
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Finds the fullname that a partial_symtab represents.
|
|
||||||
|
|
||||||
If this functions finds the fullname, it will save it in ps->fullname
|
|
||||||
and it will also return the value.
|
|
||||||
|
|
||||||
If this function fails to find the file that this partial_symtab represents,
|
|
||||||
NULL will be returned and ps->fullname will be set to NULL. */
|
|
||||||
char *
|
|
||||||
psymtab_to_fullname (struct partial_symtab *ps)
|
|
||||||
{
|
|
||||||
int r;
|
|
||||||
|
|
||||||
if (!ps)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
/* Don't check ps->fullname here, the file could have been
|
|
||||||
deleted/moved/..., look for it again */
|
|
||||||
r = find_and_open_source (ps->filename, ps->dirname, &ps->fullname);
|
|
||||||
|
|
||||||
if (r >= 0)
|
|
||||||
{
|
|
||||||
close (r);
|
|
||||||
return ps->fullname;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create and initialize the table S->line_charpos that records
|
/* Create and initialize the table S->line_charpos that records
|
||||||
the positions of the lines in the source file, which is assumed
|
the positions of the lines in the source file, which is assumed
|
||||||
|
|
|
@ -25,7 +25,6 @@ struct symtab;
|
||||||
negative number for error. */
|
negative number for error. */
|
||||||
extern int open_source_file (struct symtab *s);
|
extern int open_source_file (struct symtab *s);
|
||||||
|
|
||||||
extern char* psymtab_to_fullname (struct partial_symtab *ps);
|
|
||||||
extern char* symtab_to_fullname (struct symtab *s);
|
extern char* symtab_to_fullname (struct symtab *s);
|
||||||
|
|
||||||
/* Create and initialize the table S->line_charpos that records the
|
/* Create and initialize the table S->line_charpos that records the
|
||||||
|
|
|
@ -52,6 +52,9 @@
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "gdb_string.h"
|
#include "gdb_string.h"
|
||||||
|
|
||||||
|
#include "psymtab.h"
|
||||||
|
#include "symfile.h"
|
||||||
|
|
||||||
void (*deprecated_selected_frame_level_changed_hook) (int);
|
void (*deprecated_selected_frame_level_changed_hook) (int);
|
||||||
|
|
||||||
/* The possible choices of "set print frame-arguments, and the value
|
/* The possible choices of "set print frame-arguments, and the value
|
||||||
|
@ -1321,10 +1324,10 @@ backtrace_command_1 (char *count_exp, int show_locals, int from_tty)
|
||||||
i = count;
|
i = count;
|
||||||
for (fi = trailing; fi != NULL && i--; fi = get_prev_frame (fi))
|
for (fi = trailing; fi != NULL && i--; fi = get_prev_frame (fi))
|
||||||
{
|
{
|
||||||
|
CORE_ADDR pc;
|
||||||
QUIT;
|
QUIT;
|
||||||
ps = find_pc_psymtab (get_frame_address_in_block (fi));
|
pc = get_frame_address_in_block (fi);
|
||||||
if (ps)
|
find_pc_sect_symtab_via_partial (pc, find_pc_mapped_section (pc));
|
||||||
PSYMTAB_TO_SYMTAB (ps); /* Force syms to come in. */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
303
gdb/symfile.c
303
gdb/symfile.c
|
@ -65,6 +65,7 @@
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
#include "psymtab.h"
|
||||||
|
|
||||||
int (*deprecated_ui_load_progress_hook) (const char *section, unsigned long num);
|
int (*deprecated_ui_load_progress_hook) (const char *section, unsigned long num);
|
||||||
void (*deprecated_show_load_progress) (const char *section,
|
void (*deprecated_show_load_progress) (const char *section,
|
||||||
|
@ -188,29 +189,6 @@ int auto_solib_add = 1;
|
||||||
int auto_solib_limit;
|
int auto_solib_limit;
|
||||||
|
|
||||||
|
|
||||||
/* This compares two partial symbols by names, using strcmp_iw_ordered
|
|
||||||
for the comparison. */
|
|
||||||
|
|
||||||
static int
|
|
||||||
compare_psymbols (const void *s1p, const void *s2p)
|
|
||||||
{
|
|
||||||
struct partial_symbol *const *s1 = s1p;
|
|
||||||
struct partial_symbol *const *s2 = s2p;
|
|
||||||
|
|
||||||
return strcmp_iw_ordered (SYMBOL_SEARCH_NAME (*s1),
|
|
||||||
SYMBOL_SEARCH_NAME (*s2));
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
sort_pst_symbols (struct partial_symtab *pst)
|
|
||||||
{
|
|
||||||
/* Sort the global list; don't sort the static list */
|
|
||||||
|
|
||||||
qsort (pst->objfile->global_psymbols.list + pst->globals_offset,
|
|
||||||
pst->n_global_syms, sizeof (struct partial_symbol *),
|
|
||||||
compare_psymbols);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Make a null terminated copy of the string at PTR with SIZE characters in
|
/* Make a null terminated copy of the string at PTR with SIZE characters in
|
||||||
the obstack pointed to by OBSTACKP . Returns the address of the copy.
|
the obstack pointed to by OBSTACKP . Returns the address of the copy.
|
||||||
Note that the string at PTR does not have to be null terminated, I.E. it
|
Note that the string at PTR does not have to be null terminated, I.E. it
|
||||||
|
@ -249,7 +227,7 @@ obconcat (struct obstack *obstackp, const char *s1, const char *s2,
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* True if we are nested inside psymtab_to_symtab. */
|
/* True if we are reading a symbol table. */
|
||||||
|
|
||||||
int currently_reading_symtab = 0;
|
int currently_reading_symtab = 0;
|
||||||
|
|
||||||
|
@ -259,28 +237,13 @@ decrement_reading_symtab (void *dummy)
|
||||||
currently_reading_symtab--;
|
currently_reading_symtab--;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the symbol table that corresponds to a partial_symtab.
|
/* Increment currently_reading_symtab and return a cleanup that can be
|
||||||
This is fast after the first time you do it. In fact, there
|
used to decrement it. */
|
||||||
is an even faster macro PSYMTAB_TO_SYMTAB that does the fast
|
struct cleanup *
|
||||||
case inline. */
|
increment_reading_symtab (void)
|
||||||
|
|
||||||
struct symtab *
|
|
||||||
psymtab_to_symtab (struct partial_symtab *pst)
|
|
||||||
{
|
{
|
||||||
/* If it's been looked up before, return it. */
|
++currently_reading_symtab;
|
||||||
if (pst->symtab)
|
return make_cleanup (decrement_reading_symtab, NULL);
|
||||||
return pst->symtab;
|
|
||||||
|
|
||||||
/* If it has not yet been read in, read it. */
|
|
||||||
if (!pst->readin)
|
|
||||||
{
|
|
||||||
struct cleanup *back_to = make_cleanup (decrement_reading_symtab, NULL);
|
|
||||||
currently_reading_symtab++;
|
|
||||||
(*pst->read_symtab) (pst);
|
|
||||||
do_cleanups (back_to);
|
|
||||||
}
|
|
||||||
|
|
||||||
return pst->symtab;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remember the lowest-addressed loadable section we've seen.
|
/* Remember the lowest-addressed loadable section we've seen.
|
||||||
|
@ -968,7 +931,6 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd,
|
||||||
int flags)
|
int flags)
|
||||||
{
|
{
|
||||||
struct objfile *objfile;
|
struct objfile *objfile;
|
||||||
struct partial_symtab *psymtab;
|
|
||||||
struct cleanup *my_cleanups;
|
struct cleanup *my_cleanups;
|
||||||
const char *name = bfd_get_filename (abfd);
|
const char *name = bfd_get_filename (abfd);
|
||||||
const int from_tty = add_flags & SYMFILE_VERBOSE;
|
const int from_tty = add_flags & SYMFILE_VERBOSE;
|
||||||
|
@ -1018,12 +980,8 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd,
|
||||||
gdb_flush (gdb_stdout);
|
gdb_flush (gdb_stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (psymtab = objfile->psymtabs;
|
if (objfile->sf)
|
||||||
psymtab != NULL;
|
objfile->sf->qf->expand_all_symtabs (objfile);
|
||||||
psymtab = psymtab->next)
|
|
||||||
{
|
|
||||||
psymtab_to_symtab (psymtab);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((from_tty || info_verbose)
|
if ((from_tty || info_verbose)
|
||||||
|
@ -1457,14 +1415,12 @@ symbol_file_command (char *args, int from_tty)
|
||||||
void
|
void
|
||||||
set_initial_language (void)
|
set_initial_language (void)
|
||||||
{
|
{
|
||||||
struct partial_symtab *pst;
|
char *filename;
|
||||||
enum language lang = language_unknown;
|
enum language lang = language_unknown;
|
||||||
|
|
||||||
pst = find_main_psymtab ();
|
filename = find_main_filename ();
|
||||||
if (pst != NULL)
|
if (filename != NULL)
|
||||||
{
|
lang = deduce_language_from_filename (filename);
|
||||||
if (pst->filename != NULL)
|
|
||||||
lang = deduce_language_from_filename (pst->filename);
|
|
||||||
|
|
||||||
if (lang == language_unknown)
|
if (lang == language_unknown)
|
||||||
{
|
{
|
||||||
|
@ -1475,7 +1431,6 @@ set_initial_language (void)
|
||||||
set_language (lang);
|
set_language (lang);
|
||||||
expected_language = current_language; /* Don't warn the user. */
|
expected_language = current_language; /* Don't warn the user. */
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* If NAME is a remote name open the file using remote protocol, otherwise
|
/* If NAME is a remote name open the file using remote protocol, otherwise
|
||||||
open it normally. */
|
open it normally. */
|
||||||
|
@ -2611,73 +2566,6 @@ allocate_symtab (char *filename, struct objfile *objfile)
|
||||||
|
|
||||||
return (symtab);
|
return (symtab);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct partial_symtab *
|
|
||||||
allocate_psymtab (const char *filename, struct objfile *objfile)
|
|
||||||
{
|
|
||||||
struct partial_symtab *psymtab;
|
|
||||||
|
|
||||||
if (objfile->free_psymtabs)
|
|
||||||
{
|
|
||||||
psymtab = objfile->free_psymtabs;
|
|
||||||
objfile->free_psymtabs = psymtab->next;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
psymtab = (struct partial_symtab *)
|
|
||||||
obstack_alloc (&objfile->objfile_obstack,
|
|
||||||
sizeof (struct partial_symtab));
|
|
||||||
|
|
||||||
memset (psymtab, 0, sizeof (struct partial_symtab));
|
|
||||||
psymtab->filename = (char *) bcache (filename, strlen (filename) + 1,
|
|
||||||
objfile->filename_cache);
|
|
||||||
psymtab->symtab = NULL;
|
|
||||||
|
|
||||||
/* Prepend it to the psymtab list for the objfile it belongs to.
|
|
||||||
Psymtabs are searched in most recent inserted -> least recent
|
|
||||||
inserted order. */
|
|
||||||
|
|
||||||
psymtab->objfile = objfile;
|
|
||||||
psymtab->next = objfile->psymtabs;
|
|
||||||
objfile->psymtabs = psymtab;
|
|
||||||
#if 0
|
|
||||||
{
|
|
||||||
struct partial_symtab **prev_pst;
|
|
||||||
psymtab->objfile = objfile;
|
|
||||||
psymtab->next = NULL;
|
|
||||||
prev_pst = &(objfile->psymtabs);
|
|
||||||
while ((*prev_pst) != NULL)
|
|
||||||
prev_pst = &((*prev_pst)->next);
|
|
||||||
(*prev_pst) = psymtab;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return (psymtab);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
discard_psymtab (struct partial_symtab *pst)
|
|
||||||
{
|
|
||||||
struct partial_symtab **prev_pst;
|
|
||||||
|
|
||||||
/* From dbxread.c:
|
|
||||||
Empty psymtabs happen as a result of header files which don't
|
|
||||||
have any symbols in them. There can be a lot of them. But this
|
|
||||||
check is wrong, in that a psymtab with N_SLINE entries but
|
|
||||||
nothing else is not empty, but we don't realize that. Fixing
|
|
||||||
that without slowing things down might be tricky. */
|
|
||||||
|
|
||||||
/* First, snip it out of the psymtab chain */
|
|
||||||
|
|
||||||
prev_pst = &(pst->objfile->psymtabs);
|
|
||||||
while ((*prev_pst) != pst)
|
|
||||||
prev_pst = &((*prev_pst)->next);
|
|
||||||
(*prev_pst) = pst->next;
|
|
||||||
|
|
||||||
/* Next, put it on a free list for recycling */
|
|
||||||
|
|
||||||
pst->next = pst->objfile->free_psymtabs;
|
|
||||||
pst->objfile->free_psymtabs = pst;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Reset all data structures in gdb which may contain references to symbol
|
/* Reset all data structures in gdb which may contain references to symbol
|
||||||
|
@ -2716,169 +2604,6 @@ clear_symtab_users_cleanup (void *ignore)
|
||||||
clear_symtab_users ();
|
clear_symtab_users ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate and partially fill a partial symtab. It will be
|
|
||||||
completely filled at the end of the symbol list.
|
|
||||||
|
|
||||||
FILENAME is the name of the symbol-file we are reading from. */
|
|
||||||
|
|
||||||
struct partial_symtab *
|
|
||||||
start_psymtab_common (struct objfile *objfile,
|
|
||||||
struct section_offsets *section_offsets,
|
|
||||||
const char *filename,
|
|
||||||
CORE_ADDR textlow, struct partial_symbol **global_syms,
|
|
||||||
struct partial_symbol **static_syms)
|
|
||||||
{
|
|
||||||
struct partial_symtab *psymtab;
|
|
||||||
|
|
||||||
psymtab = allocate_psymtab (filename, objfile);
|
|
||||||
psymtab->section_offsets = section_offsets;
|
|
||||||
psymtab->textlow = textlow;
|
|
||||||
psymtab->texthigh = psymtab->textlow; /* default */
|
|
||||||
psymtab->globals_offset = global_syms - objfile->global_psymbols.list;
|
|
||||||
psymtab->statics_offset = static_syms - objfile->static_psymbols.list;
|
|
||||||
return (psymtab);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Helper function, initialises partial symbol structure and stashes
|
|
||||||
it into objfile's bcache. Note that our caching mechanism will
|
|
||||||
use all fields of struct partial_symbol to determine hash value of the
|
|
||||||
structure. In other words, having two symbols with the same name but
|
|
||||||
different domain (or address) is possible and correct. */
|
|
||||||
|
|
||||||
static const struct partial_symbol *
|
|
||||||
add_psymbol_to_bcache (char *name, int namelength, int copy_name,
|
|
||||||
domain_enum domain,
|
|
||||||
enum address_class class,
|
|
||||||
long val, /* Value as a long */
|
|
||||||
CORE_ADDR coreaddr, /* Value as a CORE_ADDR */
|
|
||||||
enum language language, struct objfile *objfile,
|
|
||||||
int *added)
|
|
||||||
{
|
|
||||||
/* psymbol is static so that there will be no uninitialized gaps in the
|
|
||||||
structure which might contain random data, causing cache misses in
|
|
||||||
bcache. */
|
|
||||||
static struct partial_symbol psymbol;
|
|
||||||
|
|
||||||
/* However, we must ensure that the entire 'value' field has been
|
|
||||||
zeroed before assigning to it, because an assignment may not
|
|
||||||
write the entire field. */
|
|
||||||
memset (&psymbol.ginfo.value, 0, sizeof (psymbol.ginfo.value));
|
|
||||||
/* val and coreaddr are mutually exclusive, one of them *will* be zero */
|
|
||||||
if (val != 0)
|
|
||||||
{
|
|
||||||
SYMBOL_VALUE (&psymbol) = val;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SYMBOL_VALUE_ADDRESS (&psymbol) = coreaddr;
|
|
||||||
}
|
|
||||||
SYMBOL_SECTION (&psymbol) = 0;
|
|
||||||
SYMBOL_LANGUAGE (&psymbol) = language;
|
|
||||||
PSYMBOL_DOMAIN (&psymbol) = domain;
|
|
||||||
PSYMBOL_CLASS (&psymbol) = class;
|
|
||||||
|
|
||||||
SYMBOL_SET_NAMES (&psymbol, name, namelength, copy_name, objfile);
|
|
||||||
|
|
||||||
/* Stash the partial symbol away in the cache */
|
|
||||||
return bcache_full (&psymbol, sizeof (struct partial_symbol),
|
|
||||||
objfile->psymbol_cache, added);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Helper function, adds partial symbol to the given partial symbol
|
|
||||||
list. */
|
|
||||||
|
|
||||||
static void
|
|
||||||
append_psymbol_to_list (struct psymbol_allocation_list *list,
|
|
||||||
const struct partial_symbol *psym,
|
|
||||||
struct objfile *objfile)
|
|
||||||
{
|
|
||||||
if (list->next >= list->list + list->size)
|
|
||||||
extend_psymbol_list (list, objfile);
|
|
||||||
*list->next++ = (struct partial_symbol *) psym;
|
|
||||||
OBJSTAT (objfile, n_psyms++);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Add a symbol with a long value to a psymtab.
|
|
||||||
Since one arg is a struct, we pass in a ptr and deref it (sigh).
|
|
||||||
Return the partial symbol that has been added. */
|
|
||||||
|
|
||||||
/* NOTE: carlton/2003-09-11: The reason why we return the partial
|
|
||||||
symbol is so that callers can get access to the symbol's demangled
|
|
||||||
name, which they don't have any cheap way to determine otherwise.
|
|
||||||
(Currenly, dwarf2read.c is the only file who uses that information,
|
|
||||||
though it's possible that other readers might in the future.)
|
|
||||||
Elena wasn't thrilled about that, and I don't blame her, but we
|
|
||||||
couldn't come up with a better way to get that information. If
|
|
||||||
it's needed in other situations, we could consider breaking up
|
|
||||||
SYMBOL_SET_NAMES to provide access to the demangled name lookup
|
|
||||||
cache. */
|
|
||||||
|
|
||||||
const struct partial_symbol *
|
|
||||||
add_psymbol_to_list (char *name, int namelength, int copy_name,
|
|
||||||
domain_enum domain,
|
|
||||||
enum address_class class,
|
|
||||||
struct psymbol_allocation_list *list,
|
|
||||||
long val, /* Value as a long */
|
|
||||||
CORE_ADDR coreaddr, /* Value as a CORE_ADDR */
|
|
||||||
enum language language, struct objfile *objfile)
|
|
||||||
{
|
|
||||||
const struct partial_symbol *psym;
|
|
||||||
|
|
||||||
int added;
|
|
||||||
|
|
||||||
/* Stash the partial symbol away in the cache */
|
|
||||||
psym = add_psymbol_to_bcache (name, namelength, copy_name, domain, class,
|
|
||||||
val, coreaddr, language, objfile, &added);
|
|
||||||
|
|
||||||
/* Do not duplicate global partial symbols. */
|
|
||||||
if (list == &objfile->global_psymbols
|
|
||||||
&& !added)
|
|
||||||
return psym;
|
|
||||||
|
|
||||||
/* Save pointer to partial symbol in psymtab, growing symtab if needed. */
|
|
||||||
append_psymbol_to_list (list, psym, objfile);
|
|
||||||
return psym;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize storage for partial symbols. */
|
|
||||||
|
|
||||||
void
|
|
||||||
init_psymbol_list (struct objfile *objfile, int total_symbols)
|
|
||||||
{
|
|
||||||
/* Free any previously allocated psymbol lists. */
|
|
||||||
|
|
||||||
if (objfile->global_psymbols.list)
|
|
||||||
{
|
|
||||||
xfree (objfile->global_psymbols.list);
|
|
||||||
}
|
|
||||||
if (objfile->static_psymbols.list)
|
|
||||||
{
|
|
||||||
xfree (objfile->static_psymbols.list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Current best guess is that approximately a twentieth
|
|
||||||
of the total symbols (in a debugging file) are global or static
|
|
||||||
oriented symbols */
|
|
||||||
|
|
||||||
objfile->global_psymbols.size = total_symbols / 10;
|
|
||||||
objfile->static_psymbols.size = total_symbols / 10;
|
|
||||||
|
|
||||||
if (objfile->global_psymbols.size > 0)
|
|
||||||
{
|
|
||||||
objfile->global_psymbols.next =
|
|
||||||
objfile->global_psymbols.list = (struct partial_symbol **)
|
|
||||||
xmalloc ((objfile->global_psymbols.size
|
|
||||||
* sizeof (struct partial_symbol *)));
|
|
||||||
}
|
|
||||||
if (objfile->static_psymbols.size > 0)
|
|
||||||
{
|
|
||||||
objfile->static_psymbols.next =
|
|
||||||
objfile->static_psymbols.list = (struct partial_symbol **)
|
|
||||||
xmalloc ((objfile->static_psymbols.size
|
|
||||||
* sizeof (struct partial_symbol *)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* OVERLAYS:
|
/* OVERLAYS:
|
||||||
The following code implements an abstraction for debugging overlay sections.
|
The following code implements an abstraction for debugging overlay sections.
|
||||||
|
|
||||||
|
|
167
gdb/symfile.h
167
gdb/symfile.h
|
@ -111,6 +111,165 @@ struct symfile_segment_data
|
||||||
int *segment_info;
|
int *segment_info;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* The "quick" symbol functions exist so that symbol readers can
|
||||||
|
avoiding an initial read of all the symbols. For example, symbol
|
||||||
|
readers might choose to use the "partial symbol table" utilities,
|
||||||
|
which is one implementation of the quick symbol functions.
|
||||||
|
|
||||||
|
The quick symbol functions are generally opaque: the underlying
|
||||||
|
representation is hidden from the caller.
|
||||||
|
|
||||||
|
In general, these functions should only look at whatever special
|
||||||
|
index the symbol reader creates -- looking through the symbol
|
||||||
|
tables themselves is handled by generic code. If a function is
|
||||||
|
defined as returning a "symbol table", this means that the function
|
||||||
|
should only return a newly-created symbol table; it should not
|
||||||
|
examine pre-existing ones.
|
||||||
|
|
||||||
|
The exact list of functions here was determined in an ad hoc way
|
||||||
|
based on gdb's history. */
|
||||||
|
|
||||||
|
struct quick_symbol_functions
|
||||||
|
{
|
||||||
|
/* Return true if this objfile has any "partial" symbols
|
||||||
|
available. */
|
||||||
|
int (*has_symbols) (struct objfile *objfile);
|
||||||
|
|
||||||
|
/* Return the symbol table for the "last" file appearing in
|
||||||
|
OBJFILE. */
|
||||||
|
struct symtab *(*find_last_source_symtab) (struct objfile *objfile);
|
||||||
|
|
||||||
|
/* Forget all cached full file names for OBJFILE. */
|
||||||
|
void (*forget_cached_source_info) (struct objfile *objfile);
|
||||||
|
|
||||||
|
/* Look up the symbol table, in OBJFILE, of a source file named
|
||||||
|
NAME. If there is no '/' in the name, a match after a '/' in the
|
||||||
|
symbol table's file name will also work. FULL_PATH is the
|
||||||
|
absolute file name, and REAL_PATH is the same, run through
|
||||||
|
gdb_realpath.
|
||||||
|
|
||||||
|
If no such symbol table can be found, returns 0.
|
||||||
|
|
||||||
|
Otherwise, sets *RESULT to the symbol table and returns 1. This
|
||||||
|
might return 1 and set *RESULT to NULL if the requested file is
|
||||||
|
an include file that does not have a symtab of its own. */
|
||||||
|
int (*lookup_symtab) (struct objfile *objfile,
|
||||||
|
const char *name,
|
||||||
|
const char *full_path,
|
||||||
|
const char *real_path,
|
||||||
|
struct symtab **result);
|
||||||
|
|
||||||
|
/* Check to see if the symbol is defined in a "partial" symbol table
|
||||||
|
of OBJFILE. KIND should be either GLOBAL_BLOCK or STATIC_BLOCK,
|
||||||
|
depending on whether we want to search global symbols or static
|
||||||
|
symbols. NAME is the name of the symbol to look for. DOMAIN
|
||||||
|
indicates what sort of symbol to search for.
|
||||||
|
|
||||||
|
Returns the newly-expanded symbol table in which the symbol is
|
||||||
|
defined, or NULL if no such symbol table exists. */
|
||||||
|
struct symtab *(*lookup_symbol) (struct objfile *objfile,
|
||||||
|
int kind, const char *name,
|
||||||
|
domain_enum domain);
|
||||||
|
|
||||||
|
/* Print statistics about any indices loaded for OBJFILE. The
|
||||||
|
statistics should be printed to gdb_stdout. This is used for
|
||||||
|
"maint print statistics". */
|
||||||
|
void (*print_stats) (struct objfile *objfile);
|
||||||
|
|
||||||
|
/* Dump any indices loaded for OBJFILE. The dump should go to
|
||||||
|
gdb_stdout. This is used for "maint print objfiles". */
|
||||||
|
void (*dump) (struct objfile *objfile);
|
||||||
|
|
||||||
|
/* This is called by objfile_relocate to relocate any indices loaded
|
||||||
|
for OBJFILE. */
|
||||||
|
void (*relocate) (struct objfile *objfile,
|
||||||
|
struct section_offsets *new_offsets,
|
||||||
|
struct section_offsets *delta);
|
||||||
|
|
||||||
|
/* Find all the symbols in OBJFILE named FUNC_NAME, and ensure that
|
||||||
|
the corresponding symbol tables are loaded. */
|
||||||
|
void (*expand_symtabs_for_function) (struct objfile *objfile,
|
||||||
|
const char *func_name);
|
||||||
|
|
||||||
|
/* Read all symbol tables associated with OBJFILE. */
|
||||||
|
void (*expand_all_symtabs) (struct objfile *objfile);
|
||||||
|
|
||||||
|
/* Read all symbol tables associated with OBJFILE which have the
|
||||||
|
file name FILENAME. */
|
||||||
|
void (*expand_symtabs_with_filename) (struct objfile *objfile,
|
||||||
|
const char *filename);
|
||||||
|
|
||||||
|
/* Return the file name of the file holding the symbol in OBJFILE
|
||||||
|
named NAME. If no such symbol exists in OBJFILE, return NULL. */
|
||||||
|
char *(*find_symbol_file) (struct objfile *objfile, const char *name);
|
||||||
|
|
||||||
|
/* This method is specific to Ada. It walks the partial symbol
|
||||||
|
tables of OBJFILE looking for a name match. WILD_MATCH and
|
||||||
|
IS_NAME_SUFFIX are predicate functions that the implementation
|
||||||
|
may call to check for a match.
|
||||||
|
|
||||||
|
This function is completely ad hoc and new implementations should
|
||||||
|
refer to the psymtab implementation to see what to do. */
|
||||||
|
void (*map_ada_symtabs) (struct objfile *objfile,
|
||||||
|
int (*wild_match) (const char *, int, const char *),
|
||||||
|
int (*is_name_suffix) (const char *),
|
||||||
|
void (*callback) (struct objfile *,
|
||||||
|
struct symtab *, void *),
|
||||||
|
const char *name, int global,
|
||||||
|
domain_enum namespace, int wild,
|
||||||
|
void *data);
|
||||||
|
|
||||||
|
/* Expand all symbol tables in OBJFILE matching some criteria.
|
||||||
|
|
||||||
|
FILE_MATCHER is called for each file in OBJFILE. The file name
|
||||||
|
and the DATA argument are passed to it. If it returns zero, this
|
||||||
|
file is skipped.
|
||||||
|
|
||||||
|
Otherwise, if the file is not skipped, then NAME_MATCHER is
|
||||||
|
called for each symbol defined in the file. The symbol's
|
||||||
|
"natural" name and DATA are passed to NAME_MATCHER.
|
||||||
|
|
||||||
|
If NAME_MATCHER returns zero, then this symbol is skipped.
|
||||||
|
|
||||||
|
Otherwise, if this symbol is not skipped, and it matches KIND,
|
||||||
|
then this symbol's symbol table is expanded.
|
||||||
|
|
||||||
|
DATA is user data that is passed unmodified to the callback
|
||||||
|
functions. */
|
||||||
|
void (*expand_symtabs_matching) (struct objfile *objfile,
|
||||||
|
int (*file_matcher) (const char *, void *),
|
||||||
|
int (*name_matcher) (const char *, void *),
|
||||||
|
domain_enum kind,
|
||||||
|
void *data);
|
||||||
|
|
||||||
|
/* Return the symbol table from OBJFILE that contains PC and
|
||||||
|
SECTION. Return NULL if there is no such symbol table. This
|
||||||
|
should return the symbol table that contains a symbol whose
|
||||||
|
address exactly matches PC, or, if there is no exact match, the
|
||||||
|
symbol table that contains a symbol whose address is closest to
|
||||||
|
PC. */
|
||||||
|
struct symtab *(*find_pc_sect_symtab) (struct objfile *objfile,
|
||||||
|
struct minimal_symbol *msymbol,
|
||||||
|
CORE_ADDR pc,
|
||||||
|
struct obj_section *section,
|
||||||
|
int warn_if_readin);
|
||||||
|
|
||||||
|
/* Call a callback for every symbol defined in OBJFILE. FUN is the
|
||||||
|
callback. It is passed the symbol's natural name, and the DATA
|
||||||
|
passed to this function. */
|
||||||
|
void (*map_symbol_names) (struct objfile *objfile,
|
||||||
|
void (*fun) (const char *, void *),
|
||||||
|
void *data);
|
||||||
|
|
||||||
|
/* Call a callback for every file defined in OBJFILE. FUN is the
|
||||||
|
callback. It is passed the file's name, the file's full name,
|
||||||
|
and the DATA passed to this function. */
|
||||||
|
void (*map_symbol_filenames) (struct objfile *objfile,
|
||||||
|
void (*fun) (const char *, const char *,
|
||||||
|
void *),
|
||||||
|
void *data);
|
||||||
|
};
|
||||||
|
|
||||||
/* Structure to keep track of symbol reading functions for various
|
/* Structure to keep track of symbol reading functions for various
|
||||||
object file types. */
|
object file types. */
|
||||||
|
|
||||||
|
@ -174,6 +333,10 @@ struct sym_fns
|
||||||
|
|
||||||
bfd_byte *(*sym_relocate) (struct objfile *, asection *sectp, bfd_byte *buf);
|
bfd_byte *(*sym_relocate) (struct objfile *, asection *sectp, bfd_byte *buf);
|
||||||
|
|
||||||
|
/* The "quick" (aka partial) symbol functions for this symbol
|
||||||
|
reader. */
|
||||||
|
const struct quick_symbol_functions *qf;
|
||||||
|
|
||||||
/* Finds the next struct sym_fns. They are allocated and
|
/* Finds the next struct sym_fns. They are allocated and
|
||||||
initialized in whatever module implements the functions pointed
|
initialized in whatever module implements the functions pointed
|
||||||
to; an initializer calls add_symtab_fns to add them to the global
|
to; an initializer calls add_symtab_fns to add them to the global
|
||||||
|
@ -226,8 +389,6 @@ struct partial_symbol *add_psymbol_to_list (char *, int, int, domain_enum,
|
||||||
|
|
||||||
extern void init_psymbol_list (struct objfile *, int);
|
extern void init_psymbol_list (struct objfile *, int);
|
||||||
|
|
||||||
extern void sort_pst_symbols (struct partial_symtab *);
|
|
||||||
|
|
||||||
extern struct symtab *allocate_symtab (char *, struct objfile *);
|
extern struct symtab *allocate_symtab (char *, struct objfile *);
|
||||||
|
|
||||||
extern void add_symtab_fns (struct sym_fns *);
|
extern void add_symtab_fns (struct sym_fns *);
|
||||||
|
@ -399,6 +560,8 @@ extern int symfile_map_offsets_to_segments (bfd *,
|
||||||
struct symfile_segment_data *get_symfile_segment_data (bfd *abfd);
|
struct symfile_segment_data *get_symfile_segment_data (bfd *abfd);
|
||||||
void free_symfile_segment_data (struct symfile_segment_data *data);
|
void free_symfile_segment_data (struct symfile_segment_data *data);
|
||||||
|
|
||||||
|
extern struct cleanup *increment_reading_symtab (void);
|
||||||
|
|
||||||
/* From dwarf2read.c */
|
/* From dwarf2read.c */
|
||||||
|
|
||||||
extern int dwarf2_has_info (struct objfile *);
|
extern int dwarf2_has_info (struct objfile *);
|
||||||
|
|
464
gdb/symmisc.c
464
gdb/symmisc.c
|
@ -39,6 +39,8 @@
|
||||||
#include "gdb_string.h"
|
#include "gdb_string.h"
|
||||||
#include "readline/readline.h"
|
#include "readline/readline.h"
|
||||||
|
|
||||||
|
#include "psymtab.h"
|
||||||
|
|
||||||
#ifndef DEV_TTY
|
#ifndef DEV_TTY
|
||||||
#define DEV_TTY "/dev/tty"
|
#define DEV_TTY "/dev/tty"
|
||||||
#endif
|
#endif
|
||||||
|
@ -58,19 +60,12 @@ FILE *std_err;
|
||||||
static void dump_symtab (struct objfile *, struct symtab *,
|
static void dump_symtab (struct objfile *, struct symtab *,
|
||||||
struct ui_file *);
|
struct ui_file *);
|
||||||
|
|
||||||
static void dump_psymtab (struct objfile *, struct partial_symtab *,
|
|
||||||
struct ui_file *);
|
|
||||||
|
|
||||||
static void dump_msymbols (struct objfile *, struct ui_file *);
|
static void dump_msymbols (struct objfile *, struct ui_file *);
|
||||||
|
|
||||||
static void dump_objfile (struct objfile *);
|
static void dump_objfile (struct objfile *);
|
||||||
|
|
||||||
static int block_depth (struct block *);
|
static int block_depth (struct block *);
|
||||||
|
|
||||||
static void print_partial_symbols (struct gdbarch *,
|
|
||||||
struct partial_symbol **, int,
|
|
||||||
char *, struct ui_file *);
|
|
||||||
|
|
||||||
void _initialize_symmisc (void);
|
void _initialize_symmisc (void);
|
||||||
|
|
||||||
struct print_symbol_args
|
struct print_symbol_args
|
||||||
|
@ -151,7 +146,6 @@ print_objfile_statistics (void)
|
||||||
struct program_space *pspace;
|
struct program_space *pspace;
|
||||||
struct objfile *objfile;
|
struct objfile *objfile;
|
||||||
struct symtab *s;
|
struct symtab *s;
|
||||||
struct partial_symtab *ps;
|
|
||||||
int i, linetables, blockvectors;
|
int i, linetables, blockvectors;
|
||||||
|
|
||||||
immediate_quit++;
|
immediate_quit++;
|
||||||
|
@ -174,13 +168,8 @@ print_objfile_statistics (void)
|
||||||
if (OBJSTAT (objfile, n_types) > 0)
|
if (OBJSTAT (objfile, n_types) > 0)
|
||||||
printf_filtered (_(" Number of \"types\" defined: %d\n"),
|
printf_filtered (_(" Number of \"types\" defined: %d\n"),
|
||||||
OBJSTAT (objfile, n_types));
|
OBJSTAT (objfile, n_types));
|
||||||
i = 0;
|
if (objfile->sf)
|
||||||
ALL_OBJFILE_PSYMTABS (objfile, ps)
|
objfile->sf->qf->print_stats (objfile);
|
||||||
{
|
|
||||||
if (ps->readin == 0)
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
printf_filtered (_(" Number of psym tables (not yet expanded): %d\n"), i);
|
|
||||||
i = linetables = blockvectors = 0;
|
i = linetables = blockvectors = 0;
|
||||||
ALL_OBJFILE_SYMTABS (objfile, s)
|
ALL_OBJFILE_SYMTABS (objfile, s)
|
||||||
{
|
{
|
||||||
|
@ -215,7 +204,6 @@ static void
|
||||||
dump_objfile (struct objfile *objfile)
|
dump_objfile (struct objfile *objfile)
|
||||||
{
|
{
|
||||||
struct symtab *symtab;
|
struct symtab *symtab;
|
||||||
struct partial_symtab *psymtab;
|
|
||||||
|
|
||||||
printf_filtered ("\nObject file %s: ", objfile->name);
|
printf_filtered ("\nObject file %s: ", objfile->name);
|
||||||
printf_filtered ("Objfile at ");
|
printf_filtered ("Objfile at ");
|
||||||
|
@ -225,25 +213,8 @@ dump_objfile (struct objfile *objfile)
|
||||||
printf_filtered (", %d minsyms\n\n",
|
printf_filtered (", %d minsyms\n\n",
|
||||||
objfile->minimal_symbol_count);
|
objfile->minimal_symbol_count);
|
||||||
|
|
||||||
if (objfile->psymtabs)
|
if (objfile->sf)
|
||||||
{
|
objfile->sf->qf->dump (objfile);
|
||||||
printf_filtered ("Psymtabs:\n");
|
|
||||||
for (psymtab = objfile->psymtabs;
|
|
||||||
psymtab != NULL;
|
|
||||||
psymtab = psymtab->next)
|
|
||||||
{
|
|
||||||
printf_filtered ("%s at ",
|
|
||||||
psymtab->filename);
|
|
||||||
gdb_print_host_address (psymtab, gdb_stdout);
|
|
||||||
printf_filtered (", ");
|
|
||||||
if (psymtab->objfile != objfile)
|
|
||||||
{
|
|
||||||
printf_filtered ("NOT ON CHAIN! ");
|
|
||||||
}
|
|
||||||
wrap_here (" ");
|
|
||||||
}
|
|
||||||
printf_filtered ("\n\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (objfile->symtabs)
|
if (objfile->symtabs)
|
||||||
{
|
{
|
||||||
|
@ -344,76 +315,6 @@ dump_msymbols (struct objfile *objfile, struct ui_file *outfile)
|
||||||
fprintf_filtered (outfile, "\n");
|
fprintf_filtered (outfile, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
dump_psymtab (struct objfile *objfile, struct partial_symtab *psymtab,
|
|
||||||
struct ui_file *outfile)
|
|
||||||
{
|
|
||||||
struct gdbarch *gdbarch = get_objfile_arch (objfile);
|
|
||||||
int i;
|
|
||||||
|
|
||||||
fprintf_filtered (outfile, "\nPartial symtab for source file %s ",
|
|
||||||
psymtab->filename);
|
|
||||||
fprintf_filtered (outfile, "(object ");
|
|
||||||
gdb_print_host_address (psymtab, outfile);
|
|
||||||
fprintf_filtered (outfile, ")\n\n");
|
|
||||||
fprintf_unfiltered (outfile, " Read from object file %s (",
|
|
||||||
objfile->name);
|
|
||||||
gdb_print_host_address (objfile, outfile);
|
|
||||||
fprintf_unfiltered (outfile, ")\n");
|
|
||||||
|
|
||||||
if (psymtab->readin)
|
|
||||||
{
|
|
||||||
fprintf_filtered (outfile,
|
|
||||||
" Full symtab was read (at ");
|
|
||||||
gdb_print_host_address (psymtab->symtab, outfile);
|
|
||||||
fprintf_filtered (outfile, " by function at ");
|
|
||||||
gdb_print_host_address (psymtab->read_symtab, outfile);
|
|
||||||
fprintf_filtered (outfile, ")\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf_filtered (outfile, " Relocate symbols by ");
|
|
||||||
for (i = 0; i < psymtab->objfile->num_sections; ++i)
|
|
||||||
{
|
|
||||||
if (i != 0)
|
|
||||||
fprintf_filtered (outfile, ", ");
|
|
||||||
wrap_here (" ");
|
|
||||||
fputs_filtered (paddress (gdbarch,
|
|
||||||
ANOFFSET (psymtab->section_offsets, i)),
|
|
||||||
outfile);
|
|
||||||
}
|
|
||||||
fprintf_filtered (outfile, "\n");
|
|
||||||
|
|
||||||
fprintf_filtered (outfile, " Symbols cover text addresses ");
|
|
||||||
fputs_filtered (paddress (gdbarch, psymtab->textlow), outfile);
|
|
||||||
fprintf_filtered (outfile, "-");
|
|
||||||
fputs_filtered (paddress (gdbarch, psymtab->texthigh), outfile);
|
|
||||||
fprintf_filtered (outfile, "\n");
|
|
||||||
fprintf_filtered (outfile, " Depends on %d other partial symtabs.\n",
|
|
||||||
psymtab->number_of_dependencies);
|
|
||||||
for (i = 0; i < psymtab->number_of_dependencies; i++)
|
|
||||||
{
|
|
||||||
fprintf_filtered (outfile, " %d ", i);
|
|
||||||
gdb_print_host_address (psymtab->dependencies[i], outfile);
|
|
||||||
fprintf_filtered (outfile, " %s\n",
|
|
||||||
psymtab->dependencies[i]->filename);
|
|
||||||
}
|
|
||||||
if (psymtab->n_global_syms > 0)
|
|
||||||
{
|
|
||||||
print_partial_symbols (gdbarch,
|
|
||||||
objfile->global_psymbols.list
|
|
||||||
+ psymtab->globals_offset,
|
|
||||||
psymtab->n_global_syms, "Global", outfile);
|
|
||||||
}
|
|
||||||
if (psymtab->n_static_syms > 0)
|
|
||||||
{
|
|
||||||
print_partial_symbols (gdbarch,
|
|
||||||
objfile->static_psymbols.list
|
|
||||||
+ psymtab->statics_offset,
|
|
||||||
psymtab->n_static_syms, "Static", outfile);
|
|
||||||
}
|
|
||||||
fprintf_filtered (outfile, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_symtab_1 (struct objfile *objfile, struct symtab *symtab,
|
dump_symtab_1 (struct objfile *objfile, struct symtab *symtab,
|
||||||
struct ui_file *outfile)
|
struct ui_file *outfile)
|
||||||
|
@ -749,142 +650,6 @@ print_symbol (void *args)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
maintenance_print_psymbols (char *args, int from_tty)
|
|
||||||
{
|
|
||||||
char **argv;
|
|
||||||
struct ui_file *outfile;
|
|
||||||
struct cleanup *cleanups;
|
|
||||||
char *symname = NULL;
|
|
||||||
char *filename = DEV_TTY;
|
|
||||||
struct objfile *objfile;
|
|
||||||
struct partial_symtab *ps;
|
|
||||||
|
|
||||||
dont_repeat ();
|
|
||||||
|
|
||||||
if (args == NULL)
|
|
||||||
{
|
|
||||||
error (_("print-psymbols takes an output file name and optional symbol file name"));
|
|
||||||
}
|
|
||||||
argv = gdb_buildargv (args);
|
|
||||||
cleanups = make_cleanup_freeargv (argv);
|
|
||||||
|
|
||||||
if (argv[0] != NULL)
|
|
||||||
{
|
|
||||||
filename = argv[0];
|
|
||||||
/* If a second arg is supplied, it is a source file name to match on */
|
|
||||||
if (argv[1] != NULL)
|
|
||||||
{
|
|
||||||
symname = argv[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
filename = tilde_expand (filename);
|
|
||||||
make_cleanup (xfree, filename);
|
|
||||||
|
|
||||||
outfile = gdb_fopen (filename, FOPEN_WT);
|
|
||||||
if (outfile == 0)
|
|
||||||
perror_with_name (filename);
|
|
||||||
make_cleanup_ui_file_delete (outfile);
|
|
||||||
|
|
||||||
immediate_quit++;
|
|
||||||
ALL_PSYMTABS (objfile, ps)
|
|
||||||
if (symname == NULL || strcmp (symname, ps->filename) == 0)
|
|
||||||
dump_psymtab (objfile, ps, outfile);
|
|
||||||
immediate_quit--;
|
|
||||||
do_cleanups (cleanups);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
print_partial_symbols (struct gdbarch *gdbarch,
|
|
||||||
struct partial_symbol **p, int count, char *what,
|
|
||||||
struct ui_file *outfile)
|
|
||||||
{
|
|
||||||
fprintf_filtered (outfile, " %s partial symbols:\n", what);
|
|
||||||
while (count-- > 0)
|
|
||||||
{
|
|
||||||
fprintf_filtered (outfile, " `%s'", SYMBOL_LINKAGE_NAME (*p));
|
|
||||||
if (SYMBOL_DEMANGLED_NAME (*p) != NULL)
|
|
||||||
{
|
|
||||||
fprintf_filtered (outfile, " `%s'", SYMBOL_DEMANGLED_NAME (*p));
|
|
||||||
}
|
|
||||||
fputs_filtered (", ", outfile);
|
|
||||||
switch (SYMBOL_DOMAIN (*p))
|
|
||||||
{
|
|
||||||
case UNDEF_DOMAIN:
|
|
||||||
fputs_filtered ("undefined domain, ", outfile);
|
|
||||||
break;
|
|
||||||
case VAR_DOMAIN:
|
|
||||||
/* This is the usual thing -- don't print it */
|
|
||||||
break;
|
|
||||||
case STRUCT_DOMAIN:
|
|
||||||
fputs_filtered ("struct domain, ", outfile);
|
|
||||||
break;
|
|
||||||
case LABEL_DOMAIN:
|
|
||||||
fputs_filtered ("label domain, ", outfile);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
fputs_filtered ("<invalid domain>, ", outfile);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
switch (SYMBOL_CLASS (*p))
|
|
||||||
{
|
|
||||||
case LOC_UNDEF:
|
|
||||||
fputs_filtered ("undefined", outfile);
|
|
||||||
break;
|
|
||||||
case LOC_CONST:
|
|
||||||
fputs_filtered ("constant int", outfile);
|
|
||||||
break;
|
|
||||||
case LOC_STATIC:
|
|
||||||
fputs_filtered ("static", outfile);
|
|
||||||
break;
|
|
||||||
case LOC_REGISTER:
|
|
||||||
fputs_filtered ("register", outfile);
|
|
||||||
break;
|
|
||||||
case LOC_ARG:
|
|
||||||
fputs_filtered ("pass by value", outfile);
|
|
||||||
break;
|
|
||||||
case LOC_REF_ARG:
|
|
||||||
fputs_filtered ("pass by reference", outfile);
|
|
||||||
break;
|
|
||||||
case LOC_REGPARM_ADDR:
|
|
||||||
fputs_filtered ("register address parameter", outfile);
|
|
||||||
break;
|
|
||||||
case LOC_LOCAL:
|
|
||||||
fputs_filtered ("stack parameter", outfile);
|
|
||||||
break;
|
|
||||||
case LOC_TYPEDEF:
|
|
||||||
fputs_filtered ("type", outfile);
|
|
||||||
break;
|
|
||||||
case LOC_LABEL:
|
|
||||||
fputs_filtered ("label", outfile);
|
|
||||||
break;
|
|
||||||
case LOC_BLOCK:
|
|
||||||
fputs_filtered ("function", outfile);
|
|
||||||
break;
|
|
||||||
case LOC_CONST_BYTES:
|
|
||||||
fputs_filtered ("constant bytes", outfile);
|
|
||||||
break;
|
|
||||||
case LOC_UNRESOLVED:
|
|
||||||
fputs_filtered ("unresolved", outfile);
|
|
||||||
break;
|
|
||||||
case LOC_OPTIMIZED_OUT:
|
|
||||||
fputs_filtered ("optimized out", outfile);
|
|
||||||
break;
|
|
||||||
case LOC_COMPUTED:
|
|
||||||
fputs_filtered ("computed at runtime", outfile);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
fputs_filtered ("<invalid location>", outfile);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
fputs_filtered (", ", outfile);
|
|
||||||
fputs_filtered (paddress (gdbarch, SYMBOL_VALUE_ADDRESS (*p)), outfile);
|
|
||||||
fprintf_filtered (outfile, "\n");
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
maintenance_print_msymbols (char *args, int from_tty)
|
maintenance_print_msymbols (char *args, int from_tty)
|
||||||
{
|
{
|
||||||
|
@ -1012,194 +777,6 @@ maintenance_info_symtabs (char *regexp, int from_tty)
|
||||||
printf_filtered ("}\n");
|
printf_filtered ("}\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* List all the partial symbol tables whose names match REGEXP (optional). */
|
|
||||||
void
|
|
||||||
maintenance_info_psymtabs (char *regexp, int from_tty)
|
|
||||||
{
|
|
||||||
struct program_space *pspace;
|
|
||||||
struct objfile *objfile;
|
|
||||||
|
|
||||||
if (regexp)
|
|
||||||
re_comp (regexp);
|
|
||||||
|
|
||||||
ALL_PSPACES (pspace)
|
|
||||||
ALL_PSPACE_OBJFILES (pspace, objfile)
|
|
||||||
{
|
|
||||||
struct gdbarch *gdbarch = get_objfile_arch (objfile);
|
|
||||||
struct partial_symtab *psymtab;
|
|
||||||
|
|
||||||
/* We don't want to print anything for this objfile until we
|
|
||||||
actually find a symtab whose name matches. */
|
|
||||||
int printed_objfile_start = 0;
|
|
||||||
|
|
||||||
ALL_OBJFILE_PSYMTABS (objfile, psymtab)
|
|
||||||
{
|
|
||||||
QUIT;
|
|
||||||
|
|
||||||
if (! regexp
|
|
||||||
|| re_exec (psymtab->filename))
|
|
||||||
{
|
|
||||||
if (! printed_objfile_start)
|
|
||||||
{
|
|
||||||
printf_filtered ("{ objfile %s ", objfile->name);
|
|
||||||
wrap_here (" ");
|
|
||||||
printf_filtered ("((struct objfile *) %s)\n",
|
|
||||||
host_address_to_string (objfile));
|
|
||||||
printed_objfile_start = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf_filtered (" { psymtab %s ", psymtab->filename);
|
|
||||||
wrap_here (" ");
|
|
||||||
printf_filtered ("((struct partial_symtab *) %s)\n",
|
|
||||||
host_address_to_string (psymtab));
|
|
||||||
|
|
||||||
printf_filtered (" readin %s\n",
|
|
||||||
psymtab->readin ? "yes" : "no");
|
|
||||||
printf_filtered (" fullname %s\n",
|
|
||||||
psymtab->fullname ? psymtab->fullname : "(null)");
|
|
||||||
printf_filtered (" text addresses ");
|
|
||||||
fputs_filtered (paddress (gdbarch, psymtab->textlow),
|
|
||||||
gdb_stdout);
|
|
||||||
printf_filtered (" -- ");
|
|
||||||
fputs_filtered (paddress (gdbarch, psymtab->texthigh),
|
|
||||||
gdb_stdout);
|
|
||||||
printf_filtered ("\n");
|
|
||||||
printf_filtered (" globals ");
|
|
||||||
if (psymtab->n_global_syms)
|
|
||||||
{
|
|
||||||
printf_filtered ("(* (struct partial_symbol **) %s @ %d)\n",
|
|
||||||
host_address_to_string (psymtab->objfile->global_psymbols.list
|
|
||||||
+ psymtab->globals_offset),
|
|
||||||
psymtab->n_global_syms);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
printf_filtered ("(none)\n");
|
|
||||||
printf_filtered (" statics ");
|
|
||||||
if (psymtab->n_static_syms)
|
|
||||||
{
|
|
||||||
printf_filtered ("(* (struct partial_symbol **) %s @ %d)\n",
|
|
||||||
host_address_to_string (psymtab->objfile->static_psymbols.list
|
|
||||||
+ psymtab->statics_offset),
|
|
||||||
psymtab->n_static_syms);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
printf_filtered ("(none)\n");
|
|
||||||
printf_filtered (" dependencies ");
|
|
||||||
if (psymtab->number_of_dependencies)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
printf_filtered ("{\n");
|
|
||||||
for (i = 0; i < psymtab->number_of_dependencies; i++)
|
|
||||||
{
|
|
||||||
struct partial_symtab *dep = psymtab->dependencies[i];
|
|
||||||
|
|
||||||
/* Note the string concatenation there --- no comma. */
|
|
||||||
printf_filtered (" psymtab %s "
|
|
||||||
"((struct partial_symtab *) %s)\n",
|
|
||||||
dep->filename,
|
|
||||||
host_address_to_string (dep));
|
|
||||||
}
|
|
||||||
printf_filtered (" }\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
printf_filtered ("(none)\n");
|
|
||||||
printf_filtered (" }\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (printed_objfile_start)
|
|
||||||
printf_filtered ("}\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Check consistency of psymtabs and symtabs. */
|
|
||||||
|
|
||||||
void
|
|
||||||
maintenance_check_symtabs (char *ignore, int from_tty)
|
|
||||||
{
|
|
||||||
struct symbol *sym;
|
|
||||||
struct partial_symbol **psym;
|
|
||||||
struct symtab *s = NULL;
|
|
||||||
struct partial_symtab *ps;
|
|
||||||
struct blockvector *bv;
|
|
||||||
struct objfile *objfile;
|
|
||||||
struct block *b;
|
|
||||||
int length;
|
|
||||||
|
|
||||||
ALL_PSYMTABS (objfile, ps)
|
|
||||||
{
|
|
||||||
struct gdbarch *gdbarch = get_objfile_arch (objfile);
|
|
||||||
s = PSYMTAB_TO_SYMTAB (ps);
|
|
||||||
if (s == NULL)
|
|
||||||
continue;
|
|
||||||
bv = BLOCKVECTOR (s);
|
|
||||||
b = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
|
|
||||||
psym = ps->objfile->static_psymbols.list + ps->statics_offset;
|
|
||||||
length = ps->n_static_syms;
|
|
||||||
while (length--)
|
|
||||||
{
|
|
||||||
sym = lookup_block_symbol (b, SYMBOL_LINKAGE_NAME (*psym),
|
|
||||||
SYMBOL_DOMAIN (*psym));
|
|
||||||
if (!sym)
|
|
||||||
{
|
|
||||||
printf_filtered ("Static symbol `");
|
|
||||||
puts_filtered (SYMBOL_LINKAGE_NAME (*psym));
|
|
||||||
printf_filtered ("' only found in ");
|
|
||||||
puts_filtered (ps->filename);
|
|
||||||
printf_filtered (" psymtab\n");
|
|
||||||
}
|
|
||||||
psym++;
|
|
||||||
}
|
|
||||||
b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
|
|
||||||
psym = ps->objfile->global_psymbols.list + ps->globals_offset;
|
|
||||||
length = ps->n_global_syms;
|
|
||||||
while (length--)
|
|
||||||
{
|
|
||||||
sym = lookup_block_symbol (b, SYMBOL_LINKAGE_NAME (*psym),
|
|
||||||
SYMBOL_DOMAIN (*psym));
|
|
||||||
if (!sym)
|
|
||||||
{
|
|
||||||
printf_filtered ("Global symbol `");
|
|
||||||
puts_filtered (SYMBOL_LINKAGE_NAME (*psym));
|
|
||||||
printf_filtered ("' only found in ");
|
|
||||||
puts_filtered (ps->filename);
|
|
||||||
printf_filtered (" psymtab\n");
|
|
||||||
}
|
|
||||||
psym++;
|
|
||||||
}
|
|
||||||
if (ps->texthigh < ps->textlow)
|
|
||||||
{
|
|
||||||
printf_filtered ("Psymtab ");
|
|
||||||
puts_filtered (ps->filename);
|
|
||||||
printf_filtered (" covers bad range ");
|
|
||||||
fputs_filtered (paddress (gdbarch, ps->textlow), gdb_stdout);
|
|
||||||
printf_filtered (" - ");
|
|
||||||
fputs_filtered (paddress (gdbarch, ps->texthigh), gdb_stdout);
|
|
||||||
printf_filtered ("\n");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (ps->texthigh == 0)
|
|
||||||
continue;
|
|
||||||
if (ps->textlow < BLOCK_START (b) || ps->texthigh > BLOCK_END (b))
|
|
||||||
{
|
|
||||||
printf_filtered ("Psymtab ");
|
|
||||||
puts_filtered (ps->filename);
|
|
||||||
printf_filtered (" covers ");
|
|
||||||
fputs_filtered (paddress (gdbarch, ps->textlow), gdb_stdout);
|
|
||||||
printf_filtered (" - ");
|
|
||||||
fputs_filtered (paddress (gdbarch, ps->texthigh), gdb_stdout);
|
|
||||||
printf_filtered (" but symtab covers only ");
|
|
||||||
fputs_filtered (paddress (gdbarch, BLOCK_START (b)), gdb_stdout);
|
|
||||||
printf_filtered (" - ");
|
|
||||||
fputs_filtered (paddress (gdbarch, BLOCK_END (b)), gdb_stdout);
|
|
||||||
printf_filtered ("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Return the nexting depth of a block within other blocks in its symtab. */
|
/* Return the nexting depth of a block within other blocks in its symtab. */
|
||||||
|
@ -1216,35 +793,6 @@ block_depth (struct block *block)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Increase the space allocated for LISTP, which is probably
|
|
||||||
global_psymbols or static_psymbols. This space will eventually
|
|
||||||
be freed in free_objfile(). */
|
|
||||||
|
|
||||||
void
|
|
||||||
extend_psymbol_list (struct psymbol_allocation_list *listp,
|
|
||||||
struct objfile *objfile)
|
|
||||||
{
|
|
||||||
int new_size;
|
|
||||||
if (listp->size == 0)
|
|
||||||
{
|
|
||||||
new_size = 255;
|
|
||||||
listp->list = (struct partial_symbol **)
|
|
||||||
xmalloc (new_size * sizeof (struct partial_symbol *));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
new_size = listp->size * 2;
|
|
||||||
listp->list = (struct partial_symbol **)
|
|
||||||
xrealloc ((char *) listp->list,
|
|
||||||
new_size * sizeof (struct partial_symbol *));
|
|
||||||
}
|
|
||||||
/* Next assumes we only went one over. Should be good if
|
|
||||||
program works correctly */
|
|
||||||
listp->next = listp->list + listp->size;
|
|
||||||
listp->size = new_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Do early runtime initializations. */
|
/* Do early runtime initializations. */
|
||||||
void
|
void
|
||||||
_initialize_symmisc (void)
|
_initialize_symmisc (void)
|
||||||
|
|
985
gdb/symtab.c
985
gdb/symtab.c
File diff suppressed because it is too large
Load diff
174
gdb/symtab.h
174
gdb/symtab.h
|
@ -630,36 +630,6 @@ struct symbol
|
||||||
#define SYMBOL_REGISTER_OPS(symbol) (symbol)->ops.ops_register
|
#define SYMBOL_REGISTER_OPS(symbol) (symbol)->ops.ops_register
|
||||||
#define SYMBOL_LOCATION_BATON(symbol) (symbol)->aux_value
|
#define SYMBOL_LOCATION_BATON(symbol) (symbol)->aux_value
|
||||||
|
|
||||||
/* A partial_symbol records the name, domain, and address class of
|
|
||||||
symbols whose types we have not parsed yet. For functions, it also
|
|
||||||
contains their memory address, so we can find them from a PC value.
|
|
||||||
Each partial_symbol sits in a partial_symtab, all of which are chained
|
|
||||||
on a partial symtab list and which points to the corresponding
|
|
||||||
normal symtab once the partial_symtab has been referenced. */
|
|
||||||
|
|
||||||
/* This structure is space critical. See space comments at the top. */
|
|
||||||
|
|
||||||
struct partial_symbol
|
|
||||||
{
|
|
||||||
|
|
||||||
/* The general symbol info required for all types of symbols. */
|
|
||||||
|
|
||||||
struct general_symbol_info ginfo;
|
|
||||||
|
|
||||||
/* Name space code. */
|
|
||||||
|
|
||||||
ENUM_BITFIELD(domain_enum_tag) domain : 6;
|
|
||||||
|
|
||||||
/* Address class (for info_symbols) */
|
|
||||||
|
|
||||||
ENUM_BITFIELD(address_class) aclass : 6;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#define PSYMBOL_DOMAIN(psymbol) (psymbol)->domain
|
|
||||||
#define PSYMBOL_CLASS(psymbol) (psymbol)->aclass
|
|
||||||
|
|
||||||
|
|
||||||
/* Each item represents a line-->pc (or the reverse) mapping. This is
|
/* Each item represents a line-->pc (or the reverse) mapping. This is
|
||||||
somewhat more wasteful of space than one might wish, but since only
|
somewhat more wasteful of space than one might wish, but since only
|
||||||
the files which are actually debugged are read in to core, we don't
|
the files which are actually debugged are read in to core, we don't
|
||||||
|
@ -826,110 +796,6 @@ struct symtab
|
||||||
#define SYMTAB_PSPACE(symtab) (symtab)->objfile->pspace
|
#define SYMTAB_PSPACE(symtab) (symtab)->objfile->pspace
|
||||||
|
|
||||||
|
|
||||||
/* Each source file that has not been fully read in is represented by
|
|
||||||
a partial_symtab. This contains the information on where in the
|
|
||||||
executable the debugging symbols for a specific file are, and a
|
|
||||||
list of names of global symbols which are located in this file.
|
|
||||||
They are all chained on partial symtab lists.
|
|
||||||
|
|
||||||
Even after the source file has been read into a symtab, the
|
|
||||||
partial_symtab remains around. They are allocated on an obstack,
|
|
||||||
objfile_obstack. FIXME, this is bad for dynamic linking or VxWorks-
|
|
||||||
style execution of a bunch of .o's. */
|
|
||||||
|
|
||||||
struct partial_symtab
|
|
||||||
{
|
|
||||||
|
|
||||||
/* Chain of all existing partial symtabs. */
|
|
||||||
|
|
||||||
struct partial_symtab *next;
|
|
||||||
|
|
||||||
/* Name of the source file which this partial_symtab defines */
|
|
||||||
|
|
||||||
char *filename;
|
|
||||||
|
|
||||||
/* Full path of the source file. NULL if not known. */
|
|
||||||
|
|
||||||
char *fullname;
|
|
||||||
|
|
||||||
/* Directory in which it was compiled, or NULL if we don't know. */
|
|
||||||
|
|
||||||
char *dirname;
|
|
||||||
|
|
||||||
/* Information about the object file from which symbols should be read. */
|
|
||||||
|
|
||||||
struct objfile *objfile;
|
|
||||||
|
|
||||||
/* Set of relocation offsets to apply to each section. */
|
|
||||||
|
|
||||||
struct section_offsets *section_offsets;
|
|
||||||
|
|
||||||
/* Range of text addresses covered by this file; texthigh is the
|
|
||||||
beginning of the next section. */
|
|
||||||
|
|
||||||
CORE_ADDR textlow;
|
|
||||||
CORE_ADDR texthigh;
|
|
||||||
|
|
||||||
/* Array of pointers to all of the partial_symtab's which this one
|
|
||||||
depends on. Since this array can only be set to previous or
|
|
||||||
the current (?) psymtab, this dependency tree is guaranteed not
|
|
||||||
to have any loops. "depends on" means that symbols must be read
|
|
||||||
for the dependencies before being read for this psymtab; this is
|
|
||||||
for type references in stabs, where if foo.c includes foo.h, declarations
|
|
||||||
in foo.h may use type numbers defined in foo.c. For other debugging
|
|
||||||
formats there may be no need to use dependencies. */
|
|
||||||
|
|
||||||
struct partial_symtab **dependencies;
|
|
||||||
|
|
||||||
int number_of_dependencies;
|
|
||||||
|
|
||||||
/* Global symbol list. This list will be sorted after readin to
|
|
||||||
improve access. Binary search will be the usual method of
|
|
||||||
finding a symbol within it. globals_offset is an integer offset
|
|
||||||
within global_psymbols[]. */
|
|
||||||
|
|
||||||
int globals_offset;
|
|
||||||
int n_global_syms;
|
|
||||||
|
|
||||||
/* Static symbol list. This list will *not* be sorted after readin;
|
|
||||||
to find a symbol in it, exhaustive search must be used. This is
|
|
||||||
reasonable because searches through this list will eventually
|
|
||||||
lead to either the read in of a files symbols for real (assumed
|
|
||||||
to take a *lot* of time; check) or an error (and we don't care
|
|
||||||
how long errors take). This is an offset and size within
|
|
||||||
static_psymbols[]. */
|
|
||||||
|
|
||||||
int statics_offset;
|
|
||||||
int n_static_syms;
|
|
||||||
|
|
||||||
/* Pointer to symtab eventually allocated for this source file, 0 if
|
|
||||||
!readin or if we haven't looked for the symtab after it was readin. */
|
|
||||||
|
|
||||||
struct symtab *symtab;
|
|
||||||
|
|
||||||
/* Pointer to function which will read in the symtab corresponding to
|
|
||||||
this psymtab. */
|
|
||||||
|
|
||||||
void (*read_symtab) (struct partial_symtab *);
|
|
||||||
|
|
||||||
/* Information that lets read_symtab() locate the part of the symbol table
|
|
||||||
that this psymtab corresponds to. This information is private to the
|
|
||||||
format-dependent symbol reading routines. For further detail examine
|
|
||||||
the various symbol reading modules. Should really be (void *) but is
|
|
||||||
(char *) as with other such gdb variables. (FIXME) */
|
|
||||||
|
|
||||||
char *read_symtab_private;
|
|
||||||
|
|
||||||
/* Non-zero if the symtab corresponding to this psymtab has been readin */
|
|
||||||
|
|
||||||
unsigned char readin;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* A fast way to get from a psymtab to its symtab (after the first time). */
|
|
||||||
#define PSYMTAB_TO_SYMTAB(pst) \
|
|
||||||
((pst) -> symtab != NULL ? (pst) -> symtab : psymtab_to_symtab (pst))
|
|
||||||
|
|
||||||
|
|
||||||
/* The virtual function table is now an array of structures which have the
|
/* The virtual function table is now an array of structures which have the
|
||||||
form { int16 offset, delta; void *pfn; }.
|
form { int16 offset, delta; void *pfn; }.
|
||||||
|
|
||||||
|
@ -1019,12 +885,6 @@ extern struct symbol *lookup_symbol_aux_block (const char *name,
|
||||||
const struct block *block,
|
const struct block *block,
|
||||||
const domain_enum domain);
|
const domain_enum domain);
|
||||||
|
|
||||||
/* Lookup a partial symbol. */
|
|
||||||
|
|
||||||
extern struct partial_symbol *lookup_partial_symbol (struct partial_symtab *,
|
|
||||||
const char *, int,
|
|
||||||
domain_enum);
|
|
||||||
|
|
||||||
/* lookup a symbol by name, within a specified block */
|
/* lookup a symbol by name, within a specified block */
|
||||||
|
|
||||||
extern struct symbol *lookup_block_symbol (const struct block *, const char *,
|
extern struct symbol *lookup_block_symbol (const struct block *, const char *,
|
||||||
|
@ -1055,19 +915,9 @@ extern int find_pc_partial_function (CORE_ADDR, char **, CORE_ADDR *,
|
||||||
|
|
||||||
extern void clear_pc_function_cache (void);
|
extern void clear_pc_function_cache (void);
|
||||||
|
|
||||||
/* from symtab.c: */
|
|
||||||
|
|
||||||
/* lookup partial symbol table by filename */
|
|
||||||
|
|
||||||
extern struct partial_symtab *lookup_partial_symtab (const char *);
|
|
||||||
|
|
||||||
/* lookup partial symbol table by address */
|
|
||||||
|
|
||||||
extern struct partial_symtab *find_pc_psymtab (CORE_ADDR);
|
|
||||||
|
|
||||||
/* lookup partial symbol table by address and section */
|
/* lookup partial symbol table by address and section */
|
||||||
|
|
||||||
extern struct partial_symtab *find_pc_sect_psymtab (CORE_ADDR,
|
extern struct symtab *find_pc_sect_symtab_via_partial (CORE_ADDR,
|
||||||
struct obj_section *);
|
struct obj_section *);
|
||||||
|
|
||||||
/* lookup full symbol table by address */
|
/* lookup full symbol table by address */
|
||||||
|
@ -1078,17 +928,6 @@ extern struct symtab *find_pc_symtab (CORE_ADDR);
|
||||||
|
|
||||||
extern struct symtab *find_pc_sect_symtab (CORE_ADDR, struct obj_section *);
|
extern struct symtab *find_pc_sect_symtab (CORE_ADDR, struct obj_section *);
|
||||||
|
|
||||||
/* lookup partial symbol by address */
|
|
||||||
|
|
||||||
extern struct partial_symbol *find_pc_psymbol (struct partial_symtab *,
|
|
||||||
CORE_ADDR);
|
|
||||||
|
|
||||||
/* lookup partial symbol by address and section */
|
|
||||||
|
|
||||||
extern struct partial_symbol *find_pc_sect_psymbol (struct partial_symtab *,
|
|
||||||
CORE_ADDR,
|
|
||||||
struct obj_section *);
|
|
||||||
|
|
||||||
extern int find_pc_line_pc_range (CORE_ADDR, CORE_ADDR *, CORE_ADDR *);
|
extern int find_pc_line_pc_range (CORE_ADDR, CORE_ADDR *, CORE_ADDR *);
|
||||||
|
|
||||||
extern void reread_symbols (void);
|
extern void reread_symbols (void);
|
||||||
|
@ -1264,8 +1103,6 @@ extern void free_symtab (struct symtab *);
|
||||||
|
|
||||||
/* Symbol-reading stuff in symfile.c and solib.c. */
|
/* Symbol-reading stuff in symfile.c and solib.c. */
|
||||||
|
|
||||||
extern struct symtab *psymtab_to_symtab (struct partial_symtab *);
|
|
||||||
|
|
||||||
extern void clear_solib (void);
|
extern void clear_solib (void);
|
||||||
|
|
||||||
/* source.c */
|
/* source.c */
|
||||||
|
@ -1291,7 +1128,7 @@ extern char **make_source_files_completion_list (char *, char *);
|
||||||
|
|
||||||
int matching_obj_sections (struct obj_section *, struct obj_section *);
|
int matching_obj_sections (struct obj_section *, struct obj_section *);
|
||||||
|
|
||||||
extern struct partial_symtab *find_main_psymtab (void);
|
extern char *find_main_filename (void);
|
||||||
|
|
||||||
extern struct symtab *find_line_symtab (struct symtab *, int, int *, int *);
|
extern struct symtab *find_line_symtab (struct symtab *, int, int *, int *);
|
||||||
|
|
||||||
|
@ -1318,10 +1155,6 @@ extern CORE_ADDR skip_prologue_using_sal (struct gdbarch *gdbarch,
|
||||||
extern struct symbol *fixup_symbol_section (struct symbol *,
|
extern struct symbol *fixup_symbol_section (struct symbol *,
|
||||||
struct objfile *);
|
struct objfile *);
|
||||||
|
|
||||||
extern struct partial_symbol *fixup_psymbol_section (struct partial_symbol
|
|
||||||
*psym,
|
|
||||||
struct objfile *objfile);
|
|
||||||
|
|
||||||
/* Symbol searching */
|
/* Symbol searching */
|
||||||
|
|
||||||
/* When using search_symbols, a list of the following structs is returned.
|
/* When using search_symbols, a list of the following structs is returned.
|
||||||
|
@ -1368,4 +1201,7 @@ struct symbol *lookup_global_symbol_from_objfile (const struct objfile *objfile,
|
||||||
extern struct symtabs_and_lines
|
extern struct symtabs_and_lines
|
||||||
expand_line_sal (struct symtab_and_line sal);
|
expand_line_sal (struct symtab_and_line sal);
|
||||||
|
|
||||||
|
void fixup_section (struct general_symbol_info *ginfo,
|
||||||
|
CORE_ADDR addr, struct objfile *objfile);
|
||||||
|
|
||||||
#endif /* !defined(SYMTAB_H) */
|
#endif /* !defined(SYMTAB_H) */
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
#include "stabsread.h"
|
#include "stabsread.h"
|
||||||
#include "expression.h"
|
#include "expression.h"
|
||||||
#include "complaints.h"
|
#include "complaints.h"
|
||||||
|
#include "psympriv.h"
|
||||||
|
|
||||||
#include "gdb-stabs.h"
|
#include "gdb-stabs.h"
|
||||||
|
|
||||||
|
@ -3036,6 +3037,7 @@ static struct sym_fns xcoff_sym_fns =
|
||||||
a file. */
|
a file. */
|
||||||
aix_process_linenos, /* sym_read_linetable */
|
aix_process_linenos, /* sym_read_linetable */
|
||||||
default_symfile_relocate, /* sym_relocate: Relocate a debug section. */
|
default_symfile_relocate, /* sym_relocate: Relocate a debug section. */
|
||||||
|
&psym_functions,
|
||||||
NULL /* next: pointer to next struct sym_fns */
|
NULL /* next: pointer to next struct sym_fns */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue