From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [RFA] find_saved_register(): Terminate loop when saved reg found
Date: Mon, 05 Aug 2002 14:52:00 -0000 [thread overview]
Message-ID: <1020805215225.ZM25934@localhost.localdomain> (raw)
As currently written, find_saved_register() scans from the callee (if
any) of FRAME through to the innermost frame looking for the location
at which a particular register was saved. The problem with the loop
as currently written is that it doesn't terminate until the the very
last (innermost) frame is reached. This is wrong. It should
terminate as soon as the address of the saved register is found.
Prior to April of this year, the loop in question worked quite
differently. It would start at the innermost frame (which is the most
recently pushed frame as viewed execution-wise from the inferior) and
consider each caller in succession until the frame under consideration
was reached.
In April, 2002, the termination condition mentioned above was removed
and the direction of frame traversal was reversed. I.e, instead of
following the "caller" link, the loop now instead follows the "callee"
link. I suspect that the addition of the appropriate termination
condition for this new arrangement was merely an oversight.
(This change fixes quite a few testsuite failures for the mips target
that I'm working on.)
Okay to commit?
* frame.c (find_saved_register): Break out of loop once saved
register address is found. Don't mention sparc in loop comment
anymore.
Index: frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.13
diff -u -p -r1.13 frame.c
--- frame.c 10 Jun 2002 23:25:50 -0000 1.13
+++ frame.c 5 Aug 2002 20:54:46 -0000
@@ -94,10 +94,9 @@ find_saved_register (struct frame_info *
if (frame == NULL) /* No regs saved if want current frame */
return 0;
- /* Note that this next routine assumes that registers used in
- frame x will be saved only in the frame that x calls and
- frames interior to it. This is not true on the sparc, but the
- above macro takes care of it, so we should be all right. */
+ /* Note that the following loop assumes that registers used in
+ frame x will be saved only in the frame that x calls and frames
+ interior to it. */
while (1)
{
QUIT;
@@ -107,7 +106,10 @@ find_saved_register (struct frame_info *
frame = frame1;
FRAME_INIT_SAVED_REGS (frame1);
if (frame1->saved_regs[regnum])
- addr = frame1->saved_regs[regnum];
+ {
+ addr = frame1->saved_regs[regnum];
+ break;
+ }
}
return addr;
next reply other threads:[~2002-08-05 21:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-05 14:52 Kevin Buettner [this message]
2002-08-05 21:04 ` Andrew Cagney
2002-08-06 15:44 ` Kevin Buettner
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=1020805215225.ZM25934@localhost.localdomain \
--to=kevinb@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