diff options
author | John Baldwin <jhb@FreeBSD.org> | 2017-06-01 09:40:46 -0700 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2017-06-01 09:40:46 -0700 |
commit | b5430a3ced5fe5ba484bd9b3215b9ae19ced0160 (patch) | |
tree | 9f9a9f46e37d3f6f48b534fbd8e1d44c0bfd57ce /bfd/ChangeLog | |
parent | f378ab099d535f5540f292fed07fcf4b1fabd314 (diff) | |
download | gdb-b5430a3ced5fe5ba484bd9b3215b9ae19ced0160.zip gdb-b5430a3ced5fe5ba484bd9b3215b9ae19ced0160.tar.gz gdb-b5430a3ced5fe5ba484bd9b3215b9ae19ced0160.tar.bz2 |
Use the ELF class to determine the word size for FreeBSD core notes.
FreeBSD ELF cores contain data structures with that have two different
layouts: one for ILP32 platforms and a second for LP64 platforms.
Previously, the code used 'bits_per_word' from 'arch_info', but this
field is not a reliable indicator of the format for FreeBSD MIPS cores
in particular.
I had originally posted this patch back in November because process
cores for FreeBSD MIPS contained an e_flags value of 0 in the header
which resulted in a bfd_arch which always had 'bits_per_word' set to
32. This permitted reading o32 cores, but not n64 cores. The feedback
I received then was to try to change n64 cores to use a different
default bfd_arch that had a 64-bit 'bits_per_word' when e_flags was zero.
I submitted a patch to that effect but it was never approved. Instead,
I changed FreeBSD's kernel and gcore commands to preserve the e_flags
field from an executable when generating process cores. With a proper
e_flags field in process cores, n64 cores now use a 64-bit bfd_arch and
now work fine. However, the change to include e_flags in the process
cores had the unintended side effect of breaking handling of o32
process cores. Specifically, FreeBSD MIPS builds o32 with a default
MIPS architecture of 'mips3', thus FreeBSD process cores with a non-zero
e_flags match the 'mips3' bfd_arch which has 64 'bits_per_word'.
From this, it seems that 'bits_per_word' for FreeBSD MIPS is not likely
to ever be completely correct. However, FreeBSD core dumps do
reliably set the ELF class to ELFCLASS32 for cores using ILP32 and
ELFCLASS64 for cores using LP64. As such, I think my original patch of
using the ELF class instead of 'bits_per_word' is probably the simplest
and most reliable approach for detecting the note structure layout.
bfd/ChangeLog:
* elf.c (elfcore_grok_freebsd_psinfo): Use ELF header class to
determine structure sizes.
(elfcore_grok_freebsd_prstatus): Likewise.
Diffstat (limited to 'bfd/ChangeLog')
-rw-r--r-- | bfd/ChangeLog | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index cb4afa9..8dfdc23 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2017-05-31 John Baldwin <jhb@FreeBSD.org> + + * elf.c (elfcore_grok_freebsd_psinfo): Use ELF header class to + determine structure sizes. + (elfcore_grok_freebsd_prstatus): Likewise. + 2017-06-01 Alan Modra <amodra@gmail.com> * elf64-ppc.c (struct ppc_link_hash_table): Add has_plt_localentry0. |