Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [rfa/amd64] Zero fill 32-bit registers
Date: Fri, 27 Feb 2004 01:22:00 -0000	[thread overview]
Message-ID: <403E9BC3.2030807@redhat.com> (raw)

[-- 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));
+	    }
 	}
     }
 }

             reply	other threads:[~2004-02-27  1:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-27  1:22 Andrew Cagney [this message]
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

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=403E9BC3.2030807@redhat.com \
    --to=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