Bug 171783 - gdb's gcore SEGVs with big programs
gdb's gcore SEGVs with big programs
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: gdb (Show other bugs)
4.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Alexandre Oliva
Jay Turner
:
Depends On:
Blocks: 181409
  Show dependency treegraph
 
Reported: 2005-10-26 08:41 EDT by Bastien Nocera
Modified: 2015-01-07 19:11 EST (History)
5 users (show)

See Also:
Fixed In Version: RHBA-2006-0429
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-08-10 17:16:50 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
sample.c (123 bytes, patch)
2005-10-26 08:41 EDT, Bastien Nocera
no flags Details | Diff
gdb-use-longest-for-len.patch (9.69 KB, patch)
2005-10-26 08:42 EDT, Bastien Nocera
no flags Details | Diff
core and executable from phansen (5.82 MB, application/octet-stream)
2005-11-30 12:17 EST, Paul Hansen
no flags Details
Analysis of core file in Comment 5 (6.21 KB, text/plain)
2005-11-30 15:15 EST, Paul Hansen
no flags Details

  None (edit)
Description Bastien Nocera 2005-10-26 08:41:45 EDT
1. Launch attached test program
2. Try to gather a core from the program using gcore
3. See gdb SEGV

GNU gdb Red Hat Linux (6.3.0.0-1.63rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu"...Using host libthread_db
library "/lib64/tls/libthread_db.so.1".

Core was generated by
`/usr/src/redhat/BUILD/gdb-6.3.0.0-build-x86_64-redhat-linux-gnu/gdb/gdb'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib64/libncurses.so.5...done.
Loaded symbols for /usr/lib64/libncurses.so.5
Reading symbols from /lib64/tls/libm.so.6...done.
Loaded symbols for /lib64/tls/libm.so.6
Reading symbols from /lib64/libdl.so.2...done.
Loaded symbols for /lib64/libdl.so.2
Reading symbols from /lib64/tls/libc.so.6...done.
Loaded symbols for /lib64/tls/libc.so.6
Reading symbols from /lib64/ld-linux-x86-64.so.2...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Reading symbols from /lib64/tls/libthread_db.so.1...done.
Loaded symbols for /lib64/tls/libthread_db.so.1
#0  0x0000000000459fbb in child_xfer_memory (memaddr=0,
    myaddr=0x2a98666010 "", len=-2139082752, write=0, attrib=0x0,
    target=0x7c7640) at ../../gdb-6.3/gdb/infptrace.c:520
520           memcpy (myaddr,
Setting up the environment for debugging gdb.
Breakpoint 1 at 0x4497f0: file ../../gdb-6.3/gdb/utils.c, line 878.
Breakpoint 2 at 0x47a710: file ../../gdb-6.3/gdb/cli/cli-cmds.c, line 196.
(top-gdb) bt
#0  0x0000000000459fbb in child_xfer_memory (memaddr=0,
    myaddr=0x2a98666010 "", len=-2139082752, write=0, attrib=0x0,
    target=0x7c7640) at ../../gdb-6.3/gdb/infptrace.c:520
During symbol reading, Incomplete CFI data; unspecified register rax at
0x0000000000459e1e.
#1  0x000000000045a72d in child_xfer_partial (ops=Variable "ops" is not available.
)
    at ../../gdb-6.3/gdb/inftarg.c:547
#2  0x0000000000440414 in target_xfer_partial (ops=0x7c7640,
    object=TARGET_OBJECT_MEMORY, annex=0x0, readbuf=0x2a98666010,
    writebuf=0x0, offset=182894227456, len=-2139082752)
    at ../../gdb-6.3/gdb/target.c:872
#3  0x00000000004405fc in xfer_using_stratum (object=TARGET_OBJECT_MEMORY,
    annex=0x0, offset=182894227456, len=-2139082752, readbuf=0x2a98666010,
    writebuf=0x0) at ../../gdb-6.3/gdb/target.c:959
#4  0x00000000004409de in target_read_memory (memaddr=182894227456,
    myaddr=0x2a98666010 "", len=-2139082752) at ../../gdb-6.3/gdb/target.c:1009
#5  0x00000000004653a9 in gcore_copy_callback (obfd=0x866620, osec=0x833a60,
    ignored=Variable "ignored" is not available.
) at ../../gdb-6.3/gdb/gcore.c:471
#6  0x00000000005585ee in bfd_map_over_sections (abfd=0x866620,
    operation=0x465300 <gcore_copy_callback>, user_storage=0x0)
    at ../../gdb-6.3/bfd/section.c:1113
#7  0x000000000046560f in gcore_command (args=Variable "args" is not available.
)
    at ../../gdb-6.3/gdb/gcore.c:494
#8  0x000000000044754d in execute_command (p=0x7cb010 "0", from_tty=1)
    at ../../gdb-6.3/gdb/top.c:733
#9  0x00000000004d3366 in command_handler (
    command=0x7cb000 "\tgcore core.14270") at ../../gdb-6.3/gdb/event-top.c:500
#10 0x00000000004d38f0 in command_line_handler (rl=0x8c0390 "H\uffffR\uffff5")
    at ../../gdb-6.3/gdb/event-top.c:799
#11 0x00000000004d1c9d in process_event ()
    at ../../gdb-6.3/gdb/event-loop.c:334
#12 0x00000000004d27c8 in gdb_do_one_event (data=Variable "data" is not available.
)
    at ../../gdb-6.3/gdb/event-loop.c:371
#13 0x000000000044705e in catcher (func=0x447170 <do_catch_errors>,
    func_uiout=0x81e140, func_args=0x7fbffff2a0, func_val=0x7fbffff298,
    func_caught=0x7fbffff29c, errstring=Variable "errstring" is not available.
) at ../../gdb-6.3/gdb/top.c:431
#14 0x00000000004471c0 in catch_errors (func=Variable "func" is not available.
) at ../../gdb-6.3/gdb/top.c:536
#15 0x0000000000484946 in tui_command_loop (data=Variable "data" is not available.
)
    at ../../gdb-6.3/gdb/tui/tui-interp.c:150
#16 0x000000000043da19 in captured_command_loop (data=Variable "data" is not
available.
)
    at ../../gdb-6.3/gdb/main.c:91
#17 0x000000000044705e in catcher (func=0x447170 <do_catch_errors>,
    func_uiout=0x81e140, func_args=0x7fbffff450, func_val=0x7fbffff448,
    func_caught=0x7fbffff44c, errstring=Variable "errstring" is not available.
) at ../../gdb-6.3/gdb/top.c:431
#18 0x00000000004471c0 in catch_errors (func=Variable "func" is not available.
) at ../../gdb-6.3/gdb/top.c:536
#19 0x000000000043e0c6 in captured_main (data=Variable "data" is not available.
) at ../../gdb-6.3/gdb/main.c:802
#20 0x000000000044705e in catcher (func=0x447170 <do_catch_errors>,
    func_uiout=0x7a44e0, func_args=0x7fbffff7d0, func_val=0x7fbffff7c8,
    func_caught=0x7fbffff7cc, errstring=Variable "errstring" is not available.
) at ../../gdb-6.3/gdb/top.c:431
#21 0x00000000004471c0 in catch_errors (func=Variable "func" is not available.
) at ../../gdb-6.3/gdb/top.c:536
#22 0x000000000043e7f4 in gdb_main (args=Variable "args" is not available.
) at ../../gdb-6.3/gdb/main.c:811
#23 0x000000000043da07 in main (argc=Variable "argc" is not available.
) at ../../gdb-6.3/gdb/gdb.c:35
(top-gdb) frame 5
#5  0x00000000004653a9 in gcore_copy_callback (obfd=0x866620, osec=0x833a60,
    ignored=Variable "ignored" is not available.
) at ../../gdb-6.3/gdb/gcore.c:471
471       if (target_read_memory (bfd_section_vma (obfd, osec),
(top-gdb) p size
$1 = 2155884544
(top-gdb) frame 4
#4  0x00000000004409de in target_read_memory (memaddr=182894227456,
    myaddr=0x2a98666010 "", len=-2139082752) at ../../gdb-6.3/gdb/target.c:1009
1009        return xfer_using_stratum (TARGET_OBJECT_MEMORY, NULL,
(top-gdb) p len
$2 = -2139082752
Comment 1 Bastien Nocera 2005-10-26 08:41:46 EDT
Created attachment 120408 [details]
sample.c
Comment 2 Bastien Nocera 2005-10-26 08:42:56 EDT
Created attachment 120409 [details]
gdb-use-longest-for-len.patch

Partial patch, would now require changes to the internal bfd copy.
Comment 5 Paul Hansen 2005-11-30 12:17:22 EST
Created attachment 121639 [details]
core and executable from phansen
Comment 6 Paul Hansen 2005-11-30 14:43:35 EST
Apparently my comments did not get added with the attachment.

The core in question occurred on a quad Opteron Compaq DL-585 using
LAS4.0U1 with the 2.6.9-11.ELsmp (x86 32bit) kernel.  The gdb in use to generate
this bt is gdb-6.3.0.0-1.63.i386, although this also occurs using gdb-6.3.0.0-
0.31.  Everything on the system is 32bit.

The executable (bootsvr) and the core have the following sizes:

[root@nps21110 ~]# ls -l bootsvr core
-rwxr-xr-x  1 root root   13442750 Jun 26 21:08 bootsvr
-rw-------  1 root root 2664439808 Jun 26 21:12 core


and the gdb output is:

[root@nps21110 ~]# gdb bootsvr core
GNU gdb Red Hat Linux (6.3.0.0-1.63rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...Using host libthread_db 
library "/lib/tls/libthread_db.so.1".


warning: exec file is newer than core file.
Core was generated by `/nz/dana/1122A/turbo/sbin/bootsvr'.
Program terminated with signal 6, Aborted.
Error while mapping shared library sections:
/nz/dana/1122A/turbo/sbin/gcc/lib/libstdc++-libc6.2-2.so.3: No such file or 
directory.
Error while reading shared library symbols:
/nz/dana/1122A/turbo/sbin/gcc/lib/libstdc++-libc6.2-2.so.3: No such file or 
directory.
Reading symbols from /lib/tls/libm.so.6...done.
Loaded symbols for /lib/tls/libm.so.6
Reading symbols from /lib/tls/libc.so.6...done.
Loaded symbols for /lib/tls/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /lib/libgcc_s.so.1...done.
Loaded symbols for /lib/libgcc_s.so.1
#0  0x009317a2 in ?? ()
(gdb) bt
#0  0x009317a2 in ?? ()
BFD: BFD 2.15.93 20041018 internal error, aborting at ../../gdb-6.3/bfd/cache.c 
line 495 in bfd_cache_lookup_worker

BFD: Please report this bug.

gdb is asking me to report this bug.  I'm appending this info here because
these seem to be related problems.

bootsvr and core are in attachment connected to Comment #5.

Any help would be appreciated.
Comment 7 Paul Hansen 2005-11-30 15:15:00 EST
Created attachment 121652 [details]
Analysis of core file in Comment 5

This is a little write up on the core file in comment 5.  It appears
that it is missing some content, including the stack.  This appears
to be above and beyond any gdb problems.
Comment 9 Jeff Johnston 2005-12-09 12:41:23 EST
Please try experimental 4E-scratch build gdb-6.3.0.0-1.91.1
Comment 17 Bob Johnson 2006-04-11 12:21:35 EDT
This issue is on Red Hat Engineering's list of planned work items 
for the upcoming Red Hat Enterprise Linux 4.4 release.  Engineering 
resources have been assigned and barring unforeseen circumstances, Red 
Hat intends to include this item in the 4.4 release.
Comment 22 Red Hat Bugzilla 2006-08-10 17:16:51 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2006-0429.html

Note You need to log in before you can comment on or make changes to this bug.