From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19341 invoked by alias); 20 Apr 2002 09:17:49 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 19327 invoked from network); 20 Apr 2002 09:17:47 -0000 Received: from unknown (HELO pizda.ninka.net) (216.101.162.242) by sources.redhat.com with SMTP; 20 Apr 2002 09:17:47 -0000 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id CAA10879 for ; Sat, 20 Apr 2002 02:09:06 -0700 Date: Sat, 20 Apr 2002 02:17:00 -0000 Message-Id: <20020420.020906.44150275.davem@redhat.com> To: gdb-patches@sources.redhat.com Subject: [RFA] Locate sparc64 arguments correctly From: "David S. Miller" Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2002-04/txt/msg00676.txt.bz2 Two problems: 1) Debugging information encodes LOC_ARG/LOC_REF_ARG offsets with the Sparc64 stack bias included, we keep track of the frame pointer with the stack bias removed on sparc64. sparc64_frame_args_address takes care of that. 2) REG_STRUCT_HAS_ADDR was wrong, structs larger than 16 bytes are passed by reference. No regression test changes, likely because these things aren't hit by the testsuite. 2002-04-20 David S. Miller * config/sparc/tm-sp64.h (REG_STRUCT_HAS_ADDR): Structs are passed by reference when they are greater than 16 bytes in size, not 32. * sparc-tdep.c (sparc_reg_struct_has_addr): Likewise. * config/sparc/tm-sp64.h (FRAME_ARGS_ADDRESS): Define. * sparc-tdep.c (sparc64_frame_args_address): New function. (sparc_gdbarch_init): Use it for sparc64, else use default_frame_address. --- config/sparc/tm-sp64.h.~1~ Fri Apr 19 23:02:03 2002 +++ config/sparc/tm-sp64.h Sat Apr 20 01:55:05 2002 @@ -223,6 +223,9 @@ CORE_ADDR sparc64_push_arguments (int, #undef STACK_ALIGN #define STACK_ALIGN(ADDR) (((ADDR) + 15 ) & -16) +#undef FRAME_ARGS_ADDRESS +#define FRAME_ARGS_ADDRESS(FI) ((FI)->frame - 2047) + /* Initializer for an array of names of registers. There should be NUM_REGS strings in this initializer. */ /* Some of these registers are only accessible from priviledged mode. @@ -263,7 +266,7 @@ CORE_ADDR sparc64_push_arguments (int, } #undef REG_STRUCT_HAS_ADDR -#define REG_STRUCT_HAS_ADDR(gcc_p,type) (TYPE_LENGTH (type) > 32) +#define REG_STRUCT_HAS_ADDR(gcc_p,type) (TYPE_LENGTH (type) > 16) extern CORE_ADDR sparc64_read_sp (); extern CORE_ADDR sparc64_read_fp (); --- sparc-tdep.c.~1~ Sat Apr 20 01:46:27 2002 +++ sparc-tdep.c Sat Apr 20 01:52:38 2002 @@ -2798,6 +2798,16 @@ sparc64_register_byte (int regno) return 64 * 8 + (regno - 80) * 8; } +/* Debugging information stores LOC_ARG/LOC_REF_ARG offsets with the + sparc64 stack bias present, this undoes that so that users of + FRAME_ARGS_ADDRESS use the right location. */ + +static CORE_ADDR +sparc64_frame_args_address (struct frame_info *fi) +{ + return fi->frame - 2047; +} + /* Advance PC across any function entry prologue instructions to reach some "real" code. SKIP_PROLOGUE_FRAMELESS_P advances the PC past some of the prologue, but stops as soon as it knows that the @@ -2886,7 +2896,7 @@ int sparc_reg_struct_has_addr (int gcc_p, struct type *type) { if (GDB_TARGET_IS_SPARC64) - return (TYPE_LENGTH (type) > 32); + return (TYPE_LENGTH (type) > 16); else return (gcc_p != 1); } @@ -3128,6 +3139,7 @@ sparc_gdbarch_init (struct gdbarch_info set_gdbarch_use_struct_convention (gdbarch, sparc64_use_struct_convention); set_gdbarch_write_sp (gdbarch, sparc64_write_sp); + set_gdbarch_frame_args_address (gdbarch, sparc64_frame_args_address); tdep->y_regnum = SPARC64_Y_REGNUM; tdep->fp_max_regnum = SPARC_FP0_REGNUM + 48; tdep->intreg_size = 8;