This patch: 2007-05-30 Alan Modra <amodra@bigpond.net.au> * elf.c (assign_file_positions_for_load_sections): Correct sh_type to SHT_NOBITS earlier. Base actions in rest of function on sh_type and sh_flags instead of bfd section flags. Delete voff and code keeping nobits segments aligned. breaks the gcore command in gdb. The core file generated during the gdb gcore test is invalid in a way such that gdb is stuck in an infinite loop during backtrace.
Created attachment 1884 [details] readelf -Wa gcore.test (before change)
Created attachment 1885 [details] readelf -Wa gcore.test (after change)
Can you provide a testcase to show before and after gdb behavior?
gdb/testsuite/gdb.base/gcore.exp
I think the bug is somewhere else: -rw-r--r-- 1 hjl hjl 3003608 Jun 20 09:25 core.28610 -rw------- 1 hjl hjl 360448 Jun 20 09:26 core.kernel Kernel core dump is much smaller.
A patch is posted at http://sourceware.org/ml/gdb-patches/2007-06/msg00397.html
Fixed in gdb.
Thanks HJ. I had a slightly different patch to gcore.c that accomplished the same thing in my local tree, then got busy with other things and forgot about it. (My patch cleared both SEC_LOAD and SEC_HAS_CONTENTS rather than setting SEC_NEVER_LOAD.)