Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: kevinb@redhat.com (Kevin Buettner)
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC] Fix variable lifetime related problem in gdb.base/store.exp
Date: Fri, 21 Jan 2011 21:52:00 -0000	[thread overview]
Message-ID: <201101212041.p0LKfT4c029521@d06av02.portsmouth.uk.ibm.com> (raw)
In-Reply-To: <20110119162636.092db33a@mesquite.lan> from "Kevin Buettner" at Jan 19, 2011 04:26:36 PM

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


  parent reply	other threads:[~2011-01-21 20:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-19 23:56 Kevin Buettner
2011-01-20 12:05 ` Doug Evans
2011-01-21 20:42   ` Kevin Buettner
2011-01-21 21:52 ` Ulrich Weigand [this message]
2011-01-25 15:14   ` Kevin Buettner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201101212041.p0LKfT4c029521@d06av02.portsmouth.uk.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=kevinb@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox