From 8357834fbec086011dbb4b445f63c03c9f4c6c1e Mon Sep 17 00:00:00 2001 From: Jim Kingdon Date: Sun, 13 Jun 1993 02:26:18 +0000 Subject: [PATCH] * dbxread.c (process_one_symbol): Set n_opt_found based on whether a non-gcc N_OPT symbol is found. Make SUN_FIXED_LBRAC_BUG a macro which returns 0 or 1 to say whether to do it. * config/sparc/sun4{sol2,os4}.h (SUN_FIXED_LBRAC_BUG,VARIABLES_INSIDE_BLOCK): Use n_opt_found so the right thing happens for both acc and SunOS4 /bin/cc. --- gdb/ChangeLog | 10 ++++++++++ gdb/config/sparc/tm-sun4os4.h | 16 ++++++++++++++++ gdb/config/sparc/tm-sun4sol2.h | 19 ++++++++++++------- gdb/dbxread.c | 23 +++++++++++------------ 4 files changed, 49 insertions(+), 19 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 256b5004922..5a55334b6c5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,15 @@ Sat Jun 12 14:40:54 1993 Jim Kingdon (kingdon@cygnus.com) + * dbxread.c (process_one_symbol): Set n_opt_found based on whether + a non-gcc N_OPT symbol is found. Make SUN_FIXED_LBRAC_BUG a macro + which returns 0 or 1 to say whether to do it. + * config/sparc/sun4{sol2,os4}.h + (SUN_FIXED_LBRAC_BUG,VARIABLES_INSIDE_BLOCK): Use n_opt_found so + the right thing happens for both acc and SunOS4 /bin/cc. + + * valprint.c (print_hex_chars): Use local_hex_format_{pre,suf}fix. + * printcmd.c (print_scalar_formatted): Use val_print_type_code_int. + * mips-tdep.c: Remove isa_NAN; it assumed sizeof(host int) == 4 and probably contained byte-order sins too. config/mips/tm-mips.h (INVALID_FLOAT): Define to 0 like most machines. diff --git a/gdb/config/sparc/tm-sun4os4.h b/gdb/config/sparc/tm-sun4os4.h index 613ed774c1e..52d2d139ee0 100644 --- a/gdb/config/sparc/tm-sun4os4.h +++ b/gdb/config/sparc/tm-sun4os4.h @@ -20,6 +20,22 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "sparc/tm-sparc.h" #include "tm-sunos.h" +/* Do variables in the debug stabs occur after the N_LBRAC or before it? + acc: after, gcc: before, SunOS4 /bin/cc: before. */ + +#define VARIABLES_INSIDE_BLOCK(desc, gcc_p) (!(gcc_p) && n_opt_found) + +/* For acc, there's no need to correct LBRAC entries by guessing how + they should work. In fact, this is harmful because the LBRAC + entries now all appear at the end of the function, not intermixed + with the SLINE entries. + + For binary from SunOS4 /bin/cc, need to correct LBRAC's. + + For gcc, doesn't matter, attempting the correction is harmless. */ + +#define SUN_FIXED_LBRAC_BUG (n_opt_found) + /* Offsets into jmp_buf. Not defined by Sun, but at least documented in a comment in ! */ diff --git a/gdb/config/sparc/tm-sun4sol2.h b/gdb/config/sparc/tm-sun4sol2.h index 25434f8acae..0cf93209e2b 100644 --- a/gdb/config/sparc/tm-sun4sol2.h +++ b/gdb/config/sparc/tm-sun4sol2.h @@ -23,16 +23,21 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #undef IN_SOLIB_TRAMPOLINE #define IN_SOLIB_TRAMPOLINE(pc, name) in_solib_trampoline((pc), (name)) -/* Variables in the debug stabs occur after the N_LBRAC, not before it, - in code generated by Sun C. */ +/* Do variables in the debug stabs occur after the N_LBRAC or before it? + acc: after, gcc: before, SunOS4 /bin/cc: before. */ -#define VARIABLES_INSIDE_BLOCK(desc, gcc_p) (!(gcc_p)) +#define VARIABLES_INSIDE_BLOCK(desc, gcc_p) (!(gcc_p) && n_opt_found) -/* There's no need to correct LBRAC entries by guessing how they should - work. In fact, this is harmful because the LBRAC entries now all appear - at the end of the function, not intermixed with the SLINE entries. */ +/* For acc, there's no need to correct LBRAC entries by guessing how + they should work. In fact, this is harmful because the LBRAC + entries now all appear at the end of the function, not intermixed + with the SLINE entries. -#define SUN_FIXED_LBRAC_BUG + For binary from SunOS4 /bin/cc, need to correct LBRAC's. + + For gcc, like acc, don't correct. */ + +#define SUN_FIXED_LBRAC_BUG (n_opt_found || processing_gcc_compilation) #if 0 /* FIXME Setjmp/longjmp are not as well doc'd in SunOS 5.x yet */ diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 14442844a5b..3e6b680e5c2 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -1465,12 +1465,11 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile) struct section_offsets *section_offsets; struct objfile *objfile; { -#ifndef SUN_FIXED_LBRAC_BUG /* This records the last pc address we've seen. We depend on there being an SLINE or FUN or SO before the first LBRAC, since the variable does not get reset in between reads of different symbol files. */ static CORE_ADDR last_pc_address; -#endif + register struct context_stack *new; /* This remembers the address of the start of a function. It is used because in Solaris 2, N_LBRAC, N_RBRAC, and N_SLINE entries are @@ -1484,6 +1483,10 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile) to the function start address. */ int block_address_function_relative; + /* If this is nonzero, we've seen a non-gcc N_OPT symbol for this source + file. */ + int n_opt_found; + /* This is true for Solaris (and all other stabs-in-elf systems, hopefully, since it would be silly to do things differently from Solaris), and false for SunOS4 and other a.out file formats. */ @@ -1541,9 +1544,7 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile) break; } -#ifndef SUN_FIXED_LBRAC_BUG last_pc_address = valu; /* Save for SunOS bug circumcision */ -#endif if (block_address_function_relative) /* On Solaris 2.0 compilers, the block addresses and N_SLINE's @@ -1586,13 +1587,11 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile) valu += last_source_start_addr; #endif -#ifndef SUN_FIXED_LBRAC_BUG - if (valu < last_pc_address) { + if (!SUN_FIXED_LBRAC_BUG && valu < last_pc_address) { /* Patch current LBRAC pc value to match last handy pc value */ complain (&lbrac_complaint); valu = last_pc_address; } -#endif new = push_context (desc, valu); break; @@ -1678,10 +1677,10 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile) /* Relocate for dynamic loading */ valu += ANOFFSET (section_offsets, SECT_OFF_TEXT); -#ifndef SUN_FIXED_LBRAC_BUG + n_opt_found = 0; + last_pc_address = valu; /* Save for SunOS bug circumcision */ -#endif - + #ifdef PCC_SOL_BROKEN /* pcc bug, occasionally puts out SO for SOL. */ if (context_stack_depth > 0) @@ -1739,9 +1738,7 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile) 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; -#ifndef SUN_FIXED_LBRAC_BUG last_pc_address = valu; /* Save for SunOS bug circumcision */ -#endif record_line (current_subfile, desc, valu); break; @@ -1861,6 +1858,8 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile) } #endif } + else + n_opt_found = 1; } break; -- 2.30.2