From: Andrew Cagney <ac131313@cygnus.com>
To: gdb-patches@sources.redhat.com
Subject: [rfa:rs6000] Simplify alloca reg fetch
Date: Wed, 17 Apr 2002 15:46:00 -0000 [thread overview]
Message-ID: <3CBDFB36.2030605@cygnus.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 320 bytes --]
Hello,
The attatched replaces some hardwired code for fetching the alloca
register with a call to frame_register_read().
The code is equivalent (except for the case where, for some reason, the
register isn't available where the new code is more robust).
(This is what was breaking the register cache code).
Andrew
[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 2426 bytes --]
2002-04-17 Andrew Cagney <ac131313@redhat.com>
* rs6000-tdep.c (frame_initial_stack_address): Use
frame_register_read to read the alloca_reg.
Index: rs6000-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v
retrieving revision 1.55
diff -u -r1.55 rs6000-tdep.c
--- rs6000-tdep.c 12 Apr 2002 19:48:36 -0000 1.55
+++ rs6000-tdep.c 17 Apr 2002 22:42:30 -0000
@@ -1488,41 +1488,22 @@
return fi->extra_info->initial_sp;
}
- /* This function has an alloca register. If this is the top-most frame
- (with the lowest address), the value in alloca register is good. */
-
- if (!fi->next)
- return fi->extra_info->initial_sp = read_register (fdata.alloca_reg);
-
- /* Otherwise, this is a caller frame. Callee has usually already saved
- registers, but there are exceptions (such as when the callee
- has no parameters). Find the address in which caller's alloca
- register is saved. */
-
- for (callee_fi = fi->next; callee_fi; callee_fi = callee_fi->next)
- {
-
- if (!callee_fi->saved_regs)
- frame_get_saved_regs (callee_fi, NULL);
-
- /* this is the address in which alloca register is saved. */
-
- tmpaddr = callee_fi->saved_regs[fdata.alloca_reg];
- if (tmpaddr)
- {
- fi->extra_info->initial_sp =
- read_memory_addr (tmpaddr, TDEP->wordsize);
- return fi->extra_info->initial_sp;
- }
-
- /* Go look into deeper levels of the frame chain to see if any one of
- the callees has saved alloca register. */
- }
-
- /* If alloca register was not saved, by the callee (or any of its callees)
- then the value in the register is still good. */
-
- fi->extra_info->initial_sp = read_register (fdata.alloca_reg);
+ /* There is an alloca register, use its value, in the current frame,
+ as the initial stack pointer. */
+ {
+ char *tmpbuf = alloca (MAX_REGISTER_RAW_SIZE);
+ if (frame_register_read (fi, fdata.alloca_reg, tmpbuf))
+ {
+ fi->extra_info->initial_sp
+ = extract_unsigned_integer (tmpbuf,
+ REGISTER_RAW_SIZE (fdata.alloca_reg));
+ }
+ else
+ /* NOTE: cagney/2002-04-17: At present the only time
+ frame_register_read will fail is when the register isn't
+ available. If that does happen, use the frame. */
+ fi->extra_info->initial_sp = fi->frame;
+ }
return fi->extra_info->initial_sp;
}
next reply other threads:[~2002-04-17 22:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-17 15:46 Andrew Cagney [this message]
2002-04-17 15:55 ` Kevin Buettner
2002-04-17 16:29 ` Andrew Cagney
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=3CBDFB36.2030605@cygnus.com \
--to=ac131313@cygnus.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