X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fmdebugread.c;h=5c4158cd6fbfabe1d1546d6ba05b7c69b5be6e54;hb=a65189c980ccd5370bc2d020220f66d1dd327190;hp=393a433792e06c027bcbdfbcdd036c25cae35faa;hpb=6f17252b76dbe8bedd32b6df6ce52af707bfb04b;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 393a433792..5c4158cd6f 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -251,10 +251,10 @@ static struct symbol *mylookup_symbol (const char *, const struct block *, static void sort_blocks (struct symtab *); -static struct partial_symtab *new_psymtab (const char *, struct objfile *); +static legacy_psymtab *new_psymtab (const char *, struct objfile *); -static void psymtab_to_symtab_1 (struct objfile *objfile, - struct partial_symtab *, const char *); +static void mdebug_expand_psymtab (legacy_psymtab *pst, + struct objfile *objfile); static void add_block (struct block *, struct symtab *); @@ -275,24 +275,15 @@ static const char *mdebug_next_symbol_text (struct objfile *); and reorders the symtab list at the end. SELF is not NULL. */ static void -mdebug_read_symtab (struct partial_symtab *self, struct objfile *objfile) +mdebug_read_symtab (legacy_psymtab *self, struct objfile *objfile) { - if (info_verbose) - { - printf_filtered (_("Reading in symbols for %s..."), self->filename); - gdb_flush (gdb_stdout); - } - next_symbol_text_func = mdebug_next_symbol_text; - psymtab_to_symtab_1 (objfile, self, self->filename); + self->expand_psymtab (objfile); /* Match with global symbols. This only needs to be done once, after all of the symtabs and dependencies have been read in. */ scan_file_globals (objfile); - - if (info_verbose) - printf_filtered (_("done.\n")); } /* File-level interface functions. */ @@ -389,7 +380,7 @@ mdebug_build_psymtabs (minimal_symbol_reader &reader, struct pst_map { - struct partial_symtab *pst; /* the psymtab proper */ + legacy_psymtab *pst; /* the psymtab proper */ long n_globals; /* exported globals (external symbols) */ long globals_offset; /* cumulative */ }; @@ -582,7 +573,7 @@ static int parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, const section_offsets §ion_offsets, struct objfile *objfile) { - struct gdbarch *gdbarch = get_objfile_arch (objfile); + struct gdbarch *gdbarch = objfile->arch (); const bfd_size_type external_sym_size = debug_swap->external_sym_size; void (*const swap_sym_in) (bfd *, void *, SYMR *) = debug_swap->swap_sym_in; const char *name; @@ -1366,7 +1357,7 @@ static const struct objfile_keyarch (); struct type **map_bt = basic_type_data.get (objfile); struct type *tp; @@ -1438,13 +1429,11 @@ basic_type (int bt, struct objfile *objfile) break; case btComplex: - tp = init_complex_type (objfile, "complex", - basic_type (btFloat, objfile)); + tp = init_complex_type ("complex", basic_type (btFloat, objfile)); break; case btDComplex: - tp = init_complex_type (objfile, "double complex", - basic_type (btFloat, objfile)); + tp = init_complex_type ("double complex", basic_type (btFloat, objfile)); break; case btFixedDec: @@ -1910,7 +1899,7 @@ upgrade_type (int fd, struct type **tpp, int tq, union aux_ext *ax, int bigend, static void parse_procedure (PDR *pr, struct compunit_symtab *search_symtab, - struct partial_symtab *pst) + legacy_psymtab *pst) { struct symbol *s, *i; const struct block *b; @@ -2294,7 +2283,7 @@ static void parse_partial_symbols (minimal_symbol_reader &reader, struct objfile *objfile) { - struct gdbarch *gdbarch = get_objfile_arch (objfile); + struct gdbarch *gdbarch = objfile->arch (); const bfd_size_type external_sym_size = debug_swap->external_sym_size; const bfd_size_type external_rfd_size = debug_swap->external_rfd_size; const bfd_size_type external_ext_size = debug_swap->external_ext_size; @@ -2310,7 +2299,7 @@ parse_partial_symbols (minimal_symbol_reader &reader, EXTR *ext_in; EXTR *ext_in_end; SYMR sh; - struct partial_symtab *pst; + legacy_psymtab *pst; int textlow_not_set = 1; /* List of current psymtab's include files. */ @@ -2320,7 +2309,7 @@ parse_partial_symbols (minimal_symbol_reader &reader, EXTR *extern_tab; struct pst_map *fdr_to_pst; /* Index within current psymtab dependency list. */ - struct partial_symtab **dependency_list; + legacy_psymtab **dependency_list; int dependencies_used, dependencies_allocated; char *name; enum language prev_language; @@ -2349,8 +2338,8 @@ parse_partial_symbols (minimal_symbol_reader &reader, dependencies_allocated = 30; dependencies_used = 0; dependency_list = - (struct partial_symtab **) alloca (dependencies_allocated * - sizeof (struct partial_symtab *)); + (legacy_psymtab **) alloca (dependencies_allocated * + sizeof (legacy_psymtab *)); set_last_source_file (NULL); @@ -2373,7 +2362,7 @@ parse_partial_symbols (minimal_symbol_reader &reader, fdr_to_pst = fdr_to_pst_holder.data (); fdr_to_pst++; { - struct partial_symtab *new_pst = new_psymtab ("", objfile); + legacy_psymtab *new_pst = new_psymtab ("", objfile); fdr_to_pst[-1].pst = new_pst; FDR_IDX (new_pst) = -1; @@ -2591,7 +2580,7 @@ parse_partial_symbols (minimal_symbol_reader &reader, /* Pass 3 over files, over local syms: fill in static symbols. */ for (f_idx = 0; f_idx < hdr->ifdMax; f_idx++) { - struct partial_symtab *save_pst; + legacy_psymtab *save_pst; EXTR *ext_ptr; CORE_ADDR textlow; @@ -2609,9 +2598,7 @@ parse_partial_symbols (minimal_symbol_reader &reader, textlow = fh->adr; else textlow = 0; - pst = start_psymtab_common (objfile, - fdr_name (fh), - textlow); + pst = new legacy_psymtab (fdr_name (fh), objfile, textlow); pst->read_symtab_private = XOBNEW (&objfile->objfile_obstack, symloc); memset (pst->read_symtab_private, 0, sizeof (struct symloc)); @@ -2623,7 +2610,8 @@ parse_partial_symbols (minimal_symbol_reader &reader, PENDING_LIST (pst) = pending_list; /* The way to turn this into a symtab is to call... */ - pst->read_symtab = mdebug_read_symtab; + pst->legacy_read_symtab = mdebug_read_symtab; + pst->legacy_expand_psymtab = mdebug_expand_psymtab; /* Set up language for the pst. The language from the FDR is used if it is unambigious (e.g. cfront @@ -2897,7 +2885,7 @@ parse_partial_symbols (minimal_symbol_reader &reader, { /* Here if prev stab wasn't N_SO. */ if (pst) { - pst = (struct partial_symtab *) 0; + pst = (legacy_psymtab *) 0; includes_used = 0; dependencies_used = 0; } @@ -3287,7 +3275,7 @@ parse_partial_symbols (minimal_symbol_reader &reader, if (pst && gdbarch_sofun_address_maybe_missing (gdbarch)) { - pst = (struct partial_symtab *) 0; + pst = (legacy_psymtab *) 0; includes_used = 0; dependencies_used = 0; } @@ -3588,9 +3576,8 @@ parse_partial_symbols (minimal_symbol_reader &reader, CORE_ADDR svalue; short section; - if (ext_ptr->ifd != f_idx) - internal_error (__FILE__, __LINE__, - _("failed internal consistency check")); + gdb_assert (ext_ptr->ifd == f_idx); + psh = &ext_ptr->asym; /* Do not add undefined symbols to the partial symbol table. */ @@ -3742,12 +3729,12 @@ parse_partial_symbols (minimal_symbol_reader &reader, /* Remove the dummy psymtab created for -O3 images above, if it is still empty, to enable the detection of stripped executables. */ - pst = objfile->partial_symtabs->psymtabs; - if (pst->next == NULL - && pst->number_of_dependencies == 0 - && pst->n_global_syms == 0 - && pst->n_static_syms == 0) - objfile->partial_symtabs->discard_psymtab (pst); + partial_symtab *pst_del = objfile->partial_symtabs->psymtabs; + if (pst_del->next == NULL + && pst_del->number_of_dependencies == 0 + && pst_del->n_global_syms == 0 + && pst_del->n_static_syms == 0) + objfile->partial_symtabs->discard_psymtab (pst_del); } /* If the current psymbol has an enumerated type, we need to add @@ -3845,8 +3832,7 @@ mdebug_next_symbol_text (struct objfile *objfile) The flow of control and even the memory allocation differs. FIXME. */ static void -psymtab_to_symtab_1 (struct objfile *objfile, - struct partial_symtab *pst, const char *filename) +mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile) { bfd_size_type external_sym_size; bfd_size_type external_pdr_size; @@ -3862,31 +3848,12 @@ psymtab_to_symtab_1 (struct objfile *objfile, if (pst->readin) return; - pst->readin = 1; + pst->readin = true; /* Read in all partial symtabs on which this one is dependent. NOTE that we do have circular dependencies, sigh. We solved that by setting pst->readin before this point. */ - - for (i = 0; i < pst->number_of_dependencies; i++) - if (!pst->dependencies[i]->readin) - { - /* Inform about additional files to be read in. */ - if (info_verbose) - { - fputs_filtered (" ", gdb_stdout); - wrap_here (""); - fputs_filtered ("and ", gdb_stdout); - wrap_here (""); - printf_filtered ("%s...", - pst->dependencies[i]->filename); - wrap_here (""); /* Flush output */ - gdb_flush (gdb_stdout); - } - /* We only pass the filename for debug purposes. */ - psymtab_to_symtab_1 (objfile, pst->dependencies[i], - pst->dependencies[i]->filename); - } + pst->expand_dependencies (objfile); /* Do nothing if this is a dummy psymtab. */ @@ -3932,7 +3899,7 @@ psymtab_to_symtab_1 (struct objfile *objfile, if (processing_gcc_compilation != 0) { - struct gdbarch *gdbarch = get_objfile_arch (objfile); + struct gdbarch *gdbarch = objfile->arch (); /* This symbol table contains stabs-in-ecoff entries. */ @@ -4657,12 +4624,12 @@ new_symtab (const char *name, int maxlines, struct objfile *objfile) /* Allocate a new partial_symtab NAME. */ -static struct partial_symtab * +static legacy_psymtab * new_psymtab (const char *name, struct objfile *objfile) { - struct partial_symtab *psymtab; + legacy_psymtab *psymtab; - psymtab = allocate_psymtab (name, objfile); + psymtab = new legacy_psymtab (name, objfile); /* Keep a backpointer to the file's symbols. */ @@ -4674,7 +4641,8 @@ new_psymtab (const char *name, struct objfile *objfile) PENDING_LIST (psymtab) = pending_list; /* The way to turn this into a symtab is to call... */ - psymtab->read_symtab = mdebug_read_symtab; + psymtab->legacy_read_symtab = mdebug_read_symtab; + psymtab->legacy_expand_psymtab = mdebug_expand_psymtab; return (psymtab); }