From: Jakub Jelinek <jakub@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [PATCH] Fix sparc-*-linux register fetching/storing
Date: Sat, 10 Nov 2001 09:20:00 -0000 [thread overview]
Message-ID: <20011123154220.A562@sunsite.ms.mff.cuni.cz> (raw)
Hi!
On sparc-*-linux, bfd automatically supports both 32bit and 64bit ABI and
thus CORE_ADDR is 64bit type. Unfortunately, this means %l0-%i7 registers
are read from incorrect place (and stored too), particularly from caller's
instruction chain. This means even simple commands like next or bt don't
work at all.
Ok to commit?
2001-11-23 Jakub Jelinek <jakub@redhat.com>
* sparc-nat.c (fetch_inferior_registers): Don't rely
on CORE_ADDR being 32-bit.
(store_inferior_registers): Likewise.
--- gdb/sparc-nat.c.jj Sun Oct 14 19:15:14 2001
+++ gdb/sparc-nat.c Fri Nov 23 16:45:58 2001
@@ -120,15 +120,15 @@ fetch_inferior_registers (int regno)
all (16 ptrace calls!) if we really need them. */
if (regno == -1)
{
- target_read_memory (*(CORE_ADDR *) & registers[REGISTER_BYTE (SP_REGNUM)],
- ®isters[REGISTER_BYTE (L0_REGNUM)],
+ CORE_ADDR sp = *(unsigned int *) & registers[REGISTER_BYTE (SP_REGNUM)];
+ target_read_memory (sp, ®isters[REGISTER_BYTE (L0_REGNUM)],
16 * REGISTER_RAW_SIZE (L0_REGNUM));
for (i = L0_REGNUM; i <= I7_REGNUM; i++)
register_valid[i] = 1;
}
else if (regno >= L0_REGNUM && regno <= I7_REGNUM)
{
- CORE_ADDR sp = *(CORE_ADDR *) & registers[REGISTER_BYTE (SP_REGNUM)];
+ CORE_ADDR sp = *(unsigned int *) & registers[REGISTER_BYTE (SP_REGNUM)];
i = REGISTER_BYTE (regno);
if (register_valid[regno])
printf_unfiltered ("register %d valid and read\n", regno);
@@ -190,7 +190,7 @@ store_inferior_registers (int regno)
if (wanna_store & STACK_REGS)
{
- CORE_ADDR sp = *(CORE_ADDR *) & registers[REGISTER_BYTE (SP_REGNUM)];
+ CORE_ADDR sp = *(unsigned int *) & registers[REGISTER_BYTE (SP_REGNUM)];
if (regno < 0 || regno == SP_REGNUM)
{
Jakub
next reply other threads:[~2001-11-23 14:39 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-11-10 9:20 Jakub Jelinek [this message]
2001-11-10 13:03 ` Daniel Jacobowitz
2001-11-10 16:27 ` Jakub Jelinek
2001-11-10 16:35 ` Daniel Jacobowitz
2001-11-10 16:41 ` Jakub Jelinek
2001-11-10 16:42 ` Daniel Jacobowitz
2001-11-12 10:39 ` Andrew Cagney
2001-11-26 9:18 ` Andrew Cagney
2001-11-26 12:04 ` Daniel Jacobowitz
2001-11-12 18:40 ` Daniel Jacobowitz
2001-11-26 12:34 ` Andrew Cagney
2001-11-12 19:11 ` Andrew Cagney
2001-11-13 8:19 ` Daniel Jacobowitz
2001-11-26 12:43 ` Daniel Jacobowitz
2001-11-26 13:19 ` Andrew Cagney
2001-11-13 8:28 ` Andrew Cagney
2001-11-26 9:08 ` Andrew Cagney
2001-11-12 10:04 ` 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=20011123154220.A562@sunsite.ms.mff.cuni.cz \
--to=jakub@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