From 50e0dc4198cd5a873deeae34cf9718e805049693 Mon Sep 17 00:00:00 2001 From: Fred Fish Date: Thu, 25 Jun 1992 19:10:49 +0000 Subject: [PATCH] * mipsread.c: Pass NULL name pointer to init_type, not 0. * gdbtypes.c (init_type): Use copy of typename on type_obstack. * dwarfread.c (enum_type): Save enum names on type_obstack. * dwarfread.c (struct_type): Save member name on type_obstack. * symtab.c (_initialize_symtab): Fix misspelling. * regex.c (store_jump, insert_jump): Return void. --- gdb/ChangeLog | 9 +++++++++ gdb/dwarfread.c | 7 +++++-- gdb/gdbtypes.c | 17 +++++++++++++++-- gdb/mipsread.c | 18 ++++++++---------- gdb/regex.c | 6 +++--- gdb/symtab.c | 2 +- 6 files changed, 41 insertions(+), 18 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index afd576b6ccb..5cf89e9a2d6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +Thu Jun 25 12:06:00 1992 Fred Fish (fnf@cygnus.com) + + * mipsread.c: Pass NULL name pointer to init_type, not 0. + * gdbtypes.c (init_type): Use copy of typename on type_obstack. + * dwarfread.c (enum_type): Save enum names on type_obstack. + * dwarfread.c (struct_type): Save member name on type_obstack. + * symtab.c (_initialize_symtab): Fix misspelling. + * regex.c (store_jump, insert_jump): Return void. + Thu Jun 25 04:00:10 1992 John Gilmore (gnu at cygnus.com) * defs.h (PARAMS): Move to ../include/ansidecl.h. diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c index eb120bc3c66..3c7c2016348 100644 --- a/gdb/dwarfread.c +++ b/gdb/dwarfread.c @@ -853,7 +853,9 @@ struct_type (dip, thisdie, enddie, objfile) new -> next = list; list = new; /* Save the data. */ - list -> field.name = savestring (mbr.at_name, strlen (mbr.at_name)); + list -> field.name = + obsavestring (mbr.at_name, strlen (mbr.at_name), + &objfile -> type_obstack); list -> field.type = decode_die_type (&mbr); list -> field.bitpos = 8 * locval (mbr.at_location); /* Handle bit fields. */ @@ -1440,7 +1442,8 @@ enum_type (dip, objfile) target_to_host (scan, TARGET_FT_LONG_SIZE (objfile), GET_SIGNED, objfile); scan += TARGET_FT_LONG_SIZE (objfile); - list -> field.name = savestring (scan, strlen (scan)); + list -> field.name = obsavestring (scan, strlen (scan), + &objfile -> type_obstack); scan += strlen (scan) + 1; nfields++; /* Handcraft a new symbol for this enum member. */ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 8af9e8539e7..2407efac1c3 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -845,7 +845,12 @@ allocate_cplus_struct_type (type) } } -/* Helper function to initialize the standard scalar types. */ +/* Helper function to initialize the standard scalar types. + + If NAME is non-NULL and OBJFILE is non-NULL, then we make a copy + of the string pointed to by name in the type_obstack for that objfile, + and initialize the type name to that copy. There are places (mipsread.c + in particular, where init_type is called with a NULL value for NAME). */ struct type * init_type (code, length, flags, name, objfile) @@ -861,7 +866,15 @@ init_type (code, length, flags, name, objfile) TYPE_CODE (type) = code; TYPE_LENGTH (type) = length; TYPE_FLAGS (type) |= flags; - TYPE_NAME (type) = name; + if ((name != NULL) && (objfile != NULL)) + { + TYPE_NAME (type) = + obsavestring (name, strlen (name), &objfile -> type_obstack); + } + else + { + TYPE_NAME (type) = name; + } /* C++ fancies. */ diff --git a/gdb/mipsread.c b/gdb/mipsread.c index 89fe0500e22..dd3171e0648 100644 --- a/gdb/mipsread.c +++ b/gdb/mipsread.c @@ -67,12 +67,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include -#include - -/* Undo brain-damage in some that '#define index strchr'. - Note that tm-mips.h includes coff/sym.h, which has a structure with a - member named 'index'. */ -#undef index #include "coff/mips.h" /* COFF-like aspects of ecoff files */ #include "coff/ecoff-ext.h" /* External forms of ecoff sym structures */ @@ -1455,7 +1449,8 @@ parse_type(ax, bs, bigend) ax += cross_ref(ax, &tp, type_code, &pn, bigend); /* reading .o file ? */ if (UNSAFE_DATA_ADDR(tp)) - tp = init_type(type_code, 0, 0, 0, (struct objfile *) NULL); + tp = init_type(type_code, 0, 0, (char *) NULL, + (struct objfile *) NULL); /* SOMEONE OUGHT TO FIX DBXREAD TO DROP "STRUCT" */ sprintf(name, fmt, pn); @@ -1545,7 +1540,8 @@ upgrade_type(tpp, tq, ax, bigend) case tqArray: off = 0; - t = init_type(TYPE_CODE_ARRAY, 0, 0, 0, (struct objfile *) NULL); + t = init_type(TYPE_CODE_ARRAY, 0, 0, (char *) NULL, + (struct objfile *) NULL); TYPE_TARGET_TYPE(t) = *tpp; /* Determine and record the domain type (type of index) */ @@ -2580,7 +2576,8 @@ cross_ref(ax, tpp, type_code, pname, bigend) if (p) *tpp = p->t; else { - *tpp = init_type(type_code, 0, 0, 0, (struct objfile *) NULL); + *tpp = init_type(type_code, 0, 0, (char *) NULL, + (struct objfile *) NULL); add_pending(fh, sh, *tpp); } } @@ -2997,7 +2994,8 @@ fixup_sigtramp() */ SYMBOL_NAMESPACE(s) = VAR_NAMESPACE; SYMBOL_CLASS(s) = LOC_BLOCK; - SYMBOL_TYPE(s) = init_type(TYPE_CODE_FUNC, 4, 0, 0, (struct objfile *) NULL); + SYMBOL_TYPE(s) = init_type(TYPE_CODE_FUNC, 4, 0, (char *) NULL, + (struct objfile *) NULL); TYPE_TARGET_TYPE(SYMBOL_TYPE(s)) = builtin_type_void; /* Need a block to allocate .gdbinfo. in */ diff --git a/gdb/regex.c b/gdb/regex.c index a4c9e26b5cb..59695cfd8d3 100644 --- a/gdb/regex.c +++ b/gdb/regex.c @@ -177,7 +177,7 @@ re_set_syntax (syntax) pending_exact += c; \ } -static int store_jump (), insert_jump (); +static void store_jump (), insert_jump (); char * re_compile_pattern (pattern, size, bufp) @@ -659,7 +659,7 @@ re_compile_pattern (pattern, size, bufp) /* Store where `from' points a jump operation to jump to where `to' points. `opcode' is the opcode to store. */ -static int +static void store_jump (from, opcode, to) char *from, *to; char opcode; @@ -676,7 +676,7 @@ store_jump (from, opcode, to) If you call this function, you must zero out pending_exact. */ -static int +static void insert_jump (op, from, to, current_end) char op; char *from, *to, *current_end; diff --git a/gdb/symtab.c b/gdb/symtab.c index 82a0413c548..7c7f3b03d9a 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -2782,7 +2782,7 @@ _initialize_symtab () #if 0 add_info ("methods", methods_info, "All method names, or those matching REGEXP::REGEXP.\n\ -If the class qualifier is ommited, it is assumed to be the current scope.\n\ +If the class qualifier is omitted, it is assumed to be the current scope.\n\ If the first REGEXP is omitted, then all methods matching the second REGEXP\n\ are listed."); #endif -- 2.30.2