This is the mail archive of the
mailing list for the binutils project.
Are ppc*_elf_write_core_note Os-specific?
- From: John Baldwin <jhb at freebsd dot org>
- To: Alan Modra <amodra at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Mon, 18 Jan 2016 09:40 -0800
- Subject: Are ppc*_elf_write_core_note Os-specific?
- Authentication-results: sourceware.org; auth=none
I was recently testing 'gcore' of a threaded program under gdb on FreeBSD
and received warnings about a mismatched ".reg" section for each LWP when
gdb examined the generated core file. After some debugging I determined
that gcore in gdb is generating a different-sized NT_PRSTATUS note for
each thread due to calling ppc64_elf_write_core() instead of using the
default logic for NT_PRSTATUS of dumping the platform's prstatus_t type.
The code for ppc64_elf_write_core_note() seems to be OS-specific (for
Linux?). It assumes that the gregs passed in are a specific size via magic
numbers passed to memcpy(), etc. On FreeBSD this means the memcpy() is
actually a buffer overrun though gdb ignores whatever garbage is copied out
to the core when it is later read.
For FreeBSD (and possibly other systems), I think it would be ideal if
ppc*_elf_write_core_note were not defined if the current versions are
indeed OS specific.