aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2012-01-05 07:50:44 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2012-01-05 07:50:44 +0000
commite85c6a701591c2a23c8ae14405d17f7e2e845916 (patch)
tree7b12dae7be7424a5721a86e60c2fc51139765bdc /bfd
parentc40a53a844c2364d8650438d3a02b95c274f1c80 (diff)
downloadgdb-e85c6a701591c2a23c8ae14405d17f7e2e845916.zip
gdb-e85c6a701591c2a23c8ae14405d17f7e2e845916.tar.gz
gdb-e85c6a701591c2a23c8ae14405d17f7e2e845916.tar.bz2
bfd/
Fix zero registers core files when built by gcc-4.7. * elf64-x86-64.c (elf_x86_64_write_core_note): Remove variables p and size. Call elfcore_write_note for the local variables. Remove the final elfcore_write_note call. Add NOTREACHED comments.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/elf64-x86-64.c29
2 files changed, 19 insertions, 17 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 5dac115..eeef5a6 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2012-01-05 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Fix zero registers core files when built by gcc-4.7.
+ * elf64-x86-64.c (elf_x86_64_write_core_note): Remove variables p and
+ size. Call elfcore_write_note for the local variables. Remove the
+ final elfcore_write_note call. Add NOTREACHED comments.
+
2012-01-04 Tristan Gingold <gingold@adacore.com>
* mach-o.c (bfd_mach_o_fat_stat_arch_elt): New function.
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index a4dfd48..25c14a8 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -420,8 +420,6 @@ elf_x86_64_write_core_note (bfd *abfd, char *buf, int *bufsiz,
int note_type, ...)
{
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- const void *p;
- int size;
va_list ap;
const char *fname, *psargs;
long pid;
@@ -445,8 +443,8 @@ elf_x86_64_write_core_note (bfd *abfd, char *buf, int *bufsiz,
memset (&data, 0, sizeof (data));
strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
- p = (const void *) &data;
- size = sizeof (data);
+ return elfcore_write_note (abfd, buf, bufsiz, "CORE", note_type,
+ &data, sizeof (data));
}
else
{
@@ -454,10 +452,10 @@ elf_x86_64_write_core_note (bfd *abfd, char *buf, int *bufsiz,
memset (&data, 0, sizeof (data));
strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
- p = (const void *) &data;
- size = sizeof (data);
+ return elfcore_write_note (abfd, buf, bufsiz, "CORE", note_type,
+ &data, sizeof (data));
}
- break;
+ /* NOTREACHED */
case NT_PRSTATUS:
va_start (ap, note_type);
@@ -475,8 +473,8 @@ elf_x86_64_write_core_note (bfd *abfd, char *buf, int *bufsiz,
prstat.pr_pid = pid;
prstat.pr_cursig = cursig;
memcpy (&prstat.pr_reg, gregs, sizeof (prstat.pr_reg));
- p = (const void *) &prstat;
- size = sizeof (prstat);
+ return elfcore_write_note (abfd, buf, bufsiz, "CORE", note_type,
+ &prstat, sizeof (prstat));
}
else
{
@@ -485,8 +483,8 @@ elf_x86_64_write_core_note (bfd *abfd, char *buf, int *bufsiz,
prstat.pr_pid = pid;
prstat.pr_cursig = cursig;
memcpy (&prstat.pr_reg, gregs, sizeof (prstat.pr_reg));
- p = (const void *) &prstat;
- size = sizeof (prstat);
+ return elfcore_write_note (abfd, buf, bufsiz, "CORE", note_type,
+ &prstat, sizeof (prstat));
}
}
else
@@ -496,14 +494,11 @@ elf_x86_64_write_core_note (bfd *abfd, char *buf, int *bufsiz,
prstat.pr_pid = pid;
prstat.pr_cursig = cursig;
memcpy (&prstat.pr_reg, gregs, sizeof (prstat.pr_reg));
- p = (const void *) &prstat;
- size = sizeof (prstat);
+ return elfcore_write_note (abfd, buf, bufsiz, "CORE", note_type,
+ &prstat, sizeof (prstat));
}
- break;
}
-
- return elfcore_write_note (abfd, buf, bufsiz, "CORE", note_type, p,
- size);
+ /* NOTREACHED */
}
#endif