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 fetching 1 byte register in HC11/HC12 simulator


Hi!

I committed this patch to fix fetching 1 byte registers from gdb.  I was storing them
as 2 bytes in big-endian and gdb is using only the upper value (thus always getting 0).
It didn't bless debugging (too much) because these registers never appear in debug info
(no vars allocated in them).

Stephane

2003-03-01 Stephane Carrez <stcarrez at nerim dot fr>

	* interp.c (sim_fetch_register): Only store a single byte for
	1 byte registers.
Index: interp.c
===================================================================
RCS file: /cvs/src/src/sim/m68hc11/interp.c,v
retrieving revision 1.14
diff -u -p -r1.14 interp.c
--- interp.c	27 Feb 2003 23:26:34 -0000	1.14
+++ interp.c	1 Mar 2003 15:59:54 -0000
@@ -554,8 +554,15 @@ sim_fetch_register (SIM_DESC sd, int rn,
       val = 0;
       break;
     }
-  memory[0] = val >> 8;
-  memory[1] = val & 0x0FF;
+  if (size == 1)
+    {
+      memory[0] = val;
+    }
+  else
+    {
+      memory[0] = val >> 8;
+      memory[1] = val & 0x0FF;
+    }
   return size;
 }
 

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