Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@redhat.com>
To: Andrew Cagney <ac131313@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [commit] Move legacy prev->next = ... earlier
Date: Sat, 05 Apr 2003 18:21:00 -0000	[thread overview]
Message-ID: <3E8F1EA2.10201@redhat.com> (raw)
In-Reply-To: <3E8EFCBD.6090401@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 72 bytes --]

Did I mention that it wasn't my day.  Again, the real patch :-/

Andrew

[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 2217 bytes --]

2003-04-05  Andrew Cagney  <cagney@redhat.com>

	* frame.c (legacy_get_prev_frame): Link prev to next at the
	function start.  Update comments.

Index: frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.97
diff -u -r1.97 frame.c
--- frame.c	5 Apr 2003 15:39:33 -0000	1.97
+++ frame.c	5 Apr 2003 15:42:22 -0000
@@ -1029,10 +1029,7 @@
   struct frame_info *prev;
   int fromleaf;
 
-  /* Allocate the new frame but do not wire it in to the frame chain.
-     Some (bad) code in INIT_FRAME_EXTRA_INFO tries to look along
-     frame->next to pull some fancy tricks (of course such code is, by
-     definition, recursive).  Try to prevent it.
+  /* Allocate the new frame.
 
      There is no reason to worry about memory leaks, should the
      remainder of the function fail.  The allocated memory will be
@@ -1042,6 +1039,17 @@
   prev = FRAME_OBSTACK_ZALLOC (struct frame_info);
   prev->level = this_frame->level + 1;
 
+  /* Do not completly wire it in to the frame chain.  Some (bad) code
+     in INIT_FRAME_EXTRA_INFO tries to look along frame->prev to pull
+     some fancy tricks (of course such code is, by definition,
+     recursive).
+  
+     On the other hand, methods, such as get_frame_pc() and
+     get_frame_base() rely on being able to walk along the frame
+     chain.  Make certain that at least they work by providing that
+     link.  Of course things manipulating prev can't go back.  */
+  prev->next = this_frame;
+
   /* NOTE: cagney/2002-11-18: Should have been correctly setting the
      frame's type here, before anything else, and not last, at the
      bottom of this function.  The various
@@ -1155,7 +1163,6 @@
 
       /* Link it in.  */
       this_frame->prev = prev;
-      prev->next = this_frame;
 
       /* FIXME: cagney/2002-01-19: This call will go away.  Instead of
 	 initializing extra info, all frames will use the frame_cache
@@ -1230,7 +1237,6 @@
 
   /* Link in the already allocated prev frame.  */
   this_frame->prev = prev;
-  prev->next = this_frame;
   deprecated_update_frame_base_hack (prev, address);
 
   /* This change should not be needed, FIXME!  We should determine

      reply	other threads:[~2003-04-05 18:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-05 15:56 Andrew Cagney
2003-04-05 18:21 ` 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=3E8F1EA2.10201@redhat.com \
    --to=ac131313@redhat.com \
    --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