Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@cygnus.com>
To: Michael Snyder <msnyder@redhat.com>
Cc: gdb-patches@sources.redhat.com, Kevin Buettner <kevinb@redhat.com>
Subject: Re: [patch/rfa:rs6000] Don't use ->prev
Date: Sat, 04 May 2002 18:39:00 -0000	[thread overview]
Message-ID: <3CD48D37.5040700@cygnus.com> (raw)
In-Reply-To: <3CC72A2B.B9C88580@redhat.com>

> Andrew Cagney wrote:
> 
>> 
>> Hello,
>> 
>> A number of targets contained code that tested ``->prev'' as part of
>> doing their frame analysis.  I think this ``cheating''.  The objective
>> of the frame analysis code is to create the ->prev frame using
>> information from the current frame, not to use the still being created
>> ->prev frame :-)
>> 
>> Two cases - frame_chain for z8k and s390 - were, I think, simply wrong.
>>   The deleted z8k comment is telling - someone was 180 degrees out! :-)
> 
> 
> I notice that your patch does not preserve the functionality on s390 --
> if the condition is false, the old code would set prev_fp, but yours
> will not.

Yes.  That shouldn't matter.

  {
    CORE_ADDR prev_fp = 0;

-  if (thisframe->prev && thisframe->prev->frame)
-    prev_fp = thisframe->prev->frame;
-  else if (generic_find_dummy_frame (thisframe->pc, thisframe->frame))
+  if (generic_find_dummy_frame (thisframe->pc, thisframe->frame))
      return generic_read_register_dummy (thisframe->pc,

The function (frame_chain()) will simply compute prev_fp using thisframe.


>> The other two cases - get_saved_regs for SPARC and rs6000 - are more
>> interesting.
>> 
>> The SPARC code clearly relies on there already being a ->prev frame so
>> I've used get_prev_frame().  Since ->prev must exist, there is no risk
>> of recursion - get_prev_frame() calling get_saved_regs() (yes, grotty).
> 
> 
> Maybe a comment to that effect?
> Otherwise the sparc bit is (belatedly) approved.  ;-)

I've added this comment:

	    /* NOTE: cagney/2002-05-04: The call to get_prev_frame()
                is safe/cheap - there will always be a prev frame.
                This is because frame1 is initialized to frame->next
                (frame1->prev == frame) and is then advanced towards
                the innermost (next) frame.  */


Andrew




      reply	other threads:[~2002-05-05  1:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-14  9:52 Andrew Cagney
2002-04-15  0:59 ` Kevin Buettner
2002-04-19 20:11   ` Andrew Cagney
2002-04-24 15:09 ` Michael Snyder
2002-05-04 18:39   ` Andrew Cagney [this message]

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=3CD48D37.5040700@cygnus.com \
    --to=ac131313@cygnus.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=kevinb@redhat.com \
    --cc=msnyder@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