From 649694ea87ae0cbd4355ac0d68f27e6052fc10e4 Mon Sep 17 00:00:00 2001 From: Jim Kingdon Date: Sat, 26 Mar 1994 16:00:02 +0000 Subject: [PATCH] * config/sparc/tm-sparc.h: Define USE_REGISTER_NOT_ARG. * stabsread (define_symbol): If USE_REGISTER_NOT_ARG, go back to combining all 'p' and 'r' pairs into a LOC_REGPARM. --- gdb/ChangeLog | 4 ++++ gdb/config/sparc/tm-sparc.h | 6 ++++++ gdb/stabsread.c | 14 ++++++++++---- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 40c8114..4d91aea 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ Sat Mar 26 07:05:18 1994 Jim Kingdon (kingdon@lioth.cygnus.com) + * config/sparc/tm-sparc.h: Define USE_REGISTER_NOT_ARG. + * stabsread (define_symbol): If USE_REGISTER_NOT_ARG, go back to + combining all 'p' and 'r' pairs into a LOC_REGPARM. + * command.c (do_setshow_command, case var_string): Never add a space to the end of the string. * NEWS: Document this change. diff --git a/gdb/config/sparc/tm-sparc.h b/gdb/config/sparc/tm-sparc.h index 45ae8f9..94e4031 100644 --- a/gdb/config/sparc/tm-sparc.h +++ b/gdb/config/sparc/tm-sparc.h @@ -24,6 +24,12 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Floating point is IEEE compatible. */ #define IEEE_FLOAT +/* If an argument is declared "register", Sun cc will keep it in a register, + never saving it onto the stack. So we better not believe the "p" symbol + descriptor stab. */ + +#define USE_REGISTER_NOT_ARG + /* When passing a structure to a function, Sun cc passes the address not the structure itself. It (under SunOS4) creates two symbols, which we need to combine to a LOC_REGPARM. Gcc version two (as of diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 6c81c10..cc9537b 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -977,9 +977,11 @@ define_symbol (valu, string, desc, type, objfile) /* Sun cc uses a pair of symbols, one 'p' and one 'r' with the same name to represent an argument passed in a register. GCC uses 'P' for the same case. So if we find such a symbol pair - we combine it into one 'P' symbol. + we combine it into one 'P' symbol. For Sun cc we need to do this + regardless of REG_STRUCT_HAS_ADDR, because the compiler puts out + the 'p' symbol even if it never saves the argument onto the stack. - But we only do this in the REG_STRUCT_HAS_ADDR case, so that + On most machines, we want to preserve both symbols, so that we can still get information about what is going on with the stack (VAX for computing args_printed, using stack slots instead of saved registers in backtraces, etc.). @@ -991,14 +993,18 @@ define_symbol (valu, string, desc, type, objfile) if (local_symbols && local_symbols->nsyms > 0 +#ifndef USE_REGISTER_NOT_ARG && REG_STRUCT_HAS_ADDR (processing_gcc_compilation, SYMBOL_TYPE (sym)) && (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_STRUCT - || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_UNION)) + || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_UNION) +#endif + ) { struct symbol *prev_sym; prev_sym = local_symbols->symbol[local_symbols->nsyms - 1]; - if (SYMBOL_CLASS (prev_sym) == LOC_REF_ARG + if ((SYMBOL_CLASS (prev_sym) == LOC_REF_ARG + || SYMBOL_CLASS (prev_sym) == LOC_ARG) && STREQ (SYMBOL_NAME (prev_sym), SYMBOL_NAME(sym))) { SYMBOL_CLASS (prev_sym) = LOC_REGPARM; -- 2.7.4