Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Stephane Carrez <stcarrez@nerim.fr>
To: gdb-patches@sources.redhat.com, ac131313@redhat.com
Subject: [PATCH]: Fix generic_register_byte
Date: Sun, 02 Mar 2003 10:27:00 -0000	[thread overview]
Message-ID: <3E61DC7C.4040805@nerim.fr> (raw)

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

Hi Andrew,

I've committed this patch (obvious fix) to fix a bug in generic_register_byte().
You were using the 'regnum' instead of the loop index and this resulted in a wrong
byte position being computed. Ie:  reg_num * generic_register_size (reg_num).

It didn't show up for you because most targets use a fixed-size register definition (I guess).
For HC11, I have 2-byte reg as well as 1-byte reg, so it came up to invalid value, and
then aborted in frame_register().

	Stephane

2003-03-02  Stephane Carrez  <stcarrez@nerim.fr>

	* arch-utils.c (generic_register_byte): Fix to use the loop index
	and not regnum when summing the size of all registers up to regnum.

[-- Attachment #2: arch-utils.c.diffs --]
[-- Type: text/plain, Size: 499 bytes --]

Index: arch-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.c,v
retrieving revision 1.75
diff -u -p -r1.75 arch-utils.c
--- arch-utils.c	1 Mar 2003 17:59:12 -0000	1.75
+++ arch-utils.c	2 Mar 2003 10:21:58 -0000
@@ -460,7 +460,7 @@ generic_register_byte (int regnum)
   byte = 0;
   for (i = 0; i < regnum; i++)
     {
-      byte += generic_register_size (regnum);
+      byte += generic_register_size (i);
     }
   return byte;
 }

             reply	other threads:[~2003-03-02 10:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-02 10:27 Stephane Carrez [this message]
2003-03-02 14:07 ` 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=3E61DC7C.4040805@nerim.fr \
    --to=stcarrez@nerim.fr \
    --cc=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