From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32125 invoked by alias); 3 Nov 2005 21:34:58 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 32113 invoked by uid 22791); 3 Nov 2005 21:34:56 -0000 Received: from sibelius.xs4all.nl (HELO sibelius.xs4all.nl) (82.92.89.47) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Thu, 03 Nov 2005 21:34:56 +0000 Received: from elgar.sibelius.xs4all.nl (root@elgar.sibelius.xs4all.nl [192.168.0.2]) by sibelius.xs4all.nl (8.13.4/8.13.4) with ESMTP id jA3LYExR026274; Thu, 3 Nov 2005 22:34:14 +0100 (CET) Received: from elgar.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by elgar.sibelius.xs4all.nl (8.13.4/8.13.3) with ESMTP id jA3LYEEF026749; Thu, 3 Nov 2005 22:34:14 +0100 (CET) Received: (from kettenis@localhost) by elgar.sibelius.xs4all.nl (8.13.4/8.13.4/Submit) id jA3LYDsT017248; Thu, 3 Nov 2005 22:34:13 +0100 (CET) Date: Thu, 03 Nov 2005 21:34:00 -0000 Message-Id: <200511032134.jA3LYDsT017248@elgar.sibelius.xs4all.nl> From: Mark Kettenis To: woodzltc@cn.ibm.com CC: drow@false.org, gdb@sources.redhat.com In-reply-to: (message from Wu Zhou on Thu, 3 Nov 2005 11:14:51 +0800 (CST)) Subject: Re: The root cause for SEGV in evaluating fortran function call, any solution or suggestion? References: <20051102145258.GA28372@nevyn.them.org> X-SW-Source: 2005-11/txt/msg00080.txt.bz2 > Date: Thu, 3 Nov 2005 11:14:51 +0800 (CST) > From: Wu Zhou > > Maybe we can convert the argument to its pointer before we enter into > call_function_by_hand (evaluate_subexp_standard: case OP_FUNCALL)? > Normally what function you will use to allocate memory on the stack? I am > not very familar with that kind of code. Thanks! Allocating memory on the stack is actually quite eazy. Just substract/add the amount of space you need from/to the stack pointer, and use the new/old stack pointer as the address for the memory. Whether you should substract or add depends on whether the stack grows downward or upward. Use gdbarch_inner_than(gdbarch, 1, 2) to check. There's quite a bit of code in infcall.c that uses this trick. Mark