diff -ru gdb-20000610/gdb/Makefile.in gdb-new/gdb/Makefile.in --- gdb-20000610/gdb/Makefile.in Thu Jun 8 13:31:08 2000 +++ gdb-new/gdb/Makefile.in Sun Aug 20 12:43:50 2000 @@ -1068,7 +1068,7 @@ arm-linux-nat.c arm-linux-tdep.c arm-tdep.c arm-xdep.c \ coff-solib.c convex-tdep.c convex-xdep.c \ core-sol2.c core-regset.c core-aout.c corelow.c \ - dcache.c delta68-nat.c dpx2-nat.c dstread.c exec.c fork-child.c \ + dcache.c delta68-nat.c dpx2-nat.c dstread.c tdsread.c exec.c fork-child.c \ go32-nat.c h8300-tdep.c h8500-tdep.c \ hp300ux-nat.c hppa-tdep.c hppab-nat.c hppah-nat.c \ hp-psymtab-read.c hp-symtab-read.c \ diff -ru gdb-20000610/gdb/c-typeprint.c gdb-new/gdb/c-typeprint.c --- gdb-20000610/gdb/c-typeprint.c Sat Feb 5 18:29:40 2000 +++ gdb-new/gdb/c-typeprint.c Sun Aug 20 12:44:08 2000 @@ -46,7 +46,7 @@ char *varstring, int staticp, struct ui_file *stream); -static void c_type_print_args (struct type *, struct ui_file *); +void c_type_print_args (struct type *, struct ui_file *); static void cp_type_print_derivation_info (struct ui_file *, struct type *); @@ -385,7 +385,7 @@ -static void +void c_type_print_args (type, stream) struct type *type; struct ui_file *stream; diff -ru gdb-20000610/gdb/config/i386/cygwin.mh gdb-new/gdb/config/i386/cygwin.mh --- gdb-20000610/gdb/config/i386/cygwin.mh Fri Apr 16 11:34:18 1999 +++ gdb-new/gdb/config/i386/cygwin.mh Sun Aug 20 12:44:44 2000 @@ -1,6 +1,6 @@ MH_CFLAGS= XM_FILE=xm-cygwin.h XDEPFILES=ser-tcp.o -NATDEPFILES= win32-nat.o +NATDEPFILES= win32-nat.o tdsread.o borldem.o NAT_FILE=../nm-empty.h XM_CLIBS= diff -ru gdb-20000610/gdb/gdbtypes.c gdb-new/gdb/gdbtypes.c --- gdb-20000610/gdb/gdbtypes.c Sun May 28 11:12:28 2000 +++ gdb-new/gdb/gdbtypes.c Sun Aug 20 12:45:10 2000 @@ -95,6 +95,22 @@ static void print_cplus_stuff (struct type *, int); static void virtual_base_list_aux (struct type *dclass); +/* Central place to initialize a type - before this was only done + in alloc_type, but that's not the only place a type can come + from */ + +void +init_empty_type (objfile, type) + struct objfile *objfile; + struct type *type; +{ + memset ((char *) type, 0, sizeof (struct type)); + TYPE_CODE (type) = TYPE_CODE_UNDEF; + TYPE_OBJFILE (type) = objfile; + TYPE_VPTR_FIELDNO (type) = -1; + TYPE_CV_TYPE (type) = type; /* chain back to itself */ +} + /* Alloc a new type structure and fill it with some defaults. If OBJFILE is non-NULL, then allocate the space for the type structure @@ -118,14 +134,10 @@ sizeof (struct type)); OBJSTAT (objfile, n_types++); } - memset ((char *) type, 0, sizeof (struct type)); /* Initialize the fields that might not be zero. */ - TYPE_CODE (type) = TYPE_CODE_UNDEF; - TYPE_OBJFILE (type) = objfile; - TYPE_VPTR_FIELDNO (type) = -1; - TYPE_CV_TYPE (type) = type; /* chain back to itself */ + init_empty_type (objfile, type); return (type); } @@ -141,7 +153,6 @@ struct type **typeptr; { register struct type *ntype; /* New type */ - struct objfile *objfile; ntype = TYPE_POINTER_TYPE (type); @@ -166,9 +177,7 @@ /* We have storage, but need to reset it. */ { ntype = *typeptr; - objfile = TYPE_OBJFILE (ntype); - memset ((char *) ntype, 0, sizeof (struct type)); - TYPE_OBJFILE (ntype) = objfile; + init_empty_type (TYPE_OBJFILE (ntype), ntype); } TYPE_TARGET_TYPE (ntype) = type; @@ -234,9 +243,7 @@ /* We have storage, but need to reset it. */ { ntype = *typeptr; - objfile = TYPE_OBJFILE (ntype); - memset ((char *) ntype, 0, sizeof (struct type)); - TYPE_OBJFILE (ntype) = objfile; + init_empty_type (TYPE_OBJFILE (ntype), ntype); } TYPE_TARGET_TYPE (ntype) = type; @@ -274,7 +281,6 @@ struct type **typeptr; { register struct type *ntype; /* New type */ - struct objfile *objfile; if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */ { @@ -286,9 +292,7 @@ /* We have storage, but need to reset it. */ { ntype = *typeptr; - objfile = TYPE_OBJFILE (ntype); - memset ((char *) ntype, 0, sizeof (struct type)); - TYPE_OBJFILE (ntype) = objfile; + init_empty_type (TYPE_OBJFILE (ntype), ntype); } TYPE_TARGET_TYPE (ntype) = type; @@ -330,7 +334,6 @@ { register struct type *ntype; /* New type */ register struct type *tmp_type = type; /* tmp type */ - struct objfile *objfile; ntype = TYPE_CV_TYPE (type); @@ -358,12 +361,13 @@ *typeptr = ntype; } else - /* We have storage, but need to reset it. */ + /* We have storage - we do NOT need to reset it here - the memcpy + below will overwrite it. + FIXME - make_pointer_type and make_reference_type preserve + ntype->objfile, but make_cv_type copies it from type->objfile. + which is correct? */ { ntype = *typeptr; - objfile = TYPE_OBJFILE (ntype); - /* memset ((char *) ntype, 0, sizeof (struct type)); */ - TYPE_OBJFILE (ntype) = objfile; } /* Copy original type */ @@ -696,12 +700,7 @@ struct type *domain; struct type *to_type; { - struct objfile *objfile; - - objfile = TYPE_OBJFILE (type); - - memset ((char *) type, 0, sizeof (struct type)); - TYPE_OBJFILE (type) = objfile; + init_empty_type (TYPE_OBJFILE (type), type); TYPE_TARGET_TYPE (type) = to_type; TYPE_DOMAIN_TYPE (type) = domain; TYPE_LENGTH (type) = 1; /* In practice, this is never needed. */ @@ -722,12 +721,7 @@ struct type *to_type; struct type **args; { - struct objfile *objfile; - - objfile = TYPE_OBJFILE (type); - - memset ((char *) type, 0, sizeof (struct type)); - TYPE_OBJFILE (type) = objfile; + init_empty_type (TYPE_OBJFILE (type), type); TYPE_TARGET_TYPE (type) = to_type; TYPE_DOMAIN_TYPE (type) = domain; TYPE_ARG_TYPES (type) = args; @@ -1645,6 +1639,7 @@ { register struct type **typep; register int nbytes; + int i; if (typeid < 0 || typeid >= FT_NUM_MEMBERS) { @@ -1659,7 +1654,7 @@ nbytes = FT_NUM_MEMBERS * sizeof (struct type *); objfile->fundamental_types = (struct type **) obstack_alloc (&objfile->type_obstack, nbytes); - memset ((char *) objfile->fundamental_types, 0, nbytes); + memset (objfile->fundamental_types, 0, nbytes); OBJSTAT (objfile, n_types += FT_NUM_MEMBERS); } diff -ru gdb-20000610/gdb/gdbtypes.h gdb-new/gdb/gdbtypes.h --- gdb-20000610/gdb/gdbtypes.h Sun May 28 11:12:28 2000 +++ gdb-new/gdb/gdbtypes.h Sat Aug 19 12:48:24 2000 @@ -947,6 +947,8 @@ extern struct type *alloc_type (struct objfile *); +extern void init_empty_type (struct objfile *objfile, struct type *type); + extern struct type *init_type (enum type_code, int, int, char *, struct objfile *); diff -ru gdb-20000610/gdb/main.c gdb-new/gdb/main.c --- gdb-20000610/gdb/main.c Sun May 28 11:12:28 2000 +++ gdb-new/gdb/main.c Sat Aug 19 12:48:20 2000 @@ -470,7 +470,8 @@ switch (++count) { case 1: - symarg = argv[optind]; + if (!symarg) /* --symbols should take precedence! */ + symarg = argv[optind]; execarg = argv[optind]; break; case 2: Only in gdb-new/gdb: main.o Only in gdb-new/gdb: maint.o Only in gdb-new/gdb: mdebugread.o Only in gdb-new/gdb: mem-break.o diff -ru gdb-20000610/gdb/minsyms.c gdb-new/gdb/minsyms.c --- gdb-20000610/gdb/minsyms.c Sun May 28 11:12:28 2000 +++ gdb-new/gdb/minsyms.c Sun Aug 20 12:45:32 2000 @@ -593,7 +593,7 @@ msym_bunch_index = BUNCH_SIZE; } -void +struct minimal_symbol * prim_record_minimal_symbol (name, address, ms_type, objfile) const char *name; CORE_ADDR address; @@ -621,8 +621,8 @@ section = -1; } - prim_record_minimal_symbol_and_info (name, address, ms_type, - NULL, section, NULL, objfile); + return prim_record_minimal_symbol_and_info (name, address, ms_type, + NULL, section, NULL, objfile); } /* Record a minimal symbol in the msym bunches. Returns the symbol @@ -902,7 +902,11 @@ for (bindex = 0; bindex < msym_bunch_index; bindex++, mcount++) { msymbols[mcount] = bunch->contents[bindex]; - SYMBOL_LANGUAGE (&msymbols[mcount]) = language_auto; + /* Don't set the symbol language to auto if the symbol + reader set it already - we may be throwing out + important information */ + if (SYMBOL_LANGUAGE (&msymbols[mcount]) == language_unknown) + SYMBOL_LANGUAGE (&msymbols[mcount]) = language_auto; if (SYMBOL_NAME (&msymbols[mcount])[0] == leading_char) { SYMBOL_NAME (&msymbols[mcount])++; @@ -952,10 +956,15 @@ for (; mcount-- > 0; msymbols++) { - SYMBOL_INIT_DEMANGLED_NAME (msymbols, &objfile->symbol_obstack); + /* Don't demangle again if the symbol table reader did it + already - the symbol table reader probably knows best + how to demangle a symbol it reads in! */ + if (SYMBOL_DEMANGLED_NAME (msymbols) == NULL + || SYMBOL_DEMANGLED_NAME (msymbols) == SYMBOL_NAME (msymbols)) + SYMBOL_INIT_DEMANGLED_NAME (msymbols, &objfile->symbol_obstack); if (SYMBOL_DEMANGLED_NAME (msymbols) != NULL) - add_minsym_to_demangled_hash_table (msymbols, - objfile->msymbol_demangled_hash); + add_minsym_to_demangled_hash_table (msymbols, + objfile->msymbol_demangled_hash); } } } diff -ru gdb-20000610/gdb/symfile.c gdb-new/gdb/symfile.c --- gdb-20000610/gdb/symfile.c Sun Jun 4 10:41:10 2000 +++ gdb-new/gdb/symfile.c Sun Aug 20 12:46:12 2000 @@ -1094,6 +1094,7 @@ /* It'll be freed in free_objfile(). */ sym_bfd = bfd_fdopenr (name, gnutarget, desc); + sym_bfd->opened_for_symbols = true; if (!sym_bfd) { close (desc); diff -ru gdb-20000610/gdb/symtab.h gdb-new/gdb/symtab.h --- gdb-20000610/gdb/symtab.h Tue Jun 6 06:49:54 2000 +++ gdb-new/gdb/symtab.h Sat Aug 19 12:58:30 2000 @@ -1198,9 +1198,10 @@ /* Functions for dealing with the minimal symbol table, really a misc address<->symbol mapping for things we don't have debug symbols for. */ -extern void prim_record_minimal_symbol (const char *, CORE_ADDR, - enum minimal_symbol_type, - struct objfile *); +extern struct minimal_symbol * prim_record_minimal_symbol + (const char *, CORE_ADDR, + enum minimal_symbol_type, + struct objfile *); extern struct minimal_symbol *prim_record_minimal_symbol_and_info (const char *, CORE_ADDR,