From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26831 invoked by alias); 11 Sep 2003 15:58:29 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 26820 invoked from network); 11 Sep 2003 15:58:26 -0000 Received: from unknown (HELO localhost.redhat.com) (207.219.125.105) by sources.redhat.com with SMTP; 11 Sep 2003 15:58:26 -0000 Received: from redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 3F2C52B89; Thu, 11 Sep 2003 11:58:24 -0400 (EDT) Message-ID: <3F609BA0.3060106@redhat.com> Date: Thu, 11 Sep 2003 15:58:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.2) Gecko/20030820 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Mark Kettenis , Corinna Vinschen Cc: gdb@sources.redhat.com Subject: Re: [RFC] Supporting alternative ABIs References: <20030822084054.GA1110@cygbert.vinschen.de> <86isop2y9h.fsf@elgar.kettenis.dyndns.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-09/txt/msg00155.txt.bz2 > Corinna Vinschen writes: > > >> - EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, USE_STRUCT_CONVENTION and >> gdbarch_push_dummy_code gdbarch methods would be changed to expect >> the type of the function, not the type of its return value. They >> can use TYPE_TARGET_TYPE to get the return value type, but this will >> also give them access to the `calling_convention' for the function type. >> >> - gdbarch_push_dummy_call and EXTRACT_STRUCT_VALUE_ADDRESS would >> receive the function's type as an additional argument, to give them >> access to the function's calling convention information. >> >> - USE_STRUCT_CONVENTION and gdbarch_push_dummy_code would not require >> the `gcc_p' and `using_gcc' flags anymore since this information >> is now given in the function type node. Due to the way, >> gdbarch_parse_dwarf2_calling_convention evaluates the `calling_convention' >> value, all inferior call-related gdbarch methods could simply trust its >> value. > > > I was working on the (32-bit) SPARC target today, and wished I had the > function type available, so I'm positive this would be a good move. ... so seconded. Going through them: USE_STRUCT_CONVENTION: I'd rename the existing USE_STRUCT_CONVENTION to DEPRECATED_USE_STRUCT_CONVENTION and then introduce new arch method gdbarch_use_struct_convention (gdbarch, struct type *func) that defaults to the old. push_dummy_call: Similar. The struct_return parameter is now very redundant (the assertions "struct_return == new USE_STRUCT_CONVENTION (new function parameter)", and "(struct_return != 0) == (STRUCT_ADDR != 0)" should hold). EXTRACT_STRUCT_VALUE_ADDRESS: Is this one needed? Instead always use EXTRACT_RETURN_VALUE to obtain the return value. Renaming this to DEPRECATED_STRUCT_VALUE_ADDRESS_V2. STORE_RETURN_VALUE: Rename the existing to deprecated_store_return_value_v2? Anyway, looking at set_return_value(), I think the replacement's default implementation should incorporate both of: > if (code == TYPE_CODE_STRUCT > || code == TYPE_CODE_UNION) /* FIXME, implement struct return. */ > error ("GDB does not support specifying a struct or union return value."); > > STORE_RETURN_VALUE (type, current_regcache, VALUE_CONTENTS (val)); some ABI's allow struct return, some don't. Generic code shouldn't be making the decision. EXTRACT_RETURN_VALUE: Rename the existing to deprecated_extract_return_value_v2? Looking at value_being_returned, and given the comment above on EXTRACT_STRUCT_VALUE_ADDRESS, I think the default method should contain much of the existing value_being_returned function. Andrew