Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfa/amd64] Zero fill 32-bit registers
@ 2004-02-27  1:22 Andrew Cagney
  2004-02-28 10:46 ` Mark Kettenis
  0 siblings, 1 reply; 12+ messages in thread
From: Andrew Cagney @ 2004-02-27  1:22 UTC (permalink / raw)
  To: gdb-patches

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

Hello,

For a 64-bit gregset, the code was only modifying the low 32-bits of the 
register field - leaving the upper 64-bits undefined.  This, among other 
things, would lead to mysterious 32-bit thread failures.

The attached ensures that the upper part of each fetched register is zero.

ok?
Andrew

[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 1710 bytes --]

2004-02-25  Andrew Cagney  <cagney@redhat.com>

	* amd64-nat.c: Include "gdb_string.h".
	(amd64_collect_native_gregset): Zero fill the register.
	* Makefile.in: Update dependencies.
	
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.517
diff -u -r1.517 Makefile.in
--- Makefile.in	26 Feb 2004 23:48:01 -0000	1.517
+++ Makefile.in	27 Feb 2004 01:19:15 -0000
@@ -1536,7 +1536,7 @@
 	$(regcache_h) $(osabi_h) $(gdb_string_h) $(amd64_tdep_h) \
 	$(amd64_linux_tdep_h)
 amd64-nat.o: amd64-nat.c $(defs_h) $(gdbarch_h) $(regcache_h) \
-	$(gdb_assert_h) $(i386_tdep_h) $(amd64_tdep_h)
+	$(gdb_assert_h) $(gdb_string_h) $(i386_tdep_h) $(amd64_tdep_h)
 amd64nbsd-nat.o: amd64nbsd-nat.c $(defs_h) $(gdb_assert_h) $(amd64_tdep_h) \
 	$(amd64_nat_h)
 amd64nbsd-tdep.o: amd64nbsd-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) \
Index: amd64-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/amd64-nat.c,v
retrieving revision 1.4
diff -u -r1.4 amd64-nat.c
--- amd64-nat.c	25 Feb 2004 20:59:12 -0000	1.4
+++ amd64-nat.c	27 Feb 2004 01:19:15 -0000
@@ -24,6 +24,7 @@
 #include "regcache.h"
 
 #include "gdb_assert.h"
+#include "gdb_string.h"
 
 #include "i386-tdep.h"
 #include "amd64-tdep.h"
@@ -140,7 +141,12 @@
 	  int offset = amd64_native_gregset_reg_offset (i);
 
 	  if (offset != -1)
-	    regcache_raw_collect (regcache, i, regs + offset);
+	    {
+	      regcache_raw_collect (regcache, i, regs + offset);
+	      if (register_size (gdbarch, i) < 8)
+		memset (regs + offset + register_size (gdbarch, i),
+			0, 8 - register_size (gdbarch, i));
+	    }
 	}
     }
 }

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2004-03-02 16:10 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-27  1:22 [rfa/amd64] Zero fill 32-bit registers Andrew Cagney
2004-02-28 10:46 ` Mark Kettenis
2004-02-28 15:17   ` Andrew Cagney
2004-02-28 17:35     ` Mark Kettenis
2004-02-28 19:18       ` Andrew Cagney
2004-02-28 20:26         ` Mark Kettenis
2004-02-28 20:40           ` Andrew Cagney
2004-02-28 21:56             ` [PATCH] " Mark Kettenis
2004-02-29 23:11               ` Andrew Cagney
2004-02-29 23:45                 ` Mark Kettenis
2004-03-02 16:10                   ` Andrew Cagney
2004-03-19  0:09                     ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox