From 2dd30c722bd69b3086430017eb2b8c50956c0745 Mon Sep 17 00:00:00 2001 From: Fred Fish Date: Thu, 21 Dec 1995 04:08:27 +0000 Subject: [PATCH] * defs.h: Delete extraneous whitespace at end of file. * symfile.h: Move #include of demangle.h outside conditional. * objfiles.h (struct objstats, OBJSTAT, OBJSTATS): New struct and macros to hold per-objfile statistics for internal instrumentation. (struct objfile): Add OBJSTATS member, which is optional. * buildsym.h (next_symbol_text_func): Now takes objfile argument. Also update copyright to 1995. * dbxread.c (dbx_next_symbol_text): Now takes objfile argument. (dbx_symfile_init, coffstab_build_psymtabs, elfstab_build_psymtabs, stabsect_build_psymtabs): Accumulate string table size. (dbx_next_symbol_text, read_dbx_symtab, read_ofile_symtab): Accumulate number of stabs symbols read. * dwarfread.c (new_symbol, symthesize_typedef): Accumulate number of full symbols created. * gdbtypes.c (alloc_type): Accumulate number of types. * maint.c (maintenance_print_statistics): New function. * mdebugread.c (mdebug_next_symbol_text): Now takes objfile argument. * minsyms.c (prim_record_minimal_symbol_and_info): Accumulate number of minimal symbols read. * os9kread.c (read_os9k_psymtab): next_symbol_text takes objfile arg. * partial-stab.h: next_symbol_text takes objfile arg. * stabsread.c (error_type, STABS_CONTINUE): Now takes objfile arg and uses it to call next_symbol_text. * symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): Accumulate number of partial symbols created. * symfile.h (ADD_PSYMBOL_VT_TO_LIST): Accumulate number of partial symbols created. * symmisc.c (print_objfile_statistics): Print the per-objfile internal instrumentation statistics gathered. * xcoffread.c (xcoff_next_symbol_text): Now takes objfile argument. --- gdb/ChangeLog | 37 ++++++++++++++++ gdb/buildsym.h | 6 +-- gdb/dwarfread.c | 2 + gdb/gdbtypes.c | 2 + gdb/maint.c | 15 ++++++- gdb/mdebugread.c | 5 ++- gdb/minsyms.c | 1 + gdb/objfiles.h | 30 +++++++++++++ gdb/os9kread.c | 2 +- gdb/partial-stab.h | 2 +- gdb/stabsread.c | 105 +++++++++++++++++++++++---------------------- gdb/symfile.c | 4 +- gdb/xcoffread.c | 6 ++- 13 files changed, 154 insertions(+), 63 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d26d73e0e0f..a98ab9c95c2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,40 @@ +Wed Dec 20 10:54:41 1995 Fred Fish + + * defs.h: Delete extraneous whitespace at end of file. + * symfile.h: Move #include of demangle.h outside conditional. + * objfiles.h (struct objstats, OBJSTAT, OBJSTATS): New struct + and macros to hold per-objfile statistics for internal instrumentation. + (struct objfile): Add OBJSTATS member, which is optional. + * buildsym.h (next_symbol_text_func): Now takes objfile argument. + Also update copyright to 1995. + * dbxread.c (dbx_next_symbol_text): Now takes objfile argument. + (dbx_symfile_init, coffstab_build_psymtabs, elfstab_build_psymtabs, + stabsect_build_psymtabs): Accumulate string table size. + (dbx_next_symbol_text, read_dbx_symtab, read_ofile_symtab): + Accumulate number of stabs symbols read. + * dwarfread.c (new_symbol, symthesize_typedef): + Accumulate number of full symbols created. + * gdbtypes.c (alloc_type): Accumulate number of types. + * maint.c (maintenance_print_statistics): New function. + * mdebugread.c (mdebug_next_symbol_text): Now takes objfile argument. + * minsyms.c (prim_record_minimal_symbol_and_info): Accumulate + number of minimal symbols read. + * os9kread.c (read_os9k_psymtab): next_symbol_text takes objfile arg. + * partial-stab.h: next_symbol_text takes objfile arg. + * stabsread.c (error_type, STABS_CONTINUE): Now takes objfile arg and + uses it to call next_symbol_text. + * symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): + Accumulate number of partial symbols created. + * symfile.h (ADD_PSYMBOL_VT_TO_LIST): Accumulate number of partial + symbols created. + * symmisc.c (print_objfile_statistics): Print the per-objfile + internal instrumentation statistics gathered. + * xcoffread.c (xcoff_next_symbol_text): Now takes objfile argument. + +Fri Dec 15 16:15:55 1995 Ian Lance Taylor + + * top.c (set_endian_from_file): Use new bfd_big_endian macro. + Fri Dec 15 12:21:10 1995 Raymond Jou * mpw-make.sed: Add quotes to RIncludes reference. diff --git a/gdb/buildsym.h b/gdb/buildsym.h index bd9c3aa6fd3..36732f047a4 100644 --- a/gdb/buildsym.h +++ b/gdb/buildsym.h @@ -1,5 +1,5 @@ /* Build symbol tables in GDB's internal format. - Copyright (C) 1986-1991 Free Software Foundation, Inc. + Copyright (C) 1986-1995 Free Software Foundation, Inc. This file is part of GDB. @@ -180,11 +180,11 @@ struct subfile_stack EXTERN struct subfile_stack *subfile_stack; -#define next_symbol_text() (*next_symbol_text_func)() +#define next_symbol_text(objfile) (*next_symbol_text_func)(objfile) /* Function to invoke get the next symbol. Return the symbol name. */ -EXTERN char *(*next_symbol_text_func) PARAMS ((void)); +EXTERN char *(*next_symbol_text_func) PARAMS ((struct objfile *)); /* Vector of types defined so far, indexed by their type numbers. Used for both stabs and coff. diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c index a68cdf1f4b4..41f2a6cce55 100644 --- a/gdb/dwarfread.c +++ b/gdb/dwarfread.c @@ -2891,6 +2891,7 @@ new_symbol (dip, objfile) { sym = (struct symbol *) obstack_alloc (&objfile -> symbol_obstack, sizeof (struct symbol)); + OBJSTAT (objfile, n_syms++); memset (sym, 0, sizeof (struct symbol)); SYMBOL_NAME (sym) = create_name (dip -> at_name, &objfile->symbol_obstack); @@ -3041,6 +3042,7 @@ synthesize_typedef (dip, objfile, type) { sym = (struct symbol *) obstack_alloc (&objfile -> symbol_obstack, sizeof (struct symbol)); + OBJSTAT (objfile, n_syms++); memset (sym, 0, sizeof (struct symbol)); SYMBOL_NAME (sym) = create_name (dip -> at_name, &objfile->symbol_obstack); diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 99c7c57b082..366ab34a713 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -74,6 +74,7 @@ alloc_type (objfile) { type = (struct type *) obstack_alloc (&objfile -> type_obstack, sizeof (struct type)); + OBJSTAT (objfile, n_types++); } memset ((char *) type, 0, sizeof (struct type)); @@ -1165,6 +1166,7 @@ lookup_fundamental_type (objfile, typeid) objfile -> fundamental_types = (struct type **) obstack_alloc (&objfile -> type_obstack, nbytes); memset ((char *) objfile -> fundamental_types, 0, nbytes); + OBJSTAT (objfile, n_types += FT_NUM_MEMBERS); } /* Look for this particular type in the fundamental type vector. If one is diff --git a/gdb/maint.c b/gdb/maint.c index 952e8cccedc..3b94eb90a32 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "defs.h" -#if MAINTENANCE_CMDS /* Entire file goes away if not including maint cmds */ +#if MAINTENANCE_CMDS /* Entire rest of file goes away if not including maint cmds */ #include #include "command.h" @@ -243,6 +243,15 @@ maintenance_info_sections (arg, from_tty) } } +/* ARGSUSED */ +void +maintenance_print_statistics (args, from_tty) + char *args; + int from_tty; +{ + print_objfile_statistics (); +} + /* The "maintenance print" command is defined as a prefix, with allow_unknown 0. Therefore, its own definition is called only for "maintenance print" with no args. */ @@ -339,6 +348,10 @@ If a SOURCE file is specified, dump only that file's partial symbols.", "Print dump of current object file definitions.", &maintenanceprintlist); + add_cmd ("statistics", class_maintenance, maintenance_print_statistics, + "Print statistics about internal gdb state.", + &maintenanceprintlist); + add_cmd ("check-symtabs", class_maintenance, maintenance_check_symtabs, "Check consistency of psymtabs and symtabs.", &maintenancelist); diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 67eeb7ab252..0fa3c3d4565 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -383,7 +383,7 @@ static void handle_psymbol_enumerators PARAMS ((struct objfile *, FDR *, int, CORE_ADDR)); static char * -mdebug_next_symbol_text PARAMS ((void)); +mdebug_next_symbol_text PARAMS ((struct objfile *)); /* Address bounds for the signal trampoline in inferior, if any */ @@ -3085,7 +3085,8 @@ handle_psymbol_enumerators (objfile, fh, stype, svalue) } static char * -mdebug_next_symbol_text () +mdebug_next_symbol_text (objfile) + struct objfile *objfile; /* argument objfile is currently unused */ { SYMR sh; diff --git a/gdb/minsyms.c b/gdb/minsyms.c index cb0623e65fb..c0200626157 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -494,6 +494,7 @@ prim_record_minimal_symbol_and_info (name, address, ms_type, info, section, MSYMBOL_INFO (msymbol) = info; /* FIXME! */ msym_bunch_index++; msym_count++; + OBJSTAT (objfile, n_minsyms++); return msymbol; } diff --git a/gdb/objfiles.h b/gdb/objfiles.h index bb1df89b223..0a8bbd3803e 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -156,6 +156,33 @@ struct obj_section { struct objfile *objfile; }; +/* The "objstats" structure provides a place for gdb to record some + interesting information about its internal state at runtime, on a + per objfile basis, such as information about the number of symbols + read, size of string table (if any), etc. */ + +#if MAINTENANCE_CMDS + +struct objstats { + int n_minsyms; /* Number of minimal symbols read */ + int n_psyms; /* Number of partial symbols read */ + int n_syms; /* Number of full symbols read */ + int n_stabs; /* Number of ".stabs" read (if applicable) */ + int n_types; /* Number of types */ + int sz_strtab; /* Size of stringtable, (if applicable) */ +}; + +#define OBJSTAT(objfile, expr) (objfile -> stats.expr) +#define OBJSTATS struct objstats stats +extern void print_objfile_statistics PARAMS ((void)); + +#else + +#define OBJSTAT(objfile, expr) /* Nothing */ +#define OBJSTATS /* Nothing */ + +#endif /* MAINTENANCE_CMDS */ + /* Master structure for keeping track of each file from which gdb reads symbols. There are several ways these get allocated: 1. The main symbol file, symfile_objfile, set by the symbol-file command, @@ -321,6 +348,9 @@ struct objfile /* two auxiliary fields, used to hold the fp of separate symbol files */ FILE *auxf1, *auxf2; + + /* Place to stash various statistics about this objfile */ + OBJSTATS; }; /* Defines for the objfile flag word. */ diff --git a/gdb/os9kread.c b/gdb/os9kread.c index 01446439a31..110d4cffbad 100644 --- a/gdb/os9kread.c +++ b/gdb/os9kread.c @@ -832,7 +832,7 @@ read_os9k_psymtab (section_offsets, objfile, text_addr, text_size) /* Check for and handle cretinous dbx symbol name continuation! if (*p == '\\') - p = next_symbol_text (); + p = next_symbol_text (objfile); */ /* Point to the character after the name diff --git a/gdb/partial-stab.h b/gdb/partial-stab.h index 7580f5f3515..1ea1eb04211 100644 --- a/gdb/partial-stab.h +++ b/gdb/partial-stab.h @@ -493,7 +493,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Check for and handle cretinous dbx symbol name continuation! */ if (*p == '\\' || (*p == '?' && p[1] == '\0')) - p = next_symbol_text (); + p = next_symbol_text (objfile); /* Point to the character after the name of the enum constant. */ diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 37c1b9d98dc..1be6cd29ea1 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -80,7 +80,7 @@ dbx_alloc_type PARAMS ((int [2], struct objfile *)); static long read_huge_number PARAMS ((char **, int, int *)); -static struct type *error_type PARAMS ((char **)); +static struct type *error_type PARAMS ((char **, struct objfile *)); static void patch_block_stabs PARAMS ((struct pending *, struct pending_stabs *, @@ -202,10 +202,10 @@ static int undef_types_length; static struct symbol *current_symbol = NULL; /* Check for and handle cretinous stabs symbol name continuation! */ -#define STABS_CONTINUE(pp) \ +#define STABS_CONTINUE(pp,objfile) \ do { \ if (**(pp) == '\\' || (**(pp) == '?' && (*(pp))[1] == '\0')) \ - *(pp) = next_symbol_text (); \ + *(pp) = next_symbol_text (objfile); \ } while (0) /* FIXME: These probably should be our own types (like rs6000_builtin_type @@ -658,7 +658,7 @@ define_symbol (valu, string, desc, type, objfile) if (*p != '=') { SYMBOL_CLASS (sym) = LOC_CONST; - SYMBOL_TYPE (sym) = error_type (&p); + SYMBOL_TYPE (sym) = error_type (&p, objfile); SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE; add_symbol_to_list (sym, &file_symbols); return sym; @@ -732,7 +732,7 @@ define_symbol (valu, string, desc, type, objfile) if (*p != ',') { - SYMBOL_TYPE (sym) = error_type (&p); + SYMBOL_TYPE (sym) = error_type (&p, objfile); break; } ++p; @@ -749,7 +749,7 @@ define_symbol (valu, string, desc, type, objfile) default: { SYMBOL_CLASS (sym) = LOC_CONST; - SYMBOL_TYPE (sym) = error_type (&p); + SYMBOL_TYPE (sym) = error_type (&p, objfile); } } SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE; @@ -1211,7 +1211,7 @@ define_symbol (valu, string, desc, type, objfile) break; default: - SYMBOL_TYPE (sym) = error_type (&p); + SYMBOL_TYPE (sym) = error_type (&p, objfile); SYMBOL_CLASS (sym) = LOC_CONST; SYMBOL_VALUE (sym) = 0; SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE; @@ -1252,7 +1252,7 @@ define_symbol (valu, string, desc, type, objfile) Thus code like this: if (*(*pp)++ != ';') - return error_type (pp); + return error_type (pp, objfile); is wrong because if *pp starts out pointing at '\0' (typically as the result of an earlier error), it will be incremented to point to the @@ -1260,13 +1260,13 @@ define_symbol (valu, string, desc, type, objfile) if you run off the end of the string table. Instead use if (**pp != ';') - return error_type (pp); + return error_type (pp, objfile); ++*pp; or if (**pp != ';') - foo = error_type (pp); + foo = error_type (pp, objfile); else ++*pp; @@ -1275,8 +1275,9 @@ define_symbol (valu, string, desc, type, objfile) debugger will be able to read the new symbol tables. */ static struct type * -error_type (pp) +error_type (pp, objfile) char **pp; + struct objfile *objfile; { complain (&error_type_complaint); while (1) @@ -1290,7 +1291,7 @@ error_type (pp) /* Check for and handle cretinous dbx symbol name continuation! */ if ((*pp)[-1] == '\\' || (*pp)[-1] == '?') { - *pp = next_symbol_text (); + *pp = next_symbol_text (objfile); } else { @@ -1333,7 +1334,7 @@ read_type (pp, objfile) || **pp == '-') { if (read_type_number (pp, typenums) != 0) - return error_type (pp); + return error_type (pp, objfile); /* Type is not being defined here. Either it already exists, or this is a forward reference to it. dbx_alloc_type handles @@ -1362,7 +1363,7 @@ read_type (pp, objfile) ++p; *pp = p; if (*p == '\0') - return error_type (pp); + return error_type (pp, objfile); else /* Skip the semicolon. */ ++*pp; @@ -1441,7 +1442,7 @@ read_type (pp, objfile) q1 = strchr(*pp, '<'); p = strchr(*pp, ':'); if (p == NULL) - return error_type (pp); + return error_type (pp, objfile); while (q1 && p > q1 && p[1] == ':') { q2 = strchr(q1, '>'); @@ -1450,7 +1451,7 @@ read_type (pp, objfile) p += 2; p = strchr(p, ':'); if (p == NULL) - return error_type (pp); + return error_type (pp, objfile); } to = type_name = (char *)obstack_alloc (&objfile->type_obstack, p - *pp + 1); @@ -1524,7 +1525,7 @@ read_type (pp, objfile) /* Peek ahead at the number to detect void. */ if (read_type_number (pp, xtypenums) != 0) - return error_type (pp); + return error_type (pp, objfile); if (typenums[0] == xtypenums[0] && typenums[1] == xtypenums[1]) /* It's being defined as itself. That means it is "void". */ @@ -1609,7 +1610,7 @@ read_type (pp, objfile) /* Because 'c' means other things to AIX and 'k' is perfectly good, only accept 'c' in the os9k_stabs case. */ if (type_descriptor == 'c' && !os9k_stabs) - return error_type (pp); + return error_type (pp, objfile); type = read_type (pp, objfile); /* FIXME! For now, we ignore const and volatile qualifiers. */ break; @@ -1619,7 +1620,7 @@ read_type (pp, objfile) /* Because 'i' means other things to AIX and 'B' is perfectly good, only accept 'i' in the os9k_stabs case. */ if (type_descriptor == 'i' && !os9k_stabs) - return error_type (pp); + return error_type (pp, objfile); type = read_type (pp, objfile); /* FIXME! For now, we ignore const and volatile qualifiers. */ break; @@ -1632,7 +1633,7 @@ read_type (pp, objfile) if (**pp != ',') /* Invalid member type data format. */ - return error_type (pp); + return error_type (pp, objfile); ++*pp; memtype = read_type (pp, objfile); @@ -1663,7 +1664,7 @@ read_type (pp, objfile) if (**pp != ',') /* Invalid member type data format. */ - return error_type (pp); + return error_type (pp, objfile); else ++(*pp); @@ -1723,7 +1724,7 @@ read_type (pp, objfile) case 'a': /* Array type */ if (**pp != 'r') - return error_type (pp); + return error_type (pp, objfile); ++*pp; type = dbx_alloc_type (typenums, objfile); @@ -1744,13 +1745,13 @@ read_type (pp, objfile) default: --*pp; /* Go back to the symbol in error */ /* Particularly important if it was \0! */ - return error_type (pp); + return error_type (pp, objfile); } if (type == 0) { warning ("GDB internal error, type is NULL in stabsread.c\n"); - return error_type (pp); + return error_type (pp, objfile); } /* Size specified in a type attribute overrides any other size. */ @@ -2012,7 +2013,7 @@ read_member_functions (fip, pp, type, objfile) /* Skip past '::'. */ *pp = p + 2; - STABS_CONTINUE (pp); + STABS_CONTINUE (pp, objfile); p = *pp; while (*p != '.') { @@ -2041,7 +2042,7 @@ read_member_functions (fip, pp, type, objfile) if (look_ahead_type == NULL) { /* Normal case. */ - STABS_CONTINUE (pp); + STABS_CONTINUE (pp, objfile); new_sublist -> fn_field.type = read_type (pp, objfile); if (**pp != ':') @@ -2086,7 +2087,7 @@ read_member_functions (fip, pp, type, objfile) break; } - STABS_CONTINUE (pp); + STABS_CONTINUE (pp, objfile); switch (**pp) { case 'A': /* Normal functions. */ @@ -2135,7 +2136,7 @@ read_member_functions (fip, pp, type, objfile) if (nbits != 0) return 0; - STABS_CONTINUE (pp); + STABS_CONTINUE (pp, objfile); if (**pp == ';' || **pp == '\0') { /* Must be g++ version 1. */ @@ -2192,7 +2193,7 @@ read_member_functions (fip, pp, type, objfile) new_sublist -> next = sublist; sublist = new_sublist; length++; - STABS_CONTINUE (pp); + STABS_CONTINUE (pp, objfile); } while (**pp != ';' && **pp != '\0'); @@ -2213,7 +2214,7 @@ read_member_functions (fip, pp, type, objfile) fip -> fnlist = new_fnlist; nfn_fields++; total_length += length; - STABS_CONTINUE (pp); + STABS_CONTINUE (pp, objfile); } if (nfn_fields) @@ -2515,7 +2516,7 @@ read_struct_fields (fip, pp, type, objfile) while (**pp != ';') { if (os9k_stabs && **pp == ',') break; - STABS_CONTINUE (pp); + STABS_CONTINUE (pp, objfile); /* Get space to record the next field's data. */ new = (struct nextfield *) xmalloc (sizeof (struct nextfield)); make_cleanup (free, new); @@ -2647,7 +2648,7 @@ read_baseclasses (fip, pp, type, objfile) fip -> list = new; new -> field.bitsize = 0; /* this should be an unpacked field! */ - STABS_CONTINUE (pp); + STABS_CONTINUE (pp, objfile); switch (**pp) { case '0': @@ -2729,7 +2730,7 @@ read_tilde_fields (fip, pp, type, objfile) { register char *p; - STABS_CONTINUE (pp); + STABS_CONTINUE (pp, objfile); /* If we are positioned at a ';', then skip it. */ if (**pp == ';') @@ -2948,7 +2949,7 @@ read_struct_type (pp, type, objfile) int nbits; TYPE_LENGTH (type) = read_huge_number (pp, 0, &nbits); if (nbits != 0) - return error_type (pp); + return error_type (pp, objfile); } /* Now read the baseclasses, if any, read the regular C struct or C++ @@ -2964,7 +2965,7 @@ read_struct_type (pp, type, objfile) || !read_tilde_fields (&fi, pp, type, objfile)) { do_cleanups (back_to); - return (error_type (pp)); + return (error_type (pp, objfile)); } do_cleanups (back_to); @@ -3001,7 +3002,7 @@ read_array_type (pp, type, objfile) index_type = read_type (pp, objfile); if (**pp != ';') /* Improper format of array type decl. */ - return error_type (pp); + return error_type (pp, objfile); ++*pp; } @@ -3012,7 +3013,7 @@ read_array_type (pp, type, objfile) } lower = read_huge_number (pp, os9k_stabs ? ',' : ';', &nbits); if (nbits != 0) - return error_type (pp); + return error_type (pp, objfile); if (!(**pp >= '0' && **pp <= '9') && **pp != '-') { @@ -3021,7 +3022,7 @@ read_array_type (pp, type, objfile) } upper = read_huge_number (pp, ';', &nbits); if (nbits != 0) - return error_type (pp); + return error_type (pp, objfile); element_type = read_type (pp, objfile); @@ -3079,7 +3080,7 @@ read_enum_type (pp, type, objfile) with a digit). */ read_huge_number (pp, 0, &nbits); if (nbits != 0) - return error_type (pp); + return error_type (pp, objfile); } /* The aix4 compiler emits an extra field before the enum members; @@ -3099,14 +3100,14 @@ read_enum_type (pp, type, objfile) A semicolon or comma instead of a NAME means the end. */ while (**pp && **pp != ';' && **pp != ',') { - STABS_CONTINUE (pp); + STABS_CONTINUE (pp, objfile); p = *pp; while (*p != ':') p++; name = obsavestring (*pp, p - *pp, &objfile -> symbol_obstack); *pp = p + 1; n = read_huge_number (pp, ',', &nbits); if (nbits != 0) - return error_type (pp); + return error_type (pp, objfile); sym = (struct symbol *) obstack_alloc (&objfile -> symbol_obstack, sizeof (struct symbol)); @@ -3196,7 +3197,7 @@ read_sun_builtin_type (pp, typenums, objfile) signed_type = 0; break; default: - return error_type (pp); + return error_type (pp, objfile); } (*pp)++; @@ -3214,17 +3215,17 @@ read_sun_builtin_type (pp, typenums, objfile) we will ignore it. */ read_huge_number (pp, ';', &nbits); if (nbits != 0) - return error_type (pp); + return error_type (pp, objfile); /* The second number is always 0, so ignore it too. */ read_huge_number (pp, ';', &nbits); if (nbits != 0) - return error_type (pp); + return error_type (pp, objfile); /* The third number is the number of bits for this type. */ type_bits = read_huge_number (pp, 0, &nbits); if (nbits != 0) - return error_type (pp); + return error_type (pp, objfile); /* The type *should* end with a semicolon. If it are embedded in a larger type the semicolon may be the only way to know where the type ends. If this type is at the end of the stabstring we @@ -3259,12 +3260,12 @@ read_sun_floating_type (pp, typenums, objfile) FN_COMPLEX. */ details = read_huge_number (pp, ';', &nbits); if (nbits != 0) - return error_type (pp); + return error_type (pp, objfile); /* The second number is the number of bytes occupied by this type */ nbytes = read_huge_number (pp, ';', &nbits); if (nbits != 0) - return error_type (pp); + return error_type (pp, objfile); if (details == NF_COMPLEX || details == NF_COMPLEX16 || details == NF_COMPLEX32) @@ -3409,7 +3410,7 @@ read_range_type (pp, typenums, objfile) /* First comes a type we are a subrange of. In C it is usually 0, 1 or the type being defined. */ if (read_type_number (pp, rangenums) != 0) - return error_type (pp); + return error_type (pp, objfile); self_subrange = (rangenums[0] == typenums[0] && rangenums[1] == typenums[1]); @@ -3429,7 +3430,7 @@ read_range_type (pp, typenums, objfile) n3 = read_huge_number (pp, ';', &n3bits); if (n2bits == -1 || n3bits == -1) - return error_type (pp); + return error_type (pp, objfile); if (index_type) goto handle_true_range; @@ -3467,7 +3468,7 @@ read_range_type (pp, typenums, objfile) objfile); } else - return error_type (pp); + return error_type (pp, objfile); } /* A type defined as a subrange of itself, with bounds both 0, is void. */ @@ -3551,7 +3552,7 @@ read_range_type (pp, typenums, objfile) a self_subrange type; I'm going to assume that this is used as an idiom, and that all of them are special cases. So . . . */ if (self_subrange) - return error_type (pp); + return error_type (pp, objfile); index_type = *dbx_lookup_type (rangenums); if (index_type == NULL) @@ -3593,7 +3594,7 @@ read_args (pp, end, objfile) /* Invalid argument list: no ','. */ return (struct type **)-1; (*pp)++; - STABS_CONTINUE (pp); + STABS_CONTINUE (pp, objfile); types[n++] = read_type (pp, objfile); } (*pp)++; /* get past `end' (the ':' character) */ diff --git a/gdb/symfile.c b/gdb/symfile.c index e297190a4d6..e0848cc067a 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -34,7 +34,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "demangle.h" #include "inferior.h" /* for write_pc */ -#include +#include "obstack.h" #include #include @@ -1652,6 +1652,7 @@ add_psymbol_to_list (name, namelength, namespace, class, list, val, language, PSYMBOL_NAMESPACE (psym) = namespace; PSYMBOL_CLASS (psym) = class; SYMBOL_INIT_LANGUAGE_SPECIFIC (psym, language); + OBJSTAT (objfile, psyms++); } /* Add a symbol with a CORE_ADDR value to a psymtab. */ @@ -1687,6 +1688,7 @@ add_psymbol_addr_to_list (name, namelength, namespace, class, list, val, PSYMBOL_NAMESPACE (psym) = namespace; PSYMBOL_CLASS (psym) = class; SYMBOL_INIT_LANGUAGE_SPECIFIC (psym, language); + OBJSTAT (objfile, psyms++); } #endif /* !INLINE_ADD_PSYMBOL */ diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index ce36c9517a1..c94cb765408 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -848,13 +848,15 @@ static char *raw_symbol; /* This is the function which stabsread.c calls to get symbol continuations. */ static char * -xcoff_next_symbol_text () +xcoff_next_symbol_text (objfile) + struct objfile *objfile; { struct internal_syment symbol; static struct complaint msg = {"Unexpected symbol continuation", 0, 0}; char *retval; - struct objfile *objfile = this_symtab_psymtab->objfile; + /* FIXME: is this the same as the passed arg? */ + objfile = this_symtab_psymtab->objfile; bfd_coff_swap_sym_in (objfile->obfd, raw_symbol, &symbol); if (symbol.n_zeroes) -- 2.30.2