This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH]: Fix generic_register_byte


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 at nerim dot 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.
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;
 }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]