From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21194 invoked by alias); 24 Sep 2003 11:28:19 -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 21187 invoked from network); 24 Sep 2003 11:28:18 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 24 Sep 2003 11:28:18 -0000 Received: from int-mx2.corp.redhat.com (nat-pool-rdu-dmz.redhat.com [172.16.52.200]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h8OBSG102951 for ; Wed, 24 Sep 2003 07:28:16 -0400 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h8OBSFD19910 for ; Wed, 24 Sep 2003 07:28:15 -0400 Received: from cygbert.vinschen.de (vpn50-8.rdu.redhat.com [172.16.50.8]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id h8OBSCw04136 for ; Wed, 24 Sep 2003 04:28:12 -0700 Received: by cygbert.vinschen.de (Postfix, from userid 500) id 54B1A580A8; Wed, 24 Sep 2003 13:28:08 +0200 (CEST) Date: Wed, 24 Sep 2003 11:28:00 -0000 From: Corinna Vinschen To: gdb-patches@sources.redhat.com Subject: Re: SH patch 2 (was Re: [RFA] SH: Deprecate deprecated functions, use new frame interface) Message-ID: <20030924112808.GI9981@cygbert.vinschen.de> Reply-To: gdb-patches@sources.redhat.com Mail-Followup-To: gdb-patches@sources.redhat.com References: <16226.1322.230352.450541@localhost.redhat.com> <20030915160111.GA9283@cygbert.vinschen.de> <16231.17730.828347.741094@localhost.redhat.com> <20030916172606.GU9981@cygbert.vinschen.de> <20030916173038.GA25459@nevyn.them.org> <20030922143254.GR9981@cygbert.vinschen.de> <20030922144405.GA20343@nevyn.them.org> <20030922150831.GA17905@cygbert.vinschen.de> <16240.44135.87461.106684@localhost.redhat.com> <20030924084311.GF9981@cygbert.vinschen.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030924084311.GF9981@cygbert.vinschen.de> User-Agent: Mutt/1.4.1i X-SW-Source: 2003-09/txt/msg00525.txt.bz2 On Wed, Sep 24, 2003 at 10:43:11AM +0200, Corinna Vinschen wrote: > On Tue, Sep 23, 2003 at 04:26:15PM -0400, Elena Zannoni wrote: > > I think so too. But I'd like to see if something can be done for SH > > similar to the i386_convert_register_p method. > > Is that necessary before the patch gets approval or could that be added > in a follow up step? I've tested the below patch and the effect is absolut zero with respect to the store.exp results. What am I doing wrong? It doesn't matter if I diable the dwarf2 sniffer or not, btw. Corinna --- sh-tdep.c.NEW 2003-09-24 12:24:10.000000000 +0200 +++ sh-tdep.c 2003-09-24 13:25:30.000000000 +0200 @@ -2111,6 +2111,58 @@ sh_in_function_epilogue_p (struct gdbarc return 0; } +/* Return nonzero if a value of type TYPE stored in register REGNUM + needs any special handling. */ +static int +sh_convert_register_p (int regnum, struct type *type) +{ + if (TYPE_CODE (type) == TYPE_CODE_FLT) + return TYPE_LENGTH (type) > 4 && regnum < DR0_REGNUM; + return TYPE_LENGTH (type) > 4; +} + +/* Read a value of type TYPE from register REGNUM in frame FRAME, and + return its contents in TO. */ +static void +sh_register_to_value (struct frame_info *frame, int regnum, + struct type *type, void *to) +{ + int len = TYPE_LENGTH (type); + char *buf = to; + + while (len > 0) + { + get_frame_register (frame, regnum++, buf); + if (regnum == 16) /* Normal register overflow */ + break; + if (regnum == 41) /* FP register overflow */ + break; + len -= 4; + buf += 4; + } +} + +/* Write the contents FROM of a value of type TYPE into register + REGNUM in frame FRAME. */ +static void +sh_value_to_register (struct frame_info *frame, int regnum, + struct type *type, const void *from) +{ + int len = TYPE_LENGTH (type); + const char *buf = from; + + while (len > 0) + { + put_frame_register (frame, regnum, buf); + if (regnum == 16) /* Normal register overflow */ + break; + if (regnum == 41) /* FP register overflow */ + break; + len -= 4; + buf += 4; + } +} + static gdbarch_init_ftype sh_gdbarch_init; static struct gdbarch * @@ -2213,6 +2265,10 @@ sh_gdbarch_init (struct gdbarch_info inf set_gdbarch_in_function_epilogue_p (gdbarch, sh_in_function_epilogue_p); + set_gdbarch_convert_register_p (gdbarch, sh_convert_register_p); + set_gdbarch_register_to_value (gdbarch, sh_register_to_value); + set_gdbarch_value_to_register (gdbarch, sh_value_to_register); + switch (info.bfd_arch_info->mach) { case bfd_mach_sh: -- Corinna Vinschen Cygwin Developer Red Hat, Inc.