From: Peter Schauer Date: Sun, 28 Jun 1998 18:36:50 +0000 (+0000) Subject: Improve support for SunPro F77. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=655a27b0993a240c5ebcefee95b4be1f95b77f28;p=binutils-gdb.git Improve support for SunPro F77. * dbxread.c (end_psymtab, process_one_symbol): Handle minimal symbols with trailing underscore names. * minsyms.c (find_stab_function_addr): Ditto. * dbxread.c (process_one_symbol): Ignore N_ALIAS for now. * partial-stab.h (case N_ALIAS): Ditto. * stabsread.c (read_sun_builtin_type): Handle boolean types. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6f09a090253..b84050eaae1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +Sun Jun 28 11:35:48 1998 Peter Schauer + + Improve support for SunPro F77. + * dbxread.c (end_psymtab, process_one_symbol): Handle minimal + symbols with trailing underscore names. + * minsyms.c (find_stab_function_addr): Ditto. + * dbxread.c (process_one_symbol): Ignore N_ALIAS for now. + * partial-stab.h (case N_ALIAS): Ditto. + * stabsread.c (read_sun_builtin_type): Handle boolean types. + Fri Jun 26 14:03:01 1998 Keith Seitz * symtab.h (enum namespace): Add new namespaces FUNCTIONS_NAMESPACE, diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 5d9ddc70f16..63613cbae34 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -1,5 +1,5 @@ /* Read dbx symbol tables and convert to internal format, for GDB. - Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996 + Copyright 1986, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. This file is part of GDB. @@ -1448,11 +1448,20 @@ end_psymtab (pst, include_list, num_includes, capping_symbol_offset, if (p == NULL) p = last_function_name; n = p - last_function_name; - p = alloca (n + 1); + p = alloca (n + 2); strncpy (p, last_function_name, n); p[n] = 0; minsym = lookup_minimal_symbol (p, pst->filename, objfile); + if (minsym == NULL) + { + /* Sun Fortran appends an underscore to the minimal symbol name, + try again with an appended underscore if the minimal symbol + was not found. */ + p[n] = '_'; + p[n + 1] = 0; + minsym = lookup_minimal_symbol (p, pst->filename, objfile); + } if (minsym) pst->texthigh = SYMBOL_VALUE_ADDRESS (minsym) + MSYMBOL_SIZE (minsym); @@ -1922,6 +1931,10 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile) finish_block (new->name, &local_symbols, new->old_blocks, new->start_addr, new->start_addr + valu, objfile); + + if (block_address_function_relative) + function_start_offset = 0; + break; } @@ -2114,8 +2127,10 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile) /* This type of "symbol" really just records one line-number -- core-address correspondence. Enter it in the line list for this symbol table. */ + /* Relocate for dynamic loading and for ELF acc fn-relative syms. */ valu += function_start_offset; + #ifdef SUN_FIXED_LBRAC_BUG last_pc_address = valu; /* Save for SunOS bug circumcision */ #endif @@ -2260,12 +2275,22 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile) if (p == NULL) p = name; n = p - name; - p = alloca (n + 1); + p = alloca (n + 2); strncpy (p, name, n); p[n] = 0; msym = lookup_minimal_symbol (p, last_source_file, objfile); + if (msym == NULL) + { + /* Sun Fortran appends an underscore to the minimal + symbol name, try again with an appended underscore + if the minimal symbol was not found. */ + p[n] = '_'; + p[n + 1] = 0; + msym = lookup_minimal_symbol (p, last_source_file, + objfile); + } if (msym) valu = SYMBOL_VALUE_ADDRESS (msym); } @@ -2381,6 +2406,7 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile) file's symbols at once. */ case N_ENDM: /* Solaris 2: End of module */ case N_MAIN: /* Name of main routine. */ + case N_ALIAS: /* SunPro F77: alias name, ignore for now. */ break; } diff --git a/gdb/minsyms.c b/gdb/minsyms.c index 04257c6b99c..30ecc908958 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -1,5 +1,5 @@ /* GDB routines for manipulating the minimal symbol tables. - Copyright 1992, 1993, 1994, 1996, 1996 Free Software Foundation, Inc. + Copyright 1992, 93, 94, 96, 97, 1998 Free Software Foundation, Inc. Contributed by Cygnus Support, using pieces from other GDB modules. This file is part of GDB. @@ -452,11 +452,20 @@ find_stab_function_addr (namestring, pst, objfile) if (p == NULL) p = namestring; n = p - namestring; - p = alloca (n + 1); + p = alloca (n + 2); strncpy (p, namestring, n); p[n] = 0; msym = lookup_minimal_symbol (p, pst->filename, objfile); + if (msym == NULL) + { + /* Sun Fortran appends an underscore to the minimal symbol name, + try again with an appended underscore if the minimal symbol + was not found. */ + p[n] = '_'; + p[n + 1] = 0; + msym = lookup_minimal_symbol (p, pst->filename, objfile); + } return msym == NULL ? 0 : SYMBOL_VALUE_ADDRESS (msym); } #endif /* SOFUN_ADDRESS_MAYBE_MISSING */ diff --git a/gdb/partial-stab.h b/gdb/partial-stab.h index 15c5a00855d..d74c1c9ca5f 100644 --- a/gdb/partial-stab.h +++ b/gdb/partial-stab.h @@ -1,5 +1,5 @@ /* Shared code to pre-read a stab (dbx-style), when building a psymtab. - Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996 + Copyright 1986, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. This file is part of GDB. @@ -795,6 +795,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ case N_LBRAC: case N_NSYMS: /* Ultrix 4.0: symbol count */ case N_DEFD: /* GNU Modula-2 */ + case N_ALIAS: /* SunPro F77: alias name, ignore for now. */ case N_OBJ: /* useless types from Solaris */ case N_OPT: diff --git a/gdb/stabsread.c b/gdb/stabsread.c index be562e50a18..aa99708b764 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -4282,8 +4282,9 @@ read_enum_type (pp, type, objfile) /* Sun's ACC uses a somewhat saner method for specifying the builtin typedefs in every file (for int, long, etc): - type = b ; ; - signed = u or s. Possible c in addition to u or s (for char?). + type = b ; ; + signed = u or s. + optional format type = c or b for char or boolean. offset = offset from high order bit to start bit of type. width is # bytes in object of this type, nbits is # bits in type. @@ -4300,6 +4301,7 @@ read_sun_builtin_type (pp, typenums, objfile) int type_bits; int nbits; int signed_type; + enum type_code code = TYPE_CODE_INT; switch (**pp) { @@ -4317,10 +4319,16 @@ read_sun_builtin_type (pp, typenums, objfile) /* For some odd reason, all forms of char put a c here. This is strange because no other type has this honor. We can safely ignore this because we actually determine 'char'acterness by the number of bits specified in - the descriptor. */ + the descriptor. + Boolean forms, e.g Fortran logical*X, put a b here. */ if (**pp == 'c') (*pp)++; + else if (**pp == 'b') + { + code = TYPE_CODE_BOOL; + (*pp)++; + } /* The first number appears to be the number of bytes occupied by this type, except that unsigned short is 4 instead of 2. @@ -4353,7 +4361,7 @@ read_sun_builtin_type (pp, typenums, objfile) signed_type ? 0 : TYPE_FLAG_UNSIGNED, (char *)NULL, objfile); else - return init_type (TYPE_CODE_INT, + return init_type (code, type_bits / TARGET_CHAR_BIT, signed_type ? 0 : TYPE_FLAG_UNSIGNED, (char *)NULL, objfile);