Are ppc*_elf_write_core_note Os-specific?
John Baldwin
jhb@freebsd.org
Mon Jan 18 17:40:00 GMT 2016
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.
--
John Baldwin
More information about the Binutils
mailing list