From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10142 invoked by alias); 21 Jan 2011 20:42:10 -0000 Received: (qmail 10134 invoked by uid 22791); 21 Jan 2011 20:42:08 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,MSGID_FROM_MTA_HEADER,SPF_SOFTFAIL,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mtagate7.uk.ibm.com (HELO mtagate7.uk.ibm.com) (194.196.100.167) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 21 Jan 2011 20:41:36 +0000 Received: from d06nrmr1307.portsmouth.uk.ibm.com (d06nrmr1307.portsmouth.uk.ibm.com [9.149.38.129]) by mtagate7.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p0LKfVJd004059 for ; Fri, 21 Jan 2011 20:41:31 GMT Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by d06nrmr1307.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p0LKfYqC1466412 for ; Fri, 21 Jan 2011 20:41:34 GMT Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p0LKfVA9029524 for ; Fri, 21 Jan 2011 13:41:31 -0700 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id p0LKfT4c029521; Fri, 21 Jan 2011 13:41:29 -0700 Message-Id: <201101212041.p0LKfT4c029521@d06av02.portsmouth.uk.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Fri, 21 Jan 2011 21:41:29 +0100 Subject: Re: [RFC] Fix variable lifetime related problem in gdb.base/store.exp To: kevinb@redhat.com (Kevin Buettner) Date: Fri, 21 Jan 2011 21:52:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org In-Reply-To: <20110119162636.092db33a@mesquite.lan> from "Kevin Buettner" at Jan 19, 2011 04:26:36 PM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-01/txt/msg00448.txt.bz2 Kevin Buettner wrote: > The test case places a breakpoint in add_float(), runs to that > breakpoint, and then goes up a frame to examine and modify certain > variables. > > The lifetime of `l' with value obtained from `u' ends with invocation > of add_float(). (More precisely, it ends as soon as l's value is > copied to the argument register for the call to add_float().) The > result of the add_float() call is placed in `l' when the call is > finished. > > Thus it's perfectly acceptable (though a bit perverse) to put l's value > in the ra register. (However, given that this is occurring at -O0, it is > also very annoying that the user is unable to inspect l's pre-call > value.) > > In any case, due to the fact that the lifetime of l-with-the-value-of-u > ends once the call to add_float() is set up, the compiler is then free > to use ra for other purposes which, of course, during a call, is used > to temporarily hold the return address. Isn't this then simply a matter of the compiler generating incorrect debug information? At the PC corresponding to the call site, it is simply not true that register ra holds the variable l, so the debug info shouldn't say that. Instead, the debug info should either point to whatever place actually holds the variable at this point, or else mark variable l as "optimized out" there. There's in the end not much GDB can do if debug info is just wrong. Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com