diff options
author | John Gilmore <gnu@cygnus> | 1992-02-22 08:17:01 +0000 |
---|---|---|
committer | John Gilmore <gnu@cygnus> | 1992-02-22 08:17:01 +0000 |
commit | 021959e249f6aaddc39b5c61f692cd9155e33f52 (patch) | |
tree | 0b96c8808917805c20bbca995a14dc4140b4110f | |
parent | f48e5efef7dfd67534c651172172f3ddb2b46e4d (diff) | |
download | gdb-021959e249f6aaddc39b5c61f692cd9155e33f52.zip gdb-021959e249f6aaddc39b5c61f692cd9155e33f52.tar.gz gdb-021959e249f6aaddc39b5c61f692cd9155e33f52.tar.bz2 |
* xm-sun3os4.h, xm-sun4os4.h: Enable HAVE_MMAP.
* minsyms.c (install_minimal_symbols): Add bunches to any
existing minsyms in the objfile. Avoid extra mallocation
by working directly in the obstack. Remove ignored `mainline' parm.
* coffread.c, dbxread.c, elfread.c, mipsread.c, solib.c, symtab.h,
xcoffread.c: Change all callers.
* FIXME: We should be able to eliminate MAINLINE from all the
symbol readers now, with a small bit of work.
* valops.c, value.h: Lint.
* remote-vx.c: Add missing break; statement. Bugfix by
Michael Sclafani, <sclafani@src.dec.com>.
-rw-r--r-- | gdb/ChangeLog | 107 | ||||
-rw-r--r-- | gdb/dbxread.c | 342 | ||||
-rw-r--r-- | gdb/elfread.c | 2 | ||||
-rw-r--r-- | gdb/minsyms.c | 108 | ||||
-rw-r--r-- | gdb/mipsread.c | 229 | ||||
-rw-r--r-- | gdb/remote-vx.c | 1 | ||||
-rw-r--r-- | gdb/xcoffread.c | 2 | ||||
-rw-r--r-- | gdb/xm-sun3os4.h | 4 | ||||
-rw-r--r-- | gdb/xm-sun4os4.h | 4 |
9 files changed, 452 insertions, 347 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 536e271..cef8f8b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,110 @@ +Sat Feb 22 00:08:50 1992 John Gilmore (gnu at cygnus.com) + + * xm-sun3os4.h, xm-sun4os4.h: Enable HAVE_MMAP. + + * minsyms.c (install_minimal_symbols): Add bunches to any + existing minsyms in the objfile. Avoid extra mallocation + by working directly in the obstack. Remove ignored `mainline' parm. + * coffread.c, dbxread.c, elfread.c, mipsread.c, solib.c, symtab.h, + xcoffread.c: Change all callers. + * FIXME: We should be able to eliminate MAINLINE from all the + symbol readers now, with a small bit of work. + + * valops.c, value.h: Lint. + * remote-vx.c: Add missing break; statement. Bugfix by + Michael Sclafani, <sclafani@src.dec.com>. + +Fri Feb 21 17:29:54 1992 John Gilmore (gnu at cygnus.com) + + * Check in Fred Fish's changes in these modules. Fred + will make ChangeLog entries for all of them. + + * Makefile.in + * altos-xdep.c + * am29k-tdep.c + * arm-xdep.c + * blockframe.c + * breakpoint.c + * breakpoint.h + * buildsym.c + * buildsym.h + * c-exp.y + * coffread.c + * command.c + * command.h + * convex-xdep.c + * copying.c + * coredep.c + * cplus-dem.c + * dbxread.c + * dwarfread.c + * elfread.c + * eval.c + * expprint.c + * findvar.c + * gdbtypes.h + * gmalloc.c + * gmalloc.h + * gould-xdep.c + * hp300ux-xdep.c + * i386-stub.c + * i386-tdep.c + * i386-xdep.c + * i387-tdep.c + * i960-tdep.c + * infcmd.c + * inflow.c + * infptrace.c + * language.c + * m2-exp.y + * m68k-pinsn.c + * m68k-stub.c + * m88k-pinsn.c + * m88k-xdep.c + * mach386-xdep.c + * main.c + * mcheck.c + * mem-break.c + * mips-xdep.c + * mipsread.c + * nindy-tdep.c + * parse.c + * parser-defs.h + * partial-stab.h + * printcmd.c + * procfs.c + * pyr-xdep.c + * remote-mm.c + * remote-nindy.c + * remote-vx.c + * rs6000-xdep.c + * solib.c + * source.c + * stack.c + * symfile.c + * symfile.h + * symm-tdep.c + * symmisc.c + * symtab.c + * symtab.h + * target.c + * target.h + * tm-sunos.h + * utils.c + * valarith.c + * valops.c + * valprint.c + * values.c + * xcoffexec.c + * xcoffread.c + * gdbtypes.c + * minsyms.c + * mmap-alloc.c + * mmap-sbrk.c + * objfiles.c + * state.c + * state.h + Thu Feb 20 18:10:17 1992 Fred Fish (fnf at cygnus.com) * tm-sparc.h, tm-sysv4.h, solib.h: Move shared lib definitions diff --git a/gdb/dbxread.c b/gdb/dbxread.c index cc89708..5e002df 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -44,7 +44,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <obstack.h> #include <sys/param.h> +#ifndef NO_SYS_FILE #include <sys/file.h> +#endif #include <sys/stat.h> #include <ctype.h> #include "symtab.h" @@ -91,20 +93,6 @@ struct symloc { int ldsymlen; }; -extern void qsort (); -extern double atof (); - -/* Forward declarations */ - -static void read_dbx_symtab (); -static void init_psymbol_list (); -extern void process_one_symbol (); -void start_subfile (); -int hashname (); -static struct pending *copy_pending (); -static struct symtab *read_ofile_symtab (); -static void dbx_psymtab_to_symtab (); - /* Macro to determine which symbols to ignore when reading the first symbol of a file. Some machines override this definition. */ #ifndef IGNORE_SYMBOL @@ -192,10 +180,74 @@ struct header_file_location static struct header_file_location *bincl_list, *next_bincl; static int bincls_allocated; +/* Local function prototypes */ + +static void +free_and_init_header_files PARAMS ((void)); + +static struct pending * +copy_pending PARAMS ((struct pending *, int, struct pending *)); + +static struct symtab * +read_ofile_symtab PARAMS ((struct objfile *, char *, unsigned int, int, int, + CORE_ADDR, int, int)); + +static void +dbx_psymtab_to_symtab PARAMS ((struct partial_symtab *)); + +static void +psymtab_to_symtab_1 PARAMS ((struct partial_symtab *, char *, int, int)); + +static void +read_dbx_symtab PARAMS ((CORE_ADDR, struct objfile *, char *, long, int, + CORE_ADDR, int)); + +static void +free_bincl_list PARAMS ((struct objfile *)); + +static struct partial_symtab * +find_corresponding_bincl_psymtab PARAMS ((char *, int)); + +static void +add_bincl_to_list PARAMS ((struct partial_symtab *, char *, int)); + +static void +init_bincl_list PARAMS ((int, struct objfile *)); + +static void +init_psymbol_list PARAMS ((int, struct objfile *)); + +static char * +dbx_next_symbol_text PARAMS ((void)); + +static void +fill_symbuf PARAMS ((bfd *)); + +static void +dbx_symfile_init PARAMS ((struct sym_fns *)); + +static void +dbx_new_init PARAMS ((void)); + +static void +dbx_symfile_read PARAMS ((struct sym_fns *, CORE_ADDR, int)); + +static void +record_minimal_symbol PARAMS ((char *, CORE_ADDR, int, struct objfile *)); + +static void +add_new_header_file PARAMS ((char *, int)); + +static void +add_old_header_file PARAMS ((char *, int)); + +static void +add_this_object_header_file PARAMS ((int)); + /* Free up old header file tables, and allocate new ones. We're reading a new symbol file now. */ -void +static void free_and_init_header_files () { register int i; @@ -214,17 +266,6 @@ free_and_init_header_files () this_object_header_files = (int *) xmalloc (10 * sizeof (int)); } -/* Called at the start of each object file's symbols. - Clear out the mapping of header file numbers to header files. */ - -void -new_object_header_files () -{ - /* Leave FILENUM of 0 free for builtin types and this file's types. */ - n_this_object_header_files = 1; - header_file_prev_index = -1; -} - /* Add header file number I for this object file at the next successive FILENUM. */ @@ -236,7 +277,7 @@ add_this_object_header_file (i) { n_allocated_this_object_header_files *= 2; this_object_header_files - = (int *) xrealloc (this_object_header_files, + = (int *) xrealloc ((char *) this_object_header_files, n_allocated_this_object_header_files * sizeof (int)); } @@ -291,9 +332,8 @@ add_new_header_file (name, instance) { n_allocated_header_files *= 2; header_files = (struct header_file *) - xrealloc (header_files, - (n_allocated_header_files - * sizeof (struct header_file))); + xrealloc ((char *) header_files, + (n_allocated_header_files * sizeof (struct header_file))); } /* Create an entry for this header file. */ @@ -329,26 +369,27 @@ explicit_lookup_type (real_filenum, index) #endif static void -record_misc_function (name, address, type) +record_minimal_symbol (name, address, type, objfile) char *name; CORE_ADDR address; int type; + struct objfile *objfile; { - enum misc_function_type misc_type; + enum minimal_symbol_type ms_type; switch (type &~ N_EXT) { - case N_TEXT: misc_type = mf_text; break; - case N_DATA: misc_type = mf_data; break; - case N_BSS: misc_type = mf_bss; break; - case N_ABS: misc_type = mf_abs; break; + case N_TEXT: ms_type = mst_text; break; + case N_DATA: ms_type = mst_data; break; + case N_BSS: ms_type = mst_bss; break; + case N_ABS: ms_type = mst_abs; break; #ifdef N_SETV - case N_SETV: misc_type = mf_data; break; + case N_SETV: ms_type = mst_data; break; #endif - default: misc_type = mf_unknown; break; + default: ms_type = mst_unknown; break; } - prim_record_misc_function (obsavestring (name, strlen (name)), - address, misc_type); + prim_record_minimal_symbol (obsavestring (name, strlen (name), &objfile -> symbol_obstack), + address, ms_type); } /* Scan and build partial symbols for a symbol file. @@ -383,8 +424,8 @@ dbx_symfile_read (sf, addr, mainline) } /* If we are reinitializing, or if we have never loaded syms yet, init */ - if (mainline || global_psymbols.size == 0 || static_psymbols.size == 0) - init_psymbol_list (info->symcount); + if (mainline || sf->objfile->global_psymbols.size == 0 || sf->objfile->static_psymbols.size == 0) + init_psymbol_list (info->symcount, sf->objfile); /* FIXME POKING INSIDE BFD DATA STRUCTURES */ symbol_size = obj_symbol_entry_size (sym_bfd); @@ -392,8 +433,8 @@ dbx_symfile_read (sf, addr, mainline) pending_blocks = 0; make_cleanup (really_free_pendings, 0); - init_misc_bunches (); - make_cleanup (discard_misc_bunches, 0); + init_minimal_symbol_collection (); + make_cleanup (discard_minimal_symbols, 0); /* Now that the symbol table data of the executable file are all in core, process them and define symbols accordingly. */ @@ -404,19 +445,20 @@ dbx_symfile_read (sf, addr, mainline) bfd_section_vma (sym_bfd, info->text_sect), bfd_section_size (sym_bfd, info->text_sect)); - /* Go over the misc symbol bunches and install them in vector. */ + /* Install any minimal symbols that have been collected as the current + minimal symbols for this objfile. */ - condense_misc_bunches (!mainline); + install_minimal_symbols (sf -> objfile); /* Free up any memory we allocated for ourselves. */ if (!mainline) { - free (info->stringtab); /* Stringtab is only saved for mainline */ + (*sf->objfile->free) (info->stringtab); /* Stringtab is only saved for mainline */ } - free (info); - sf->sym_private = 0; /* Zap pointer to our (now gone) info struct */ + (*sf->objfile->free) (info); + sf->sym_private = NULL; /* Zap pointer to our (now gone) info struct */ - if (!partial_symtab_list) { + if (!have_partial_symbols ()) { wrap_here (""); printf_filtered ("(no debugging symbols found)..."); wrap_here (""); @@ -468,7 +510,7 @@ dbx_symfile_init (sf) unsigned char size_temp[4]; /* Allocate struct to keep track of the symfile */ - sf->sym_private = xmalloc (sizeof (*info)); + sf->sym_private = (*sf->objfile->xmalloc) (sizeof (*info)); info = (struct dbx_symfile_info *)sf->sym_private; /* FIXME POKING INSIDE BFD DATA STRUCTURES */ @@ -493,7 +535,8 @@ dbx_symfile_init (sf) if (info->stringtab_size >= 0) { - info->stringtab = (char *) xmalloc (info->stringtab_size); + /* Yes, this should be malloc, not xmalloc. We check its result. */ + info->stringtab = (char *) (*sf->objfile->malloc) (info->stringtab_size); /* Caller is responsible for freeing the string table. No cleanup. */ } else @@ -565,7 +608,7 @@ fill_symbuf (sym_bfd) (a \ at the end of the text of a name) call this function to get the continuation. */ -char * +static char * dbx_next_symbol_text () { if (symbuf_idx == symbuf_end) @@ -579,36 +622,38 @@ dbx_next_symbol_text () created by read_dbx_symtab and subsidiaries. */ static void -init_psymbol_list (total_symbols) +init_psymbol_list (total_symbols, objfile) int total_symbols; + struct objfile *objfile; { /* Free any previously allocated psymbol lists. */ - if (global_psymbols.list) - free (global_psymbols.list); - if (static_psymbols.list) - free (static_psymbols.list); + if (objfile -> global_psymbols.list) + (*objfile -> free) (objfile -> global_psymbols.list); + if (objfile -> static_psymbols.list) + (*objfile -> free) (objfile -> static_psymbols.list); /* Current best guess is that there are approximately a twentieth of the total symbols (in a debugging file) are global or static oriented symbols */ - global_psymbols.size = total_symbols / 10; - static_psymbols.size = total_symbols / 10; - global_psymbols.next = global_psymbols.list = (struct partial_symbol *) - xmalloc (global_psymbols.size * sizeof (struct partial_symbol)); - static_psymbols.next = static_psymbols.list = (struct partial_symbol *) - xmalloc (static_psymbols.size * sizeof (struct partial_symbol)); + objfile -> global_psymbols.size = total_symbols / 10; + objfile -> static_psymbols.size = total_symbols / 10; + objfile -> global_psymbols.next = objfile -> global_psymbols.list = (struct partial_symbol *) + (*objfile -> xmalloc) (objfile -> global_psymbols.size * sizeof (struct partial_symbol)); + objfile -> static_psymbols.next = objfile -> static_psymbols.list = (struct partial_symbol *) + (*objfile -> xmalloc) (objfile -> static_psymbols.size * sizeof (struct partial_symbol)); } /* Initialize the list of bincls to contain none and have some allocated. */ static void -init_bincl_list (number) +init_bincl_list (number, objfile) int number; + struct objfile *objfile; { bincls_allocated = number; next_bincl = bincl_list = (struct header_file_location *) - xmalloc (bincls_allocated * sizeof(struct header_file_location)); + (*objfile -> xmalloc) (bincls_allocated * sizeof(struct header_file_location)); } /* Add a bincl to the list. */ @@ -624,7 +669,7 @@ add_bincl_to_list (pst, name, instance) int offset = next_bincl - bincl_list; bincls_allocated *= 2; bincl_list = (struct header_file_location *) - xrealloc ((char *)bincl_list, + (*pst->objfile->xrealloc) ((char *)bincl_list, bincls_allocated * sizeof (struct header_file_location)); next_bincl = bincl_list + offset; } @@ -655,9 +700,10 @@ find_corresponding_bincl_psymtab (name, instance) /* Free the storage allocated for the bincl list. */ static void -free_bincl_list () +free_bincl_list (objfile) + struct objfile *objfile; { - free (bincl_list); + (*objfile -> free) (bincl_list); bincls_allocated = 0; } @@ -721,8 +767,8 @@ read_dbx_symtab (addr, objfile, stringtab, stringtab_size, nlistlen, old_chain = make_cleanup (free_objfile, objfile); /* Init bincl list */ - init_bincl_list (20); - make_cleanup (free_bincl_list, 0); + init_bincl_list (20, objfile); + make_cleanup (free_bincl_list, objfile); last_source_file = 0; @@ -769,7 +815,7 @@ read_dbx_symtab (addr, objfile, stringtab, stringtab_size, nlistlen, rather than abort the symbol reading or flood the user with messages. */ #define SET_NAMESTRING()\ if (((unsigned)bufp->n_strx) >= stringtab_size) { \ - complain (&string_table_offset_complaint, symnum); \ + complain (&string_table_offset_complaint, (char *) symnum); \ namestring = "foo"; \ } else \ namestring = bufp->n_strx + stringtab @@ -801,7 +847,7 @@ read_dbx_symtab (addr, objfile, stringtab, stringtab_size, nlistlen, dependency_list, dependencies_used); } - free_bincl_list (); + free_bincl_list (objfile); discard_cleanups (old_chain); } @@ -825,55 +871,17 @@ start_psymtab (objfile, addr, struct partial_symbol *static_syms; { struct partial_symtab *result = - (struct partial_symtab *) obstack_alloc (psymbol_obstack, - sizeof (struct partial_symtab)); - - result->addr = addr; - - result->filename = - (char *) obstack_alloc (psymbol_obstack, - strlen (filename) + 1); - strcpy (result->filename, filename); + start_psymtab_common(objfile, addr, + filename, textlow, global_syms, static_syms); - result->textlow = textlow; - result->read_symtab_private = (char *) obstack_alloc (psymbol_obstack, - sizeof (struct symloc)); - if (ldsymoff != -1) - LDSYMOFF(result) = ldsymoff; - - result->readin = 0; - result->symtab = 0; + result->read_symtab_private = (char *) + obstack_alloc (&objfile -> psymbol_obstack, sizeof (struct symloc)); + LDSYMOFF(result) = ldsymoff; result->read_symtab = dbx_psymtab_to_symtab; - result->globals_offset = global_syms - global_psymbols.list; - result->statics_offset = static_syms - static_psymbols.list; - - result->n_global_syms = 0; - result->n_static_syms = 0; - - /* Chain it to the list owned by the current object file. */ - result->objfile = objfile; - result->objfile_chain = objfile->psymtabs; - objfile->psymtabs = result; - return result; } -static int -compare_psymbols (s1, s2) - register struct partial_symbol *s1, *s2; -{ - register char - *st1 = SYMBOL_NAME (s1), - *st2 = SYMBOL_NAME (s2); - - if (st1[0] - st2[0]) - return st1[0] - st2[0]; - if (st1[1] - st2[1]) - return st1[1] - st2[1]; - return strcmp (st1 + 2, st2 + 2); -} - /* Close off the current usage of a partial_symbol table entry. This involves setting the correct number of includes (with a realloc), setting the high text mark, setting the symbol length in the @@ -885,6 +893,7 @@ compare_psymbols (s1, s2) Then the partial symtab is put on the global list. *** List variables and peculiarities of same. *** */ + void end_psymtab (pst, include_list, num_includes, capping_symbol_offset, capping_text, dependency_list, number_dependencies) @@ -898,21 +907,22 @@ end_psymtab (pst, include_list, num_includes, capping_symbol_offset, /* struct partial_symbol *capping_global, *capping_static;*/ { int i; + struct objfile *objfile = pst -> objfile; if (capping_symbol_offset != -1) LDSYMLEN(pst) = capping_symbol_offset - LDSYMOFF(pst); pst->texthigh = capping_text; pst->n_global_syms = - global_psymbols.next - (global_psymbols.list + pst->globals_offset); + objfile->global_psymbols.next - (objfile->global_psymbols.list + pst->globals_offset); pst->n_static_syms = - static_psymbols.next - (static_psymbols.list + pst->statics_offset); + objfile->static_psymbols.next - (objfile->static_psymbols.list + pst->statics_offset); pst->number_of_dependencies = number_dependencies; if (number_dependencies) { pst->dependencies = (struct partial_symtab **) - obstack_alloc (psymbol_obstack, + obstack_alloc (&objfile->psymbol_obstack, number_dependencies * sizeof (struct partial_symtab *)); memcpy (pst->dependencies, dependency_list, number_dependencies * sizeof (struct partial_symtab *)); @@ -923,23 +933,12 @@ end_psymtab (pst, include_list, num_includes, capping_symbol_offset, for (i = 0; i < num_includes; i++) { struct partial_symtab *subpst = - (struct partial_symtab *) - obstack_alloc (psymbol_obstack, - sizeof (struct partial_symtab)); - - subpst->filename = - (char *) obstack_alloc (psymbol_obstack, - strlen (include_list[i]) + 1); - strcpy (subpst->filename, include_list[i]); - - /* Chain it to the list that this object file owns. */ - subpst->objfile = pst->objfile; - subpst->objfile_chain = pst->objfile->psymtabs; - pst->objfile->psymtabs = subpst; + allocate_psymtab (include_list[i], objfile); subpst->addr = pst->addr; - subpst->read_symtab_private = (char *) obstack_alloc (psymbol_obstack, - sizeof (struct symloc)); + subpst->read_symtab_private = + (char *) obstack_alloc (&objfile->psymbol_obstack, + sizeof (struct symloc)); LDSYMOFF(subpst) = LDSYMLEN(subpst) = subpst->textlow = @@ -948,7 +947,7 @@ end_psymtab (pst, include_list, num_includes, capping_symbol_offset, /* We could save slight bits of space by only making one of these, shared by the entire set of include files. FIXME-someday. */ subpst->dependencies = (struct partial_symtab **) - obstack_alloc (psymbol_obstack, + obstack_alloc (&objfile->psymbol_obstack, sizeof (struct partial_symtab *)); subpst->dependencies[0] = pst; subpst->number_of_dependencies = 1; @@ -961,14 +960,9 @@ end_psymtab (pst, include_list, num_includes, capping_symbol_offset, subpst->readin = 0; subpst->symtab = 0; subpst->read_symtab = dbx_psymtab_to_symtab; - - subpst->next = partial_symtab_list; - partial_symtab_list = subpst; } - /* Sort the global list; don't sort the static list */ - qsort (global_psymbols.list + pst->globals_offset, pst->n_global_syms, - sizeof (struct partial_symbol), compare_psymbols); + sort_pst_symbols (pst); /* If there is already a psymtab or symtab for a file of this name, remove it. (If there is a symtab, more drastic things also happen.) @@ -982,10 +976,6 @@ end_psymtab (pst, include_list, num_includes, capping_symbol_offset, /* Throw away this psymtab, it's empty. We can't deallocate it, since it is on the obstack, but we can forget to chain it on the list. */ ; - } else { - /* Put the psymtab on the psymtab list */ - pst->next = partial_symtab_list; - partial_symtab_list = pst; } } @@ -1110,8 +1100,8 @@ dbx_psymtab_to_symtab (pst) #endif { #ifdef BROKEN_LARGE_ALLOCA - stringtab = (char *) xmalloc (stsize); - make_cleanup (free, stringtab); + stringtab = (char *) (*pst->objfile->xmalloc) (stsize); + make_cleanup (pst->objfile->free, stringtab); #else stringtab = (char *) alloca (stsize); #endif @@ -1148,7 +1138,7 @@ dbx_psymtab_to_symtab (pst) /* 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 (); + scan_file_globals (pst->objfile); /* Finish up the debug error message. */ if (info_verbose) @@ -1189,6 +1179,7 @@ read_ofile_symtab (objfile, stringtab, stringtab_size, sym_offset, unsigned max_symnum; register bfd *abfd; + current_objfile = objfile; subfile_stack = 0; stringtab_global = stringtab; @@ -1288,30 +1279,8 @@ read_ofile_symtab (objfile, stringtab, stringtab_size, sym_offset, } } - return end_symtab (text_offset + text_size, 0, 0, objfile); -} - -int -hashname (name) - char *name; -{ - register char *p = name; - register int total = p[0]; - register int c; - - c = p[1]; - total += c << 2; - if (c) - { - c = p[2]; - total += c << 4; - if (c) - total += p[3] << 6; - } - - /* Ensure result is positive. */ - if (total < 0) total += (1000 << 6); - return total % HASHSIZE; + current_objfile = NULL; + return (end_symtab (text_offset + text_size, 0, 0, objfile)); } /* This handles a single symbol from the symbol-file, building symbols @@ -1386,7 +1355,7 @@ process_one_symbol (type, desc, valu, name, offset) if (!colon_pos++ || (*colon_pos != 'f' && *colon_pos != 'F')) { - define_symbol (valu, name, desc, type); + define_symbol (valu, name, desc, type, our_objfile); break; } @@ -1400,19 +1369,19 @@ process_one_symbol (type, desc, valu, name, offset) new = pop_context (); /* Make a block for the local symbols within. */ finish_block (new->name, &local_symbols, new->old_blocks, - new->start_addr, valu); + new->start_addr, valu, our_objfile); } /* Stack must be empty now. */ if (context_stack_depth != 0) - complain (&lbrac_unmatched_complaint, symnum); + complain (&lbrac_unmatched_complaint, (char *) symnum); new = push_context (0, valu); - new->name = define_symbol (valu, name, desc, type); + new->name = define_symbol (valu, name, desc, type, our_objfile); break; case N_CATCH: /* Record the address at which this catch takes place. */ - define_symbol (valu+offset, name, desc, type); + define_symbol (valu+offset, name, desc, type, our_objfile); break; case N_LBRAC: @@ -1451,7 +1420,7 @@ process_one_symbol (type, desc, valu, name, offset) new = pop_context(); if (desc != new->depth) - complain (&lbrac_mismatch_complaint, symnum); + complain (&lbrac_mismatch_complaint, (char *) symnum); /* Some compilers put the variable decls inside of an LBRAC/RBRAC block. This macro should be nonzero if this @@ -1488,7 +1457,7 @@ process_one_symbol (type, desc, valu, name, offset) } /* Make a block for the local symbols within. */ finish_block (0, &local_symbols, new->old_blocks, - new->start_addr, valu); + new->start_addr, valu, our_objfile); } else { @@ -1536,10 +1505,12 @@ process_one_symbol (type, desc, valu, name, offset) && current_subfile->name[strlen(current_subfile->name)-1] == '/') { current_subfile->dirname = current_subfile->name; - current_subfile->name = obsavestring (name, strlen (name)); + current_subfile->name = + obsavestring (name, strlen (name), + &our_objfile -> symbol_obstack); break; } - (void)end_symtab (valu, 0, 0); + (void) end_symtab (valu, 0, 0, our_objfile); } start_symtab (name, NULL, valu); break; @@ -1596,7 +1567,7 @@ process_one_symbol (type, desc, valu, name, offset) { int i; struct symbol *sym = - (struct symbol *) xmalloc (sizeof (struct symbol)); + (struct symbol *) (*our_objfile -> xmalloc) (sizeof (struct symbol)); bzero (sym, sizeof *sym); SYMBOL_NAME (sym) = savestring (name, strlen (name)); SYMBOL_CLASS (sym) = LOC_BLOCK; @@ -1632,7 +1603,7 @@ process_one_symbol (type, desc, valu, name, offset) case N_PSYM: /* Parameter variable */ case N_LENG: /* Length of preceding symbol type */ if (name) - define_symbol (valu, name, desc, type); + define_symbol (valu, name, desc, type, our_objfile); break; /* The following symbol types we don't know how to process. Handle @@ -1652,7 +1623,7 @@ process_one_symbol (type, desc, valu, name, offset) case N_NBLCS: complain (&unknown_symtype_complaint, local_hex_string(type)); if (name) - define_symbol (valu, name, desc, type); + define_symbol (valu, name, desc, type, our_objfile); } previous_stab_code = type; @@ -1662,8 +1633,9 @@ process_one_symbol (type, desc, valu, name, offset) block for later fixup. */ static struct pending * copy_pending (beg, begi, end) - struct pending *beg, *end; + struct pending *beg; int begi; + struct pending *end; { struct pending *new = 0; struct pending *next; diff --git a/gdb/elfread.c b/gdb/elfread.c index f1d7f49..8b72f80 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -313,7 +313,7 @@ elf_symfile_read (sf, addr, mainline) /* Install any minimal symbols that have been collected as the current minimal symbols for this objfile. */ - install_minimal_symbols (!mainline, sf -> objfile); + install_minimal_symbols (sf -> objfile); do_cleanups (back_to); } diff --git a/gdb/minsyms.c b/gdb/minsyms.c index 3040bf5..974596e 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -323,7 +323,10 @@ discard_minimal_symbols (foo) /* Compact duplicate entries out of a minimal symbol table by walking through the table and compacting out entries with duplicate addresses - and matching names. + and matching names. Return the number of entries remaining. + + On entry, the table resides between msymbol[0] and msymbol[mcount]. + On exit, it resides between msymbol[0] and msymbol[result_count]. When files contain multiple sources of symbol information, it is possible for the minimal symbol table to contain many duplicate entries. @@ -336,17 +339,14 @@ discard_minimal_symbols (foo) over a 1000 duplicates, about a third of the total table size. Aside from the potential trap of not noticing that two successive entries identify the same location, this duplication impacts the time required - to linearly scan the table, which is done in a number of places. So + to linearly scan the table, which is done in a number of places. So we just do one linear scan here and toss out the duplicates. Note that we are not concerned here about recovering the space that is potentially freed up, because the strings themselves are allocated on the symbol_obstack, and will get automatically freed when the symbol - table is freed. Also, the unused minimal symbols at the end of the - compacted region will get freed automatically as well by whomever - is responsible for deallocating the entire minimal symbol table. We - can't diddle with the pointer anywhy, so don't worry about the - wasted space. + table is freed. The caller can free up the unused minimal symbols at + the end of the compacted region if their allocation strategy allows it. Also note we only go up to the next to last entry within the loop and then copy the last entry explicitly after the loop terminates. @@ -390,21 +390,14 @@ compact_minimal_symbols (msymbol, mcount) return (mcount); } -/* INCLINK nonzero means bunches are from an incrementally-linked file. - Add them to the existing bunches. - Otherwise INCLINK is zero, and we start from scratch. - - FIXME: INCLINK is currently unused, and is a holdover from when all - these symbols were stored in a shared, globally available table. If - it turns out we still need to be able to incrementally add minimal - symbols to an existing minimal symbol table for a given objfile, then - we will need to slightly modify this code so that when INCLINK is - nonzero we copy the existing table to a work area that is allocated - large enough for all the symbols and add the new ones to the end. */ +/* Add the minimal symbols in the existing bunches to the objfile's + official minimal symbol table. 99% of the time, this adds the + bunches to NO existing symbols. Once in a while for shared + libraries, we add symbols (e.g. common symbols) to an existing + objfile. */ void -install_minimal_symbols (inclink, objfile) - int inclink; +install_minimal_symbols (objfile) struct objfile *objfile; { register int bindex; @@ -412,24 +405,35 @@ install_minimal_symbols (inclink, objfile) register struct msym_bunch *bunch; register struct minimal_symbol *msymbols; int nbytes; + int alloc_count; if (msym_count > 0) { - /* Allocate a temporary work area into which we will gather the - bunches of minimal symbols, sort them, and then compact out - duplicate entries. Once we have a final table, it will be attached - to the specified objfile. */ - + /* Allocate enough space in the obstack, into which we will gather the + bunches of new and existing minimal symbols, sort them, and then + compact out the duplicate entries. Once we have a final table, + we will give back the excess space. */ + + alloc_count = msym_count + objfile->minimal_symbol_count + 1; + obstack_blank (&objfile->symbol_obstack, + alloc_count * sizeof (struct minimal_symbol)); msymbols = (struct minimal_symbol *) - xmalloc (msym_count * sizeof (struct minimal_symbol)); - mcount = 0; - + obstack_base (&objfile->symbol_obstack); + + /* Copy in the existing minimal symbols, if there are any. */ + + if (objfile->minimal_symbol_count) + memcpy ((char *)msymbols, (char *)objfile->msymbols, + objfile->minimal_symbol_count * sizeof (struct minimal_symbol)); + /* Walk through the list of minimal symbol bunches, adding each symbol to the new contiguous array of symbols. Note that we start with the current, possibly partially filled bunch (thus we use the current msym_bunch_index for the first bunch we copy over), and thereafter each bunch is full. */ + mcount = objfile->minimal_symbol_count; + for (bunch = msym_bunch; bunch != NULL; bunch = bunch -> next) { for (bindex = 0; bindex < msym_bunch_index; bindex++, mcount++) @@ -450,42 +454,42 @@ install_minimal_symbols (inclink, objfile) } msym_bunch_index = BUNCH_SIZE; } - + /* Sort the minimal symbols by address. */ qsort (msymbols, mcount, sizeof (struct minimal_symbol), compare_minimal_symbols); - /* Compact out any duplicates. The table is reallocated to a - smaller size, even though it is unnecessary here, as we are just - going to move everything to an obstack anyway. */ + /* Compact out any duplicates, and free up whatever space we are + no longer using. */ mcount = compact_minimal_symbols (msymbols, mcount); - - /* Attach the minimal symbol table to the specified objfile, allocating - the table entries in the symbol_obstack. Note that the strings them- - selves are already located in the symbol_obstack. We also terminate - the minimal symbol table with a "null symbol", which is *not* included - in the size of the table. This makes it easier to find the end of - the table when we are handed a pointer to some symbol in the middle - of it. */ - - objfile -> minimal_symbol_count = mcount; - nbytes = (mcount + 1) * sizeof (struct minimal_symbol); - objfile -> msymbols = (struct minimal_symbol *) - obstack_alloc (&objfile -> symbol_obstack, nbytes); - memcpy (objfile -> msymbols, msymbols, nbytes); - free (msymbols); - /* Zero out the fields in the "null symbol" allocated at the end + obstack_blank (&objfile->symbol_obstack, + (mcount + 1 - alloc_count) * sizeof (struct minimal_symbol)); + msymbols = (struct minimal_symbol *) + obstack_finish (&objfile->symbol_obstack); + + /* We also terminate the minimal symbol table + with a "null symbol", which is *not* included in the size of + the table. This makes it easier to find the end of the table + when we are handed a pointer to some symbol in the middle of it. + Zero out the fields in the "null symbol" allocated at the end of the array. Note that the symbol count does *not* include this null symbol, which is why it is indexed by mcount and not mcount-1. */ - objfile -> msymbols[mcount].name = NULL; - objfile -> msymbols[mcount].address = 0; - objfile -> msymbols[mcount].info = NULL; - objfile -> msymbols[mcount].type = mst_unknown; + msymbols[mcount].name = NULL; + msymbols[mcount].address = 0; + msymbols[mcount].info = NULL; + msymbols[mcount].type = mst_unknown; + + /* Attach the minimal symbol table to the specified objfile. + The strings themselves are also located in the symbol_obstack + of this objfile. */ + + objfile -> minimal_symbol_count = mcount; + objfile -> msymbols = msymbols; } } diff --git a/gdb/mipsread.c b/gdb/mipsread.c index 869c833..611d6f5 100644 --- a/gdb/mipsread.c +++ b/gdb/mipsread.c @@ -97,6 +97,9 @@ extern void sort_symtab_syms(); /* Various complaints about symbol reading that don't abort the process */ +struct complaint bad_file_number_complaint = + {"bad file number %d", 0, 0}; + struct complaint unknown_ext_complaint = {"unknown external symbol %s", 0, 0}; @@ -195,7 +198,6 @@ static struct linetable *new_linetable(); static struct blockvector *new_bvect(); static struct type *parse_type(); -static struct type *make_type(); static struct symbol *mylookup_symbol(); static struct block *shrink_block(); static void sort_blocks(); @@ -267,17 +269,18 @@ mipscoff_symfile_read(sf, addr, mainline) if (val < 0) perror_with_name (name); - init_misc_bunches (); - make_cleanup (discard_misc_bunches, 0); + init_minimal_symbol_collection (); + make_cleanup (discard_minimal_symbols, 0); /* Now that the executable file is positioned at symbol table, process it and define symbols accordingly. */ read_mips_symtab(sf->objfile, desc); - /* Go over the misc symbol bunches and install them in vector. */ + /* Install any minimal symbols that have been collected as the current + minimal symbols for this objfile. */ - condense_misc_bunches (!mainline); + install_minimal_symbols (sf -> objfile); } /* Exported procedure: Allocate zeroed memory */ @@ -319,7 +322,7 @@ mipscoff_psymtab_to_symtab(pst) /* 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 (); + scan_file_globals (pst->objfile); if (info_verbose) printf_filtered("done.\n"); @@ -1081,8 +1084,8 @@ data: /* Common code for symbols describing data */ TYPE_LENGTH(t) = sh->value; TYPE_NFIELDS(t) = nfields; TYPE_FIELDS(t) = f = (struct field*) - obstack_alloc (symbol_obstack, - nfields * sizeof (struct field)); + obstack_alloc (¤t_objfile -> type_obstack, + nfields * sizeof (struct field)); if (type_code == TYPE_CODE_ENUM) { /* This is a non-empty enum. */ @@ -1094,7 +1097,7 @@ data: /* Common code for symbols describing data */ f->bitsize = 0; enum_sym = (struct symbol *) - obstack_alloc (symbol_obstack, + obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol)); memset (enum_sym, 0, sizeof (struct symbol)); SYMBOL_NAME (enum_sym) = f->name; @@ -1330,7 +1333,7 @@ static struct type *parse_type(ax, sh, bs) ax += cross_ref(ax, &tp, type_code, &pn); /* reading .o file ? */ if (UNSAFE_DATA_ADDR(tp)) - tp = make_type(type_code, 0, 0, 0); + tp = init_type(type_code, 0, 0, 0, (struct objfile *) NULL); /* SOMEONE OUGHT TO FIX DBXREAD TO DROP "STRUCT" */ sprintf(name, fmt, pn); @@ -1341,7 +1344,8 @@ static struct type *parse_type(ax, sh, bs) TYPE_CODE(tp) = type_code; } if (TYPE_NAME(tp) == NULL || strcmp(TYPE_NAME(tp), name) != 0) - TYPE_NAME(tp) = obsavestring(name, strlen(name)); + TYPE_NAME(tp) = obsavestring(name, strlen(name), + ¤t_objfile -> type_obstack); } /* Deal with range types */ @@ -1350,12 +1354,14 @@ static struct type *parse_type(ax, sh, bs) TYPE_NFIELDS (tp) = 2; TYPE_FIELDS (tp) = - (struct field *) obstack_alloc (symbol_obstack, - 2 * sizeof (struct field)); - TYPE_FIELD_NAME (tp, 0) = "Low"; + (struct field *) obstack_alloc (¤t_objfile -> type_obstack, + 2 * sizeof (struct field)); + TYPE_FIELD_NAME (tp, 0) = obsavestring ("Low", strlen ("Low"), + ¤t_objfile -> type_obstack); TYPE_FIELD_BITPOS (tp, 0) = ax->dnLow; ax++; - TYPE_FIELD_NAME (tp, 1) = "High"; + TYPE_FIELD_NAME (tp, 1) = obsavestring ("High", strlen ("High"), + ¤t_objfile -> type_obstack); TYPE_FIELD_BITPOS (tp, 1) = ax->dnHigh; ax++; } @@ -1416,7 +1422,7 @@ upgrade_type(tpp, tq, ax, sh) case tqArray: off = 0; - t = make_type(TYPE_CODE_ARRAY, 0, 0, 0); + t = init_type(TYPE_CODE_ARRAY, 0, 0, 0, (struct objfile *) NULL); TYPE_TARGET_TYPE(t) = *tpp; /* Determine and record the domain type (type of index) */ @@ -1781,7 +1787,7 @@ parse_partial_symbols(end_of_text_seg, objfile) /* Pass 2 over external syms: fill in external symbols */ for (s_idx = 0; s_idx < hdr->iextMax; s_idx++) { - enum misc_function_type misc_type = mf_text; + enum minimal_symbol_type ms_type = mst_text; esh = (EXTR *) (hdr->cbExtOffset) + s_idx; extern_tab[fdr_to_pst[esh->ifd].globals_offset @@ -1794,18 +1800,18 @@ parse_partial_symbols(end_of_text_seg, objfile) case stProc: break; case stGlobal: - misc_type = mf_data; + ms_type = mst_data; break; case stLabel: break; default: - misc_type = mf_unknown; + ms_type = mst_unknown; complain (&unknown_ext_complaint, (char *)(esh->asym.iss)); } - prim_record_misc_function ((char *)(esh->asym.iss), - esh->asym.value, - misc_type); + prim_record_minimal_symbol ((char *)(esh->asym.iss), + esh->asym.value, + ms_type); } /* Pass 3 over files, over local syms: fill in static symbols */ @@ -1838,11 +1844,13 @@ parse_partial_symbols(end_of_text_seg, objfile) pst->texthigh = pst->textlow; +#if 0 /* This is done in start_psymtab_common */ pst->globals_offset = global_psymbols.next - global_psymbols.list; pst->statics_offset = static_psymbols.next - static_psymbols.list; pst->n_global_syms = 0; pst->n_static_syms = 0; +#endif /* The second symbol must be @stab. This symbol is emitted by mips-tfile to signal @@ -1985,7 +1993,7 @@ parse_partial_symbols(end_of_text_seg, objfile) } if (global_psymbols.next >= global_psymbols.list + global_psymbols.size) - extend_psymbol_list (&global_psymbols); + extend_psymbol_list (&global_psymbols, objfile); psym = global_psymbols.next++; SYMBOL_NAME (psym) = (char*)sh->iss; SYMBOL_NAMESPACE (psym) = VAR_NAMESPACE; @@ -2008,7 +2016,40 @@ parse_partial_symbols(end_of_text_seg, objfile) /* Mark the last code address, and remember it for later */ hdr->cbDnOffset = end_of_text_seg; - do_cleanups (old_chain); + /* Now scan the FDRs for dependencies */ + for (f_idx = 0; f_idx < hdr->ifdMax; f_idx++) { + int s_id0 = 0; + fh = f_idx + (FDR *)(cur_hdr->cbFdOffset); + pst = fdr_to_pst[f_idx].pst; + + /* This should catch stabs-in-ecoff. */ + if (fh->crfd <= 1) + continue; + + if (fh->cpd == 0) { /* If there are no functions defined here ... */ + /* ...then presumably a .h file: drop reverse depends .h->.c */ + for (; s_id0 < fh->crfd; s_id0++) { + RFDT *rh = (RFDT *) (fh->rfdBase) + s_id0; + if (*rh == f_idx) { + s_id0++; /* Skip self-dependency */ + break; + } + } + } + pst->number_of_dependencies = fh->crfd - s_id0; + pst->dependencies = (struct partial_symtab **) + obstack_alloc (psymbol_obstack, + pst->number_of_dependencies * + sizeof (struct partial_symtab *)); + for (s_idx = s_id0; s_idx < fh->crfd; s_idx++) { + RFDT *rh = (RFDT *) (fh->rfdBase) + s_idx; + if (*rh < 0 || *rh >= hdr->ifdMax) + complain(&bad_file_number_complaint, *rh); + else + pst->dependencies[s_idx-s_id0] = fdr_to_pst[*rh].pst; + } + } + do_cleanups (old_chain); } @@ -2070,7 +2111,7 @@ parse_fdr(f_idx, lev, objfile) } pst->number_of_dependencies = fh->crfd - s_id0; pst->dependencies = (struct partial_symtab **) - obstack_alloc (psymbol_obstack, + obstack_alloc (&objfile->psymbol_obstack, pst->number_of_dependencies * sizeof (struct partial_symtab *)); for (s_idx = s_id0; s_idx < fh->crfd; s_idx++) { @@ -2170,6 +2211,7 @@ psymtab_to_symtab_1(pst, filename) cur_fdr = fh; /* Now read the symbols for this symtab */ + current_objfile = pst -> objfile; if (!have_stabs) { cur_fd = FDR_IDX(pst); cur_stab = st; @@ -2201,7 +2243,10 @@ psymtab_to_symtab_1(pst, filename) if (have_stabs) { if (fh->csym <= 2) + { + current_objfile = NULL; return; + } for (cur_sdx = 2; cur_sdx < fh->csym; cur_sdx++) { register SYMR *sh = cur_sdx + (SYMR *) fh->isymBase; char *name = (char*)sh->iss; @@ -2279,6 +2324,8 @@ psymtab_to_symtab_1(pst, filename) /* Now link the psymtab and the symtab. */ pst->symtab = st; + + current_objfile = NULL; } /* Ancillary parsing procedures. */ @@ -2337,7 +2384,7 @@ cross_ref(rn, tpp, type_code, pname) if (p) *tpp = p->t; else { - *tpp = make_type(type_code, 0, 0, 0); + *tpp = init_type(type_code, 0, 0, 0, (struct objfile *) NULL); add_pending(fh, sh, *tpp); } } @@ -2568,24 +2615,20 @@ struct symtab * new_symtab(name, maxsyms, maxlines, objfile) char *name; { - struct symtab *s = allocate_symtab (name, objfile); + struct symtab *s = allocate_symtab (name, objfile); - LINETABLE(s) = new_linetable(maxlines); + LINETABLE(s) = new_linetable(maxlines); - /* All symtabs must have at least two blocks */ - BLOCKVECTOR(s) = new_bvect(2); - BLOCKVECTOR_BLOCK(BLOCKVECTOR(s), GLOBAL_BLOCK) = new_block(maxsyms); - BLOCKVECTOR_BLOCK(BLOCKVECTOR(s), STATIC_BLOCK) = new_block(maxsyms); - BLOCK_SUPERBLOCK( BLOCKVECTOR_BLOCK(BLOCKVECTOR(s),STATIC_BLOCK)) = - BLOCKVECTOR_BLOCK(BLOCKVECTOR(s), GLOBAL_BLOCK); + /* All symtabs must have at least two blocks */ + BLOCKVECTOR(s) = new_bvect(2); + BLOCKVECTOR_BLOCK(BLOCKVECTOR(s), GLOBAL_BLOCK) = new_block(maxsyms); + BLOCKVECTOR_BLOCK(BLOCKVECTOR(s), STATIC_BLOCK) = new_block(maxsyms); + BLOCK_SUPERBLOCK( BLOCKVECTOR_BLOCK(BLOCKVECTOR(s),STATIC_BLOCK)) = + BLOCKVECTOR_BLOCK(BLOCKVECTOR(s), GLOBAL_BLOCK); - s->free_code = free_linetable; + s->free_code = free_linetable; - /* Link the new symtab into the list of such. */ - s->next = symtab_list; - symtab_list = s; - - return s; + return (s); } /* Allocate a new partial_symtab NAME */ @@ -2595,34 +2638,21 @@ new_psymtab(name, objfile) char *name; struct objfile *objfile; { - struct partial_symtab *pst; - - pst = (struct partial_symtab *) - obstack_alloc (psymbol_obstack, sizeof (*pst)); - memset (pst, 0, sizeof (*pst)); - - if (name == (char*)-1) /* FIXME -- why not null here? */ - pst->filename = "<no name>"; - else - pst->filename = name; - - /* Chain it to its object file */ - pst->objfile = objfile; - pst->objfile_chain = objfile->psymtabs; - objfile->psymtabs = pst; - - pst->next = partial_symtab_list; - partial_symtab_list = pst; - - /* Keep a backpointer to the file's symbols */ - pst->read_symtab_private = (char *) obstack_alloc (psymbol_obstack, - sizeof (struct symloc)); - CUR_HDR(pst) = cur_hdr; - - /* The way to turn this into a symtab is to call... */ - pst->read_symtab = mipscoff_psymtab_to_symtab; + struct partial_symtab *psymtab; + + /* FIXME -- why (char *) -1 rather than NULL? */ + psymtab = allocate_psymtab (name == (char *) -1 ? "<no name>" : name, + objfile); + + /* Keep a backpointer to the file's symbols */ - return pst; + psymtab -> read_symtab_private = (char *) + obstack_alloc (&objfile->psymbol_obstack, sizeof (struct symloc)); + CUR_HDR(psymtab) = cur_hdr; + + /* The way to turn this into a symtab is to call... */ + psymtab->read_symtab = mipscoff_psymtab_to_symtab; + return (psymtab); } @@ -2719,7 +2749,7 @@ new_symbol(name) char *name; { struct symbol *s = (struct symbol *) - obstack_alloc (symbol_obstack, sizeof (struct symbol)); + obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol)); memset (s, 0, sizeof (*s)); SYMBOL_NAME(s) = name; @@ -2733,41 +2763,14 @@ struct type * new_type(name) char *name; { - struct type *t = (struct type *) - obstack_alloc (symbol_obstack, sizeof (struct type)); + struct type *t; - memset (t, 0, sizeof (*t)); - TYPE_VPTR_FIELDNO (t) = -1; + t = alloc_type (current_objfile); TYPE_NAME(t) = name; TYPE_CPLUS_SPECIFIC(t) = &cplus_struct_default; return t; } -/* Create and initialize a new type with printname NAME. - CODE and LENGTH are the initial info we put in, - UNS says whether the type is unsigned or not. */ - -static -struct type * -make_type(code, length, uns, name) - enum type_code code; - int length, uns; - char *name; -{ - register struct type *type; - - /* FIXME, I don't think this ever gets freed. */ - type = (struct type *) xzalloc(sizeof(struct type)); - TYPE_CODE(type) = code; - TYPE_LENGTH(type) = length; - TYPE_FLAGS(type) = uns ? TYPE_FLAG_UNSIGNED : 0; - TYPE_NAME(type) = name; - TYPE_VPTR_FIELDNO (type) = -1; - - if (code != TYPE_CODE_METHOD && code != TYPE_CODE_FUNC) - TYPE_CPLUS_SPECIFIC(type) = &cplus_struct_default; - return type; -} /* Things used for calling functions in the inferior. These functions are exported to our companion @@ -2821,7 +2824,7 @@ fixup_sigtramp() */ SYMBOL_NAMESPACE(s) = VAR_NAMESPACE; SYMBOL_CLASS(s) = LOC_BLOCK; - SYMBOL_TYPE(s) = make_type(TYPE_CODE_FUNC, 4, 0, 0); + SYMBOL_TYPE(s) = init_type(TYPE_CODE_FUNC, 4, 0, 0, (struct objfile *) NULL); TYPE_TARGET_TYPE(SYMBOL_TYPE(s)) = builtin_type_void; /* Need a block to allocate .gdbinfo. in */ @@ -2872,14 +2875,24 @@ _initialize_mipsread () add_symtab_fns (&ecoff_sym_fns); /* Missing basic types */ - builtin_type_string = make_type(TYPE_CODE_PASCAL_ARRAY, - 1, 0, "string"); - builtin_type_complex = make_type(TYPE_CODE_FLT, - 2 * sizeof(float), 0, "complex"); - builtin_type_double_complex = make_type(TYPE_CODE_FLT, - 2 * sizeof(double), 0, "double_complex"); - builtin_type_fixed_dec = make_type(TYPE_CODE_INT, sizeof(int), - 0, "fixed_decimal"); - builtin_type_float_dec = make_type(TYPE_CODE_FLT, sizeof(double), - 0, "floating_decimal"); + builtin_type_string = + init_type (TYPE_CODE_PASCAL_ARRAY, + 1, 0, "string", + (struct objfile *) NULL); + builtin_type_complex = + init_type(TYPE_CODE_FLT, + 2 * sizeof(float), 0, "complex", + (struct objfile *) NULL); + builtin_type_double_complex = + init_type(TYPE_CODE_FLT, + 2 * sizeof(double), 0, "double_complex", + (struct objfile *) NULL); + builtin_type_fixed_dec = + init_type(TYPE_CODE_INT, sizeof(int), + 0, "fixed_decimal", + (struct objfile *) NULL); + builtin_type_float_dec = + init_type(TYPE_CODE_FLT, sizeof(double), + 0, "floating_decimal", + (struct objfile *) NULL); } diff --git a/gdb/remote-vx.c b/gdb/remote-vx.c index 4ecc902..a031bb5 100644 --- a/gdb/remote-vx.c +++ b/gdb/remote-vx.c @@ -1009,6 +1009,7 @@ vx_wait (status) case EVENT_ZERO_DIV: /* Division by zero */ WSETSTOP (w, SIGFPE); /* Like Unix, call it a float exception. */ + break; case EVENT_SIGNAL: /* The target is not running Unix, and its diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index e65ec07..207a54b 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -1554,7 +1554,7 @@ aixcoff_symfile_read (sf, addr, mainline) /* Install any minimal symbols that have been collected as the current minimal symbols for this objfile. */ - install_minimal_symbols (!mainline, sf -> objfile); + install_minimal_symbols (sf -> objfile); /* Make a default for file to list. */ select_source_symtab (0); diff --git a/gdb/xm-sun3os4.h b/gdb/xm-sun3os4.h index d7d1c95..de0a640 100644 --- a/gdb/xm-sun3os4.h +++ b/gdb/xm-sun3os4.h @@ -26,3 +26,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ the area occupied by the shared libraries. Sun knows about this bug but has no obvious fix for it. */ #define BROKEN_LARGE_ALLOCA + +/* SunOS 4.x has memory mapped files. */ + +#define HAVE_MMAP diff --git a/gdb/xm-sun4os4.h b/gdb/xm-sun4os4.h index 75f1037..6deb334 100644 --- a/gdb/xm-sun4os4.h +++ b/gdb/xm-sun4os4.h @@ -26,3 +26,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ the area occupied by the shared libraries. Sun knows about this bug but has no obvious fix for it. */ #define BROKEN_LARGE_ALLOCA + +/* SunOS 4.x has memory mapped files. */ + +#define HAVE_MMAP |