From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5749 invoked by alias); 22 Aug 2002 05:43: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 5699 invoked from network); 22 Aug 2002 05:43:17 -0000 Received: from unknown (HELO zenia.red-bean.com) (66.244.67.22) by sources.redhat.com with SMTP; 22 Aug 2002 05:43:17 -0000 Received: (from jimb@localhost) by zenia.red-bean.com (8.11.6/8.11.6) id g7M5WRd20846; Thu, 22 Aug 2002 00:32:27 -0500 To: Michael Snyder Cc: gdb-patches@sources.redhat.com, kevinb@redhat.com, cagney@redhat.com Subject: Re: [RFC] fixing extract_struct_value_address References: <3D6418C5.FBF117D@redhat.com> From: Jim Blandy Date: Wed, 21 Aug 2002 22:43:00 -0000 In-Reply-To: <3D6418C5.FBF117D@redhat.com> Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.90 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-08/txt/msg00681.txt.bz2 Michael Snyder writes: > Problem: Find a function's return value when it is a struct > returned by reference (thru a pointer). > > Solution level one: Take the value of the register that was > used by the caller to pass the struct return address. > > Shortcoming: that register isn't preserved, so may be clobbered. > > Solution level two: Save the struct_return address when it > is passed to store_struct_return (or push_arguments), and > recover it when it is needed by extract_struct_value_address. > > Shortcoming: Not reentrant. Nested function calls will clobber it. > > Proposed solution: create a stack structure, and "push" the > struct_return address in store_struct_return, popping it in > extract_return_address. If you can't find it on the stack, > then use the value of the appropriate arg0 register. > > I think this should work for most targets, so the code for > managing the stack can be shared. Doesn't this stack push and pop exactly as the generic dummy frame stack does? Couldn't we just add a `struct_return_addr' field to `struct dummy_frame'?