From: Daniel Jacobowitz <drow@false.org>
To: Luis Machado <luisgpm@linux.vnet.ibm.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [patch] Backtrace prints wrong argument value
Date: Wed, 25 Apr 2007 19:25:00 -0000 [thread overview]
Message-ID: <20070425191304.GA1283@caradoc.them.org> (raw)
In-Reply-To: <1177527233.12599.42.camel@localhost>
On Wed, Apr 25, 2007 at 03:53:53PM -0300, Luis Machado wrote:
> If we call a backtrace on GDB, that's what we have:
>
> #0 - start_sequence (x=<value optimized out>, y=0xfffff9b1b34)
> #1 - gen_movsd (operand0=0xdeadbeef, operand1=0xfffff9b1b34)
>
> Notice that on frame #1, "operand0" has a "0xdeadbeef" value, which
> happens to be the return value from the "start_sequence" function from
> frame #0. This is clearly incorrect.
What is the corresponding code and debug info?
I guess you have debugging information which says that operand0 is
valid on the call instruction and invalid after it.
> What is causing this incorrect value to be printed on frame levels above
> 0 is an adjustment to the PC on the "frame_unwind_address_in_block"
> function. The purpose of this adjustment to PC is to make it point to
> the branch instruction rather than the instruction right after the
> branch instruction ( this is achieved with a --pc decrement).
You've partly misunderstood the purpose of the decrement. We never
look at the branch instruction; it's to make sure that the PC points
to the same function as the call instruction, in the case of a
function that ends in a call to abort. Having it point to the middle
of an instruction is perfectly fine.
Consider this code:
func1:
copy arg1 to r20
call abort
func2:
copy arg2 to r3
call func1
return
A valid location list for func1 could say that arg1 is valid
in r20 during the call to abort; the -1 puts us on the call, instead
of after it, in the unrelated func2.
I believe this is considered a known weakness of the DWARF
representation, which does not represent state before an instruction
separately from state after it. The debug info does not tell us
whether the location is valid in the middle of the call.
--
Daniel Jacobowitz
CodeSourcery
next prev parent reply other threads:[~2007-04-25 19:13 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-25 19:13 Luis Machado
2007-04-25 19:25 ` Daniel Jacobowitz [this message]
2007-04-25 22:28 ` Luis Machado
2007-04-30 13:31 ` Luis Machado
2007-05-16 5:34 ` Luis Machado
2007-05-16 14:43 ` Daniel Jacobowitz
2007-05-16 15:20 ` Luis Machado
2007-05-16 15:23 ` Daniel Jacobowitz
2007-09-13 14:47 ` Luis Machado
2007-09-16 19:45 ` Daniel Jacobowitz
2007-09-17 13:05 ` Luis Machado
2007-09-17 13:15 ` Daniel Jacobowitz
2007-09-17 13:30 ` Luis Machado
2007-09-17 13:37 ` Daniel Jacobowitz
2007-09-17 13:46 ` Luis Machado
2007-09-17 14:00 ` Luis Machado
2007-09-17 14:04 ` Daniel Jacobowitz
2007-09-17 16:02 ` Luis Machado
2007-09-17 17:15 ` Luis Machado
2007-09-17 17:18 ` Daniel Jacobowitz
2007-09-17 17:34 ` Luis Machado
2007-09-17 17:48 ` Daniel Jacobowitz
2007-10-03 14:58 ` Luis Machado
2007-10-21 21:41 ` Luis Machado
2007-10-22 0:03 ` Joel Brobecker
2007-10-22 1:20 ` Daniel Jacobowitz
2007-10-22 4:11 ` Joel Brobecker
2007-10-24 20:50 ` Daniel Jacobowitz
2007-10-24 20:59 ` Joel Brobecker
2007-10-24 21:01 ` Daniel Jacobowitz
2007-10-24 22:23 ` Pedro Alves
2007-10-24 22:38 ` Pedro Alves
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=20070425191304.GA1283@caradoc.them.org \
--to=drow@false.org \
--cc=gdb-patches@sources.redhat.com \
--cc=luisgpm@linux.vnet.ibm.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