From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14368 invoked by alias); 18 Oct 2005 19:12:16 -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 14120 invoked by uid 22791); 18 Oct 2005 19:12:13 -0000 Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Tue, 18 Oct 2005 19:12:13 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1ERwsa-0005BO-St; Tue, 18 Oct 2005 15:12:08 -0400 Date: Tue, 18 Oct 2005 19:12:00 -0000 From: Daniel Jacobowitz To: Joel Brobecker Cc: gdb-patches@sources.redhat.com Subject: Re: Question regarding storing/restoring data during inferior function call Message-ID: <20051018191208.GA19167@nevyn.them.org> Mail-Followup-To: Joel Brobecker , gdb-patches@sources.redhat.com References: <20051018184607.GO1034@adacore.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051018184607.GO1034@adacore.com> User-Agent: Mutt/1.5.8i X-SW-Source: 2005-10/txt/msg00153.txt.bz2 On Tue, Oct 18, 2005 at 11:46:07AM -0700, Joel Brobecker wrote: > Hello, > > I'm working on inferior function calls on ia64-hpux (which I'd like to > eventually contribute), and I've hit a glitch: HPUX does not allow us > to modify the BSP register. So this prevents us from creating a new > RSE frame for the function being called. This is a disgusting limitation. Didn't they do the same thing on PA? Ah, yes: hppa_hpux_push_dummy_code. Similar problem with the space registers. Do you have the same problem with popping frames? > One way around this problem that I thought about was to keep the BSP > as is. This meant adjusting a bit the addresses where the arguments > were saved. But more importantly, this meant that we overwrote the > output section of the register frame. > > It's pretty easy to add some code in GDB to save this data, either > on the inferior stack frame or perhaps directly in debugger memory. > However, I don't see a clear way for us to do the restoration. Is > there any? I don't know enough about IA64 to say whether this would work, but it sounds like a reasonable approach. Keep in mind that dummy frames are sometimes left normally, sometimes explicitly popped, and sometimes left abnormally (after which we need to garbage collect them, sort of); will this hold up if you longjmp out of the called function? > Right now, the inferior function call is made AT_ENTRY_POINT. One > way to solve my problem that might work is to make the call ON_STACK. > Not sure if that's allowed on this chip. But this way, I can > dynamically create a small piece of code that does the branch to the > target function, which would implicitly cause the BSP update that > we're currently doing ourselves. This does open a whole can of worms, > though, as I think I'll need to revisit the entire dummy frame unwinder, > won't I? Maybe, maybe not. Might be the easiest answer. I'd suspect ia64 dislikes executable stacks, though. Can you (ew) poke the necessary code into the entry point, assuming it is small enough? If it's just a jump to register... -- Daniel Jacobowitz CodeSourcery, LLC