Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Orjan Friberg <orjan.friberg@axis.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [CRIS] dwarf2 frame sniffer problem?
Date: Thu, 11 Mar 2004 15:55:00 -0000	[thread overview]
Message-ID: <40508BD8.10802@axis.com> (raw)
In-Reply-To: <405072FE.1010403@axis.com>

I don't know if this is related to the previous suggested problem (i.e. 
the dwarf2 information being wrong), but I changed the test program 
slightly to:

void bar(void) {}
void foo(void)
{
   bar();
}
int main ()
{
   foo();
   return 0;
}

Now foo is no longer a leaf function, and thus saves the return address 
on the stack in its prologue.  Stepping over foo ("next" in main) causes 
a breakpoint to be set at the first instruction in foo.  After the 
target is stopped at that instruction (which is where the return address 
is pushed on the stack) dwarf2_frame_prev_register is called, which 
thinks that the PC is saved on the stack (case 
DWARF2_FRAME_REG_SAVED_OFFSET) and reads it from there.  Obviously the 
value it reads is wrong, since the return address hasn't been pushed yet.

What's wrong here?  Is the dwarf2 debug information wrong, or should 
dwarf2_frame_prev_register not have been called while still in the prologue?

-- 
Orjan Friberg
Axis Communications


WARNING: multiple messages have this Message-ID
From: Orjan Friberg <orjan.friberg@axis.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [CRIS] dwarf2 frame sniffer problem?
Date: Fri, 19 Mar 2004 00:09:00 -0000	[thread overview]
Message-ID: <40508BD8.10802@axis.com> (raw)
Message-ID: <20040319000900.UbWW-oYBMJdQR6dqECesLJ-fGEEvtj93ZNRsQM1z9-c@z> (raw)
In-Reply-To: <405072FE.1010403@axis.com>

I don't know if this is related to the previous suggested problem (i.e. 
the dwarf2 information being wrong), but I changed the test program 
slightly to:

void bar(void) {}
void foo(void)
{
   bar();
}
int main ()
{
   foo();
   return 0;
}

Now foo is no longer a leaf function, and thus saves the return address 
on the stack in its prologue.  Stepping over foo ("next" in main) causes 
a breakpoint to be set at the first instruction in foo.  After the 
target is stopped at that instruction (which is where the return address 
is pushed on the stack) dwarf2_frame_prev_register is called, which 
thinks that the PC is saved on the stack (case 
DWARF2_FRAME_REG_SAVED_OFFSET) and reads it from there.  Obviously the 
value it reads is wrong, since the return address hasn't been pushed yet.

What's wrong here?  Is the dwarf2 debug information wrong, or should 
dwarf2_frame_prev_register not have been called while still in the prologue?

-- 
Orjan Friberg
Axis Communications


  parent reply	other threads:[~2004-03-11 15:55 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-10 16:53 Orjan Friberg
2004-03-10 16:59 ` Daniel Jacobowitz
2004-03-19  0:09   ` Daniel Jacobowitz
2004-03-19  0:09   ` Orjan Friberg
2004-03-11 14:09     ` Orjan Friberg
2004-03-11 15:55     ` Orjan Friberg [this message]
2004-03-11 17:05       ` Andrew Cagney
2004-03-19  0:09         ` Orjan Friberg
2004-03-12 12:00           ` Orjan Friberg
2004-03-19  0:09         ` Andrew Cagney
2004-03-11 17:11       ` Daniel Jacobowitz
2004-03-12 10:23         ` Orjan Friberg
2004-03-19  0:09           ` Daniel Jacobowitz
2004-03-12 15:38             ` Daniel Jacobowitz
2004-03-15 10:19             ` Orjan Friberg
2004-03-19  0:09               ` Orjan Friberg
2004-03-16 16:26             ` Orjan Friberg
2004-03-16 19:13               ` Daniel Jacobowitz
2004-03-16 20:51                 ` Hans-Peter Nilsson
2004-03-16 22:27                   ` Daniel Jacobowitz
2004-03-16 23:38                     ` Hans-Peter Nilsson
2004-03-16 23:58                       ` Daniel Jacobowitz
2004-03-19  0:09                         ` Daniel Jacobowitz
2004-03-19  0:09                       ` Hans-Peter Nilsson
2004-03-19  0:09                     ` Daniel Jacobowitz
2004-03-19  0:09                   ` Hans-Peter Nilsson
2004-03-19  0:09                 ` Daniel Jacobowitz
2004-03-19  0:09               ` Orjan Friberg
2004-03-19  0:09           ` Orjan Friberg
2004-03-19  0:09           ` Orjan Friberg
2004-03-12 13:50             ` Orjan Friberg
2004-03-19  0:09           ` Orjan Friberg
2004-03-12 15:38             ` Orjan Friberg
2004-03-19  0:09         ` Daniel Jacobowitz
2004-03-19  0:09       ` Orjan Friberg
2004-03-19  0:09 ` Orjan Friberg

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=40508BD8.10802@axis.com \
    --to=orjan.friberg@axis.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sources.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