summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2003-04-05 15:49:54 +0000
committerAndrew Cagney <cagney@redhat.com>2003-04-05 15:49:54 +0000
commit4c9591e34bfec7d1833614752555306776313237 (patch)
tree894eececc27686ee5fd8dadf0217e68c7cf63942
parentd513dfc7d32999f7698e63b6c3b806f510efe0a6 (diff)
downloadgdb-4c9591e34bfec7d1833614752555306776313237.tar.gz
2003-04-05 Andrew Cagney <cagney@redhat.com>
* frame.c (legacy_get_prev_frame): Link prev to next at the function start. Update comments.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/frame.c18
2 files changed, 17 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 81918aa082e..8bb0240ff4f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2003-04-05 Andrew Cagney <cagney@redhat.com>
+ * frame.c (legacy_get_prev_frame): Link prev to next at the
+ function start. Update comments.
+
+2003-04-05 Andrew Cagney <cagney@redhat.com>
+
* frame.c (get_frame_id): Update comment.
(legacy_get_prev_frame): Update comment.
* gdbarch.sh: Delete check for EXTRA_FRAME_INFO.
diff --git a/gdb/frame.c b/gdb/frame.c
index 1c653398842..161ff6085e8 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -1029,10 +1029,7 @@ legacy_get_prev_frame (struct frame_info *this_frame)
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 @@ legacy_get_prev_frame (struct frame_info *this_frame)
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 @@ legacy_get_prev_frame (struct frame_info *this_frame)
/* 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 @@ legacy_get_prev_frame (struct frame_info *this_frame)
/* 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