From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31677 invoked by alias); 13 Nov 2006 21:26:33 -0000 Received: (qmail 31669 invoked by uid 22791); 13 Nov 2006 21:26:33 -0000 X-Spam-Check-By: sourceware.org Received: from smtp-vbr10.xs4all.nl (HELO smtp-vbr10.xs4all.nl) (194.109.24.30) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 13 Nov 2006 21:26:22 +0000 Received: from webmail.xs4all.nl (dovemail9.xs4all.nl [194.109.26.11]) by smtp-vbr10.xs4all.nl (8.13.8/8.13.8) with ESMTP id kADLQEGb015347; Mon, 13 Nov 2006 22:26:19 +0100 (CET) (envelope-from mark.kettenis@xs4all.nl) Received: from 82.92.89.47 (SquirrelMail authenticated user sibelius) by webmail.xs4all.nl with HTTP; Mon, 13 Nov 2006 22:26:19 +0100 (CET) Message-ID: <14515.82.92.89.47.1163453179.squirrel@webmail.xs4all.nl> In-Reply-To: <20061112215542.GB22995@adacore.com> References: <20061111002614.GD3746@adacore.com> <24858.82.92.89.47.1163267262.squirrel@webmail.xs4all.nl> <20061112002226.GA22995@adacore.com> <6654.82.92.89.47.1163364566.squirrel@webmail.xs4all.nl> <20061112215542.GB22995@adacore.com> Date: Mon, 13 Nov 2006 21:26:00 -0000 Subject: Re: [RFA/sparc64] internal-error printing return value (Ada array) From: "Mark Kettenis" To: "Joel Brobecker" Cc: gdb-patches@sourceware.org User-Agent: SquirrelMail/1.4.8 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-11/txt/msg00106.txt.bz2 > > Hmm, I gueass I should have asked how a gdb `struct type' looks for > > these Ada arrays? In particular, if main_type->nfields is set and > > whether main_type->fields is set to something useful. > > Ah, I understand now (sorry). Yes, main_type->nfields is 1, and > main_type->fields contains the bounds. Ok, that's quite different from what we have for TYPE_CODE_STRUCT and TYPE_CODE_UNION. This means that adding TYPE_CODE_ARRAY to sparc64_structure_or_union is the wrong fix. > In terms of the argument passing, we don't need to worry in our case, > because arrays are passed by reference. In terms of a return value, > the ABI says that structs of up to 32 bytes can be returned. > > 3.2.3.3. Structure or Union return values > > Structure and union return types up to thirty-two bytes in size > are returned in registers. The registers are assigned as if the > value was being passed as the first argument to a function with > a known prototype. > > This is why I used the magic number of 32 in this case. I still think > it is correct, although more comments are certainly required to explain > the above. > > What do you think? Well, we need to worry about argument passing too; Ada might not pass arrays directly, but other languages might do that. So I think you should just add a check for TYPE_CODE_ARRAY to sparc64_extract_return_value() and sparc64_store_return_value(). You could add it to the same if-block as the sparc64_structure_of_union() but then you'll need to change the if (TYPE_CODE (type) != TYPE_CODE_UNION) check into if (TYPE_CODE (type) == TYPE_CODE_STRUCT) Mark