From c653bc6d90cec06c584d5335cade0c42222931dc Mon Sep 17 00:00:00 2001 From: John Gilmore Date: Fri, 5 Feb 1993 22:09:17 +0000 Subject: [PATCH] Fix long file name bug reported on SCO Open Desktop 2.0 by Ulf Lunde and Dag H. Wanvik . * coffread.c (getfilename): Eliminate COFF_NO_LONG_FILE_NAMES test, which is apparently left over from when we used native include files and couldn't depend on the member names being there. * tm-3b1.h, tm-altos.h, tm-i386v.h: Don't set it. ALso fix this in tm-i860.h which isn't ChangeLogged since it's sanitized out for lack of paperwork. --- gdb/ChangeLog | 16 ++++++++++++++++ gdb/coffread.c | 43 ++++++++++++++++++------------------------- gdb/tm-3b1.h | 8 ++------ gdb/tm-altos.h | 8 ++------ gdb/tm-i386v.h | 8 +------- gdb/tm-i860.h | 7 +------ 6 files changed, 40 insertions(+), 50 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4cba347..38d678c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,19 @@ +Fri Feb 5 14:01:22 1993 John Gilmore (gnu@cygnus.com) + + Fix long file name bug reported on SCO Open Desktop 2.0 by Ulf Lunde + and Dag H. Wanvik . + + * coffread.c (getfilename): Eliminate COFF_NO_LONG_FILE_NAMES + test, which is apparently left over from when we used native + include files and couldn't depend on the member names being there. + * tm-3b1.h, tm-altos.h, tm-i386v.h: Don't set it. + +Thu Feb 4 12:23:15 1993 Ian Lance Taylor (ian@cygnus.com) + + * mipsread.c: Major overhaul to use new BFD symbol table reading + routines. Now swaps information as it is needed, rather than + swapping everything when the file is read. + Thu Feb 4 01:52:36 1993 John Gilmore (gnu@cygnus.com) * Makefile.in (TARDIRS): Add sparclite demo dir. diff --git a/gdb/coffread.c b/gdb/coffread.c index 62e20d3..f7a1b16 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -1013,7 +1013,7 @@ read_coff_symtab (symtab_offset, nsyms, objfile) case C_STAT: if (cs->c_name[0] == '.') { - if (strcmp (cs->c_name, ".text") == 0) { + if (STREQ (cs->c_name, ".text")) { /* FIXME: don't wire in ".text" as section name or symbol name! */ if (++num_object_files == 1) { @@ -1068,7 +1068,7 @@ read_coff_symtab (symtab_offset, nsyms, objfile) break; case C_FCN: - if (strcmp (cs->c_name, ".bf") == 0) + if (STREQ (cs->c_name, ".bf")) { within_function = 1; @@ -1091,7 +1091,7 @@ read_coff_symtab (symtab_offset, nsyms, objfile) new->name = process_coff_symbol (&fcn_cs_saved, &fcn_aux_saved, objfile); } - else if (strcmp (cs->c_name, ".ef") == 0) + else if (STREQ (cs->c_name, ".ef")) { /* the value of .ef is the address of epilogue code; * not useful for gdb @@ -1137,7 +1137,7 @@ read_coff_symtab (symtab_offset, nsyms, objfile) break; case C_BLOCK: - if (strcmp (cs->c_name, ".bb") == 0) + if (STREQ (cs->c_name, ".bb")) { new = (struct coff_context_stack *) xmalloc (sizeof (struct coff_context_stack)); @@ -1151,7 +1151,7 @@ read_coff_symtab (symtab_offset, nsyms, objfile) new->name = 0; coff_local_symbols = 0; } - else if (strcmp (cs->c_name, ".eb") == 0) + else if (STREQ (cs->c_name, ".eb")) { new = coff_context_stack; if (new == 0 || depth != new->depth) @@ -1366,6 +1366,10 @@ getsymname (symbol_entry) return result; } +/* Extract the file name from the aux entry of a C_FILE symbol. Return + only the last component of the name. Result is in static storage and + is only good for temporary use. */ + static char * getfilename (aux_entry) union internal_auxent *aux_entry; @@ -1374,24 +1378,11 @@ getfilename (aux_entry) register char *temp; char *result; -#ifndef COFF_NO_LONG_FILE_NAMES -#if defined (x_zeroes) - /* Data General. */ - if (aux_entry->x_zeroes == 0) - strcpy (buffer, stringtab + aux_entry->x_offset); -#else /* no x_zeroes */ if (aux_entry->x_file.x_n.x_zeroes == 0) strcpy (buffer, stringtab + aux_entry->x_file.x_n.x_offset); -#endif /* no x_zeroes */ else -#endif /* COFF_NO_LONG_FILE_NAMES */ { -#if defined (x_name) - /* Data General. */ - strncpy (buffer, aux_entry->x_name, FILNMLEN); -#else strncpy (buffer, aux_entry->x_file.x_fname, FILNMLEN); -#endif buffer[FILNMLEN] = '\0'; } result = buffer; @@ -1535,7 +1526,7 @@ patch_opaque_types (s) for (sym = opaque_type_chain[hash]; sym;) { if (name[0] == SYMBOL_NAME (sym)[0] && - !strcmp (name + 1, SYMBOL_NAME (sym) + 1)) + STREQ (name + 1, SYMBOL_NAME (sym) + 1)) { if (prev) { @@ -1574,14 +1565,16 @@ process_coff_symbol (cs, aux, objfile) struct objfile *objfile; { register struct symbol *sym - = (struct symbol *) obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol)); + = (struct symbol *) obstack_alloc (&objfile->symbol_obstack, + sizeof (struct symbol)); char *name; struct type *temptype; memset (sym, 0, sizeof (struct symbol)); name = cs->c_name; name = EXTERNAL_NAME (name, objfile->obfd); - SYMBOL_NAME (sym) = obstack_copy0 (&objfile->symbol_obstack, name, strlen (name)); + SYMBOL_NAME (sym) = obstack_copy0 (&objfile->symbol_obstack, name, + strlen (name)); /* default assumptions */ SYMBOL_VALUE (sym) = cs->c_value; @@ -2135,10 +2128,10 @@ coff_read_enum_type (index, length, lastsym) } /* Is this Modula-2's BOOLEAN type? Flag it as such if so. */ if(TYPE_NFIELDS(type) == 2 && - ((!strcmp(TYPE_FIELD_NAME(type,0),"TRUE") && - !strcmp(TYPE_FIELD_NAME(type,1),"FALSE")) || - (!strcmp(TYPE_FIELD_NAME(type,1),"TRUE") && - !strcmp(TYPE_FIELD_NAME(type,0),"FALSE")))) + ((STREQ(TYPE_FIELD_NAME(type,0),"TRUE") && + STREQ(TYPE_FIELD_NAME(type,1),"FALSE")) || + (STREQ(TYPE_FIELD_NAME(type,1),"TRUE") && + STREQ(TYPE_FIELD_NAME(type,0),"FALSE")))) TYPE_CODE(type) = TYPE_CODE_BOOL; return type; } diff --git a/gdb/tm-3b1.h b/gdb/tm-3b1.h index 4bcf01f..281b1d3 100644 --- a/gdb/tm-3b1.h +++ b/gdb/tm-3b1.h @@ -1,5 +1,5 @@ -/* Parameters for targeting to a 3b1. - Copyright (C) 1986, 1987, 1989, 1991 Free Software Foundation, Inc. +/* Parameters for targeting GDB to a 3b1. + Copyright 1986, 1987, 1989, 1991, 1993 Free Software Foundation, Inc. This file is part of GDB. @@ -27,10 +27,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define NAMES_HAVE_UNDERSCORE -/* Debugger information will be in COFF format, without long filenames. */ - -#define COFF_NO_LONG_FILE_NAMES - /* Address of end of stack space. */ #define STACK_END_ADDR 0x300000 diff --git a/gdb/tm-altos.h b/gdb/tm-altos.h index f3cc306..bc0ca81 100644 --- a/gdb/tm-altos.h +++ b/gdb/tm-altos.h @@ -1,5 +1,5 @@ -/* Definitions to make GDB run on an Altos 3068 (m68k running SVR2) - Copyright (C) 1987, 1989, 1991 Free Software Foundation, Inc. +/* Target definitions for GDB on an Altos 3068 (m68k running SVR2) + Copyright 1987, 1989, 1991, 1993 Free Software Foundation, Inc. This file is part of GDB. @@ -27,10 +27,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #undef NAMES_HAVE_UNDERSCORE -/* COFF files don't have long filenames. */ - -#define COFF_NO_LONG_FILE_NAMES - /* Address of end of stack space. */ /*#define STACK_END_ADDR (0xffffff)*/ diff --git a/gdb/tm-i386v.h b/gdb/tm-i386v.h index bfd0e35..e317ca2 100644 --- a/gdb/tm-i386v.h +++ b/gdb/tm-i386v.h @@ -1,5 +1,5 @@ /* Macro definitions for i386, Unix System V. - Copyright 1986, 1987, 1989, 1991, 1992 Free Software Foundation, Inc. + Copyright 1986, 1987, 1989, 1991, 1992, 1993 Free Software Foundation, Inc. This file is part of GDB. @@ -27,12 +27,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define TARGET_BYTE_ORDER LITTLE_ENDIAN -/* define this if you don't have the extension to coff that allows - * file names to appear in the string table - * (aux.x_file.x_foff) - */ -#define COFF_NO_LONG_FILE_NAMES - /* turn this on when rest of gdb is ready */ #define IEEE_FLOAT diff --git a/gdb/tm-i860.h b/gdb/tm-i860.h index b26e205..18ab975 100644 --- a/gdb/tm-i860.h +++ b/gdb/tm-i860.h @@ -1,5 +1,5 @@ /* Parameters for execution on the Intel I860 for GDB, the GNU debugger. - Copyright (C) 1986, 1987 Free Software Foundation, Inc. + Copyright 1986, 1987, 1993 Free Software Foundation, Inc. GDB is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. No author or distributor accepts responsibility to anyone @@ -25,11 +25,6 @@ anyone else from sharing it farther. Help stamp out software hoarding! #define HAVE_TERMIO #define vfork fork -/* Debugger information will be in COFF format. */ - -/* #define COFF_FORMAT */ -#define COFF_NO_LONG_FILE_NAMES - /* Offset from address of function to start of its code. Zero on most machines. */ -- 2.7.4