From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21296 invoked by alias); 4 Apr 2005 06:00:23 -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 21239 invoked from network); 4 Apr 2005 06:00:17 -0000 Received: from unknown (HELO sibelius.xs4all.nl) (82.92.89.47) by sourceware.org with SMTP; 4 Apr 2005 06:00:17 -0000 Received: from elgar.sibelius.xs4all.nl (root@elgar.sibelius.xs4all.nl [192.168.0.2]) by sibelius.xs4all.nl (8.13.0/8.13.0) with ESMTP id j34609qO019459; Mon, 4 Apr 2005 08:00:09 +0200 (CEST) Received: from elgar.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by elgar.sibelius.xs4all.nl (8.13.3/8.13.3) with ESMTP id j34608BD030829; Mon, 4 Apr 2005 08:00:08 +0200 (CEST) Received: (from kettenis@localhost) by elgar.sibelius.xs4all.nl (8.13.3/8.13.3/Submit) id j34604Va024681; Mon, 4 Apr 2005 08:00:04 +0200 (CEST) Date: Mon, 04 Apr 2005 06:00:00 -0000 Message-Id: <200504040600.j34604Va024681@elgar.sibelius.xs4all.nl> From: Mark Kettenis To: eliz@gnu.org CC: drow@false.org, gdb@sources.redhat.com, Reiner.Steib@gmx.de In-reply-to: <01c538d4$Blat.v2.4$b261c020@zahav.net.il> (eliz@gnu.org) Subject: Re: Variable "foo" is not available References: <20050401171947.GA19058@nevyn.them.org> <01c53768$Blat.v2.4$d52008a0@zahav.net.il> <20050402142639.GA27550@nevyn.them.org> <01c537af$Blat.v2.4$c36667c0@zahav.net.il> <20050402184023.GA20247@nevyn.them.org> <01c537c6$Blat.v2.4$427763a0@zahav.net.il> <20050402210541.GA16758@nevyn.them.org> <01c538d4$Blat.v2.4$b261c020@zahav.net.il> X-SW-Source: 2005-04/txt/msg00026.txt.bz2 Date: Mon, 04 Apr 2005 08:10:00 +0300 From: "Eli Zaretskii" > Date: Sat, 2 Apr 2005 16:05:42 -0500 > From: Daniel Jacobowitz > Cc: gdb@sources.redhat.com, Reiner.Steib@gmx.de > > > We are talking about function call arguments here, not just about any > > local variables. Can you tell what compiler optimizations could cause > > what Reiner reported: that the first argument is available to GDB, but > > the second is not? > > Very easily. Suppose you have two incoming arguments in registers; GCC > will do this automatically for static functions even on i386, which > normally uses a stack convention. The first is used after a function > call, so it is preserved by saving it to the stack. The second is not > used after the function call, so the compiler has no reason to allocate > a save slot for it, and no reason to store it to memory before the > function call. The functions present in Reiner's backtraces are not static, they are external, with the exception of funcall_lambda. I don't have access to an x86_64 machine, but at least on an IA32 x86 architecture the code produced by GCC 3.4.3 for these function calls is quite straightforward (see one example below), and with GDB 6.3 I couldn't reproduce the "arg not available" message. amd64 passes arguments in registers by default. That makes it much more likely that an argument is discarded if it isn't needed anymore in order for the compiler to re-use the register. Mark