Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Wu Zhou <woodzltc@cn.ibm.com>
To: gdb@sourceware.org
Subject: a question about rs6k's prologue analysis
Date: Wed, 11 Oct 2006 10:13:00 -0000	[thread overview]
Message-ID: <452CC397.5050304@cn.ibm.com> (raw)

In function skip_prologue of rs6000-tdep.c, when it finds an instruction like "bl foo", and that it 
is not within the first three instructions of the prologue, the prologue analysis will stop.

       else if ((op & 0xfc000001) == 0x48000001)
         {                       /* bl foo,
                                    to save fprs??? */

           fdata->frameless = 0;
           /* Don't skip over the subroutine call if it is not within
              the first three instructions of the prologue.  */
           if ((pc - fdata->func_start) > 8)
             break;
           ....
          }

Any specific reason for this?

I encountered some prologue code like this:

     61a0:       7c 08 02 a6     mflr    r0
     61a4:       94 21 ff f0     stwu    r1,-16(r1)
     61a8:       93 e1 00 0c     stw     r31,12(r1)
     61ac:       48 01 8a 81     bl      1ec2c <__JCR_END__+0x4>
     61b0:       7f e8 02 a6     mflr    r31
     61b4:       90 01 00 14     stw     r0,20(r1)

In the first instruction, lr is saved in r0, its content is saved on stack at the last instruction. 
  But between these two instruction, a "bl foo" instruction exists, which make skip_prologue return. 
In this scenario, gdb won't have any way to know where lr is saved on the stack. This might make the 
backtrace loops at this point.

Could it be possible that we delete this conditional statement?  I guess this will only make 
prologue analysis get a little longer.  Any other impact?

Or that some changes in the compiler's side is needed?  But now that these code are already there, 
and it also seems that they work ok, I guess it is not very easy for compiler to change that.

Any insight?  Thanks a lot!

Regards
- Wu Zhou


             reply	other threads:[~2006-10-11 10:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-11 10:13 Wu Zhou [this message]
2006-10-11 10:47 ` Ramana Radhakrishnan
2006-10-11 13:53   ` Daniel Jacobowitz
2006-10-11 16:22     ` Joel Brobecker
2006-10-12  3:59       ` Wu Zhou
2006-10-13  4:13         ` Wu Zhou
2006-10-13 19:09           ` Michael Snyder
2006-10-13 22:03             ` Daniel Jacobowitz
2006-10-14 15:18               ` Wu Zhou

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=452CC397.5050304@cn.ibm.com \
    --to=woodzltc@cn.ibm.com \
    --cc=gdb@sourceware.org \
    /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