From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1071 invoked by alias); 23 Apr 2002 19:53:24 -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 1040 invoked from network); 23 Apr 2002 19:53:20 -0000 Received: from unknown (HELO cygnus.com) (205.180.83.203) by sources.redhat.com with SMTP; 23 Apr 2002 19:53:20 -0000 Received: from redhat.com (reddwarf.sfbay.redhat.com [172.16.24.50]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id MAA21339; Tue, 23 Apr 2002 12:53:19 -0700 (PDT) Message-ID: <3CC5B8E0.A61081A7@redhat.com> Date: Tue, 23 Apr 2002 12:53:00 -0000 From: Michael Snyder Organization: Red Hat, Inc. X-Accept-Language: en MIME-Version: 1.0 To: "David S. Miller" CC: gdb-patches@sources.redhat.com Subject: Re: [RFA] Locate sparc64 arguments correctly References: <20020420.020906.44150275.davem@redhat.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2002-04/txt/msg00874.txt.bz2 "David S. Miller" wrote: > > 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. This is a good idea, but FRAME_ARGS_ADDRESS is multi-arched. Can you use that implementation? > 2) REG_STRUCT_HAS_ADDR was wrong, structs larger than 16 bytes > are passed by reference. Have you verified that this is the case on Solaris? > No regression test changes, likely because these things aren't > hit by the testsuite. How about extending testsuite/gdb.base/structs.[c exp] so that they cover this case? > 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;