* [PATCH]: Fix generic_register_byte
@ 2003-03-02 10:27 Stephane Carrez
2003-03-02 14:07 ` Andrew Cagney
0 siblings, 1 reply; 2+ messages in thread
From: Stephane Carrez @ 2003-03-02 10:27 UTC (permalink / raw)
To: gdb-patches, ac131313
[-- 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;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-03-02 14:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-02 10:27 [PATCH]: Fix generic_register_byte Stephane Carrez
2003-03-02 14:07 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox