2013-01-17 Pedro Alves <palves@redhat.com>
[deliverable/binutils-gdb.git] / gdb / m68klinux-nat.c
index d4410e68034d398862836113b6d499e038669727..19fb7abd3dcf300f2593e8c4580327755bd2251f 100644 (file)
@@ -1,6 +1,6 @@
 /* Motorola m68k native support for GNU/Linux.
 
-   Copyright (C) 1996, 1998, 2000-2012 Free Software Foundation, Inc.
+   Copyright (C) 1996-2013 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -107,7 +107,7 @@ static void
 fetch_register (struct regcache *regcache, int regno)
 {
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
-  long regaddr;
+  long regaddr, val;
   int i;
   char buf[MAX_REGISTER_SIZE];
   int tid;
@@ -122,7 +122,8 @@ fetch_register (struct regcache *regcache, int regno)
   for (i = 0; i < register_size (gdbarch, regno); i += sizeof (long))
     {
       errno = 0;
-      *(long *) &buf[i] = ptrace (PTRACE_PEEKUSER, tid, regaddr, 0);
+      val = ptrace (PTRACE_PEEKUSER, tid, regaddr, 0);
+      memcpy (&buf[i], &val, sizeof (long));
       regaddr += sizeof (long);
       if (errno != 0)
        error (_("Couldn't read register %s (#%d): %s."), 
@@ -160,7 +161,7 @@ static void
 store_register (const struct regcache *regcache, int regno)
 {
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
-  long regaddr;
+  long regaddr, val;
   int i;
   int tid;
   char buf[MAX_REGISTER_SIZE];
@@ -180,7 +181,8 @@ store_register (const struct regcache *regcache, int regno)
   for (i = 0; i < register_size (gdbarch, regno); i += sizeof (long))
     {
       errno = 0;
-      ptrace (PTRACE_POKEUSER, tid, regaddr, *(long *) &buf[i]);
+      memcpy (&val, &buf[i], sizeof (long));
+      ptrace (PTRACE_POKEUSER, tid, regaddr, val);
       regaddr += sizeof (long);
       if (errno != 0)
        error (_("Couldn't write register %s (#%d): %s."),
This page took 0.024132 seconds and 4 git commands to generate.