diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2012-02-12 19:25:29 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2012-02-12 19:25:29 +0000 |
commit | 11fde611c4e37bc23193fb6b05ece79b338cee71 (patch) | |
tree | d2b776dd907dbfce8bc604460f30e86c0d9b2d41 | |
parent | 570083757caf694cbcf250a64f88709a8676aacf (diff) | |
download | gdb-11fde611c4e37bc23193fb6b05ece79b338cee71.zip gdb-11fde611c4e37bc23193fb6b05ece79b338cee71.tar.gz gdb-11fde611c4e37bc23193fb6b05ece79b338cee71.tar.bz2 |
gdb/
* ppc-linux-nat.c (fetch_register, store_register): Fix GCC aliasing
compilation warning.
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/ppc-linux-nat.c | 12 |
2 files changed, 13 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e11ad4a..607a570 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2012-02-12 Jan Kratochvil <jan.kratochvil@redhat.com> + * ppc-linux-nat.c (fetch_register, store_register): Fix GCC aliasing + compilation warning. + +2012-02-12 Jan Kratochvil <jan.kratochvil@redhat.com> + Fix crash on loaded shlibs without loaded exec_bfd. * exec.c (exec_files_info): Do not crash on NULL EXEC_BFD. (set_section_command): Replace exec_bfd by p->bfd. diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index af80919..2c98f76 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -593,9 +593,10 @@ fetch_register (struct regcache *regcache, int tid, int regno) bytes_transferred < register_size (gdbarch, regno); bytes_transferred += sizeof (long)) { + long l; + errno = 0; - *(long *) &buf[bytes_transferred] - = ptrace (PTRACE_PEEKUSER, tid, (PTRACE_TYPE_ARG3) regaddr, 0); + l = ptrace (PTRACE_PEEKUSER, tid, (PTRACE_TYPE_ARG3) regaddr, 0); regaddr += sizeof (long); if (errno != 0) { @@ -604,6 +605,7 @@ fetch_register (struct regcache *regcache, int tid, int regno) gdbarch_register_name (gdbarch, regno), regno); perror_with_name (message); } + memcpy (&buf[bytes_transferred], &l, sizeof (l)); } /* Now supply the register. Keep in mind that the regcache's idea @@ -1073,9 +1075,11 @@ store_register (const struct regcache *regcache, int tid, int regno) for (i = 0; i < bytes_to_transfer; i += sizeof (long)) { + long l; + + memcpy (&l, &buf[i], sizeof (l)); errno = 0; - ptrace (PTRACE_POKEUSER, tid, (PTRACE_TYPE_ARG3) regaddr, - *(long *) &buf[i]); + ptrace (PTRACE_POKEUSER, tid, (PTRACE_TYPE_ARG3) regaddr, l); regaddr += sizeof (long); if (errno == EIO |