Bug 4606 - gcore broken by bfd change
Summary: gcore broken by bfd change
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.18
: P2 normal
Target Milestone: ---
Assignee: Alan Modra
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-09 10:11 UTC by Andreas Schwab
Modified: 2007-06-21 03:00 UTC (History)
3 users (show)

See Also:
Host:
Target: ia64-suse-linux
Build:
Last reconfirmed: 2007-06-12 10:33:45


Attachments
readelf -Wa gcore.test (before change) (1.29 KB, text/plain)
2007-06-09 10:12 UTC, Andreas Schwab
Details
readelf -Wa gcore.test (after change) (1.30 KB, text/plain)
2007-06-09 10:14 UTC, Andreas Schwab
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Schwab 2007-06-09 10:11:25 UTC
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.
Comment 1 Andreas Schwab 2007-06-09 10:12:59 UTC
Created attachment 1884 [details]
readelf -Wa gcore.test (before change)
Comment 2 Andreas Schwab 2007-06-09 10:14:06 UTC
Created attachment 1885 [details]
readelf -Wa gcore.test (after change)
Comment 3 H.J. Lu 2007-06-19 22:14:05 UTC
Can you provide a testcase to show before and after gdb behavior?
Comment 4 Andreas Schwab 2007-06-19 22:22:43 UTC
gdb/testsuite/gdb.base/gcore.exp
Comment 5 H.J. Lu 2007-06-20 16:59:42 UTC
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.
Comment 6 H.J. Lu 2007-06-20 18:23:57 UTC
A patch is posted at

http://sourceware.org/ml/gdb-patches/2007-06/msg00397.html
Comment 7 H.J. Lu 2007-06-20 18:32:27 UTC
Fixed in gdb.
Comment 8 Alan Modra 2007-06-21 03:00:47 UTC
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.)