https://sourceware.org/bugzilla/show_bug.cgi?id=34676
Bug ID: 34676
Summary: sh: Linux core files lose their registers when BFD is
built with --enable-targets=all
Product: binutils
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: binutils
Assignee: unassigned at sourceware dot org
Reporter: mattst88 at gmail dot com
Target Milestone: ---
With --enable-targets=all on an x86_64 host (as in distro gdb-multiarch
packages), gdb cannot read registers from sh4 or sh4eb Linux core files:
$ gdb -batch -ex 'info registers pc' ./sh4 core
warning: Couldn't find general-purpose registers in core file.
...
pc <unavailable>
With "set gnutarget elf32-sh-linux" the same core works:
pc 0x555505aa 0x555505aa
The core (e_flags 0, EI_OSABI 0, which is what Linux writes) is accepted by
elf32-shl, elf32-sh-linux, elf32-shl-nbsd and elf32-shl-vxworks, all with
match_priority 1. None is the default or an associated vector, so
bfd_check_format_matches picks the first, elf32-shl. Only the Linux vector sets
elf_backend_grok_prstatus and elf_backend_grok_psinfo, so the chosen BFD has no
.reg section. "objdump -f core" also reports elf32-shl.
Other targets don't hit this because every vector in the tie handles the notes,
e.g. elf32-nbigmips and elf32-ntradbigmips for MIPS.
Defining elf_backend_grok_prstatus and elf_backend_grok_psinfo for the generic
sh vector in elf32-sh.c, so the NetBSD, Linux and FDPIC vectors inherit them
(VxWorks already #undefs them), fixes it. With that change gdb reads the
registers and gives a full backtrace for both sh4 and sh4eb cores. NetBSD cores
use NetBSD-CORE notes, so the NetBSD vector is not affected in practice.
Looks similar to bug 16054 (arm), but I can not reproduce the issue on arm so
it has probably been fixed in the last 13 years.
--
You are receiving this mail because:
You are on the CC list for the bug.