From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2937 invoked by alias); 3 Nov 2005 03:12:34 -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 2928 invoked by uid 22791); 3 Nov 2005 03:12:29 -0000 Received: from ausmtp02.au.ibm.com (HELO ausmtp02.au.ibm.com) (202.81.18.187) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Thu, 03 Nov 2005 03:12:29 +0000 Received: from sd0208e0.au.ibm.com (d23rh904.au.ibm.com [202.81.18.202]) by ausmtp02.au.ibm.com (8.12.10/8.12.10) with ESMTP id jA3365GW042226 for ; Thu, 3 Nov 2005 14:06:05 +1100 Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.250.237]) by sd0208e0.au.ibm.com (8.12.10/NCO/VERS6.7) with ESMTP id jA33EpGE038168 for ; Thu, 3 Nov 2005 14:14:54 +1100 Received: from d23av04.au.ibm.com (loopback [127.0.0.1]) by d23av04.au.ibm.com (8.12.11/8.13.3) with ESMTP id jA33Bnw0031735 for ; Thu, 3 Nov 2005 14:11:49 +1100 Received: from [9.181.133.252] ([9.181.133.252]) by d23av04.au.ibm.com (8.12.11/8.12.11) with ESMTP id jA33Blee031685; Thu, 3 Nov 2005 14:11:48 +1100 Date: Thu, 03 Nov 2005 03:12:00 -0000 From: Wu Zhou To: Daniel Jacobowitz cc: gdb@sources.redhat.com Subject: Re: The root cause for SEGV in evaluating fortran function call, any solution or suggestion? In-Reply-To: <20051102145258.GA28372@nevyn.them.org> Message-ID: References: <20051102145258.GA28372@nevyn.them.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2005-11/txt/msg00053.txt.bz2 Hi Daniel, On Wed, 2 Nov 2005, Daniel Jacobowitz wrote: > On Wed, Nov 02, 2005 at 10:43:03AM +0800, Wu Zhou wrote: > > Hi all, > > > > I had found the reason why gdb will drop into SEGV when evaluating the > > fortran function calls. In g77 (gfortran might be the same), when we try > > to call FUNC_NAME (ARGS), the ARGS is passed as the pointer to the real > > parameters. > > > > While we issue "print FUNC_NAME (ARGS), these ARGS are passed as the > > original types. So fortran code can't handle that and SEGV occurs. > > Considering this special argument-passing mechanism, do we have any > > workaround for it in gdb's evaluation code? Create a dummy memory address > > for the arguments and pass that address instead? or any others? > > I don't think there's any way to handle that right now: you'll have to > add one. I am not sure where in the call-function process it should > be. Probably, you will also need a way to allocate them - on the stack > would be better than malloc, which is how gdb usually allocates memory. 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! Regards - Wu Zhou