| View previous topic :: View next topic |
| Author |
Message |
[n00b@localhost] Apprentice


Joined: 30 Aug 2004 Posts: 266 Location: London, UK
|
Posted: Tue Sep 27, 2011 3:02 pm Post subject: Can't debug glibc with FEATURES="installsources splitde |
|
|
I am developing a small program which has a segfault in fwrite (according to gdb). This gave me the idea that I might want to install the sources for glibc so that I can trace the cause of the fwrite error (I highly doubt there is an error in the glibc implementation of fwrite but I thought it would be good to view the complete source of my program in gdb as well as the libraries it uses).
To this end I re-emerged glibc with:
| Code: | | FEATURES="installsources splitdebug" CFLAGS="-march=native -O2 -pipe -ggdb" emerge -av1 --nodeps glibc |
After this I debugged my program again but gdb started printing errors while the program was running and the debug information for glibc was unavailable:
| Code: | warning: the debug information found in "/usr/lib64/debug//lib64/ld-2.13.so.debug" does not match "/lib64/ld-linux-x86-64.so.2" (CRC mismatch).
warning: the debug information found in "/usr/lib64/debug/lib64/ld-2.13.so.debug" does not match "/lib64/ld-linux-x86-64.so.2" (CRC mismatch).
warning: the debug information found in "/usr/lib64/debug//lib64/libpthread-2.13.so.debug" does not match "/lib64/libpthread.so.0" (CRC mismatch).
warning: the debug information found in "/usr/lib64/debug/lib64/libpthread-2.13.so.debug" does not match "/lib64/libpthread.so.0" (CRC mismatch).
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. |
Also, when using valgrind to check for memory errors, I am now getting this error again:
| Code: | valgrind: Fatal error at startup: a function redirection
valgrind: which is mandatory for this platform-tool combination
valgrind: cannot be set up. Details of the redirection are:
valgrind:
valgrind: A must-be-redirected function
valgrind: whose name matches the pattern: strlen
valgrind: in an object with soname matching: ld-linux-x86-64.so.2
valgrind: was not found whilst processing
valgrind: symbols from the object with soname: ld-linux-x86-64.so.2
valgrind:
valgrind: Possible fixes: (1, short term): install glibc's debuginfo
valgrind: package on this machine. (2, longer term): ask the packagers
valgrind: for your Linux distribution to please in future ship a non-
valgrind: stripped ld.so (or whatever the dynamic linker .so is called)
valgrind: that exports the above-named function using the standard
valgrind: calling conventions for this platform. The package you need
valgrind: to install for fix (1) is called
valgrind:
valgrind: On Debian, Ubuntu: libc6-dbg
valgrind: On SuSE, openSuSE, Fedora, RHEL: glibc-debuginfo
valgrind:
valgrind: Cannot continue -- exiting now. Sorry. |
This problem is usually solved by adding FEATURES="splitdebug" when emerging glibc.
Is there anything I'm missing when trying to set up debugging for programs using glibc?
| Code: | emerge --info
Portage 2.1.10.18 (default/linux/amd64/10.0/desktop/kde, gcc-4.5.3, glibc-2.13-r4, 3.0.4-gentoo x86_64)
=================================================================
System uname: Linux-3.0.4-gentoo-x86_64-Intel-R-_Core-TM-_i7_CPU_965_@_3.20GHz-with-gentoo-2.0.3
Timestamp of tree: Sat, 24 Sep 2011 02:45:01 +0000
ccache version 2.4 [enabled]
app-shells/bash: 4.1_p9
dev-java/java-config: 2.1.11-r3
dev-lang/python: 2.7.2-r3, 3.2.2
dev-util/ccache: 2.4-r9
dev-util/cmake: 2.8.4-r1
dev-util/pkgconfig: 0.26
sys-apps/baselayout: 2.0.3
sys-apps/openrc: 0.8.3-r1
sys-apps/sandbox: 2.4
sys-devel/autoconf: 2.68
sys-devel/automake: 1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils: 2.21.1-r1
sys-devel/gcc: 4.5.3-r1
sys-devel/gcc-config: 1.4.1-r1
sys-devel/libtool: 2.4-r1
sys-devel/make: 3.82-r1
sys-kernel/linux-headers: 2.6.39 (virtual/os-headers)
sys-libs/glibc: 2.13-r4
Repositories: gentoo java-overlay kde science local-overlay
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA dlj-1.1 sun-bcla-java-vm AdobeFlash-10.1"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /var/spool/torque"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs candy ccache clean-logs compress-build-logs distlocks ebuild-locks fail-clean fixlafiles fixpackages metadata-transfer multilib-strict news parallel-fetch parallel-install protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS=""
GENTOO_MIRRORS="http://mirror.qubenet.net/mirror/gentoo/ ftp://mirror.qubenet.net/mirror/gentoo/ http://www.mirrorservice.org/sites/www.ibiblio.org/gentoo/ ftp://ftp.mirrorservice.org/sites/www.ibiblio.org/gentoo/"
LANG="en_GB.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en_GB en"
MAKEOPTS="-j9"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/java-overlay /var/lib/layman/kde /var/lib/layman/science /usr/local/portage"
SYNC="rsync://rsync.uk.gentoo.org/gentoo-portage"
USE="3dnow X a52 aac accessibility acl acpi alsa amd64 ao avahi bash-completion berkdb bluetooth branding bzip2 cairo caps cdda cddb cdr cli consolekit cracklib crypt css cups curl custom-cflags cvs cxx dbus declarative dga directfb dri dts dvb dvd dvdr emboss encode exif expat fam fbcon ffmpeg firefox flac fontconfig fortran freetds gdbm gdu ggi gif gmp gnutls gphoto2 gpm gsm gstreamer iconv icu idn ieee1394 imagemagick ipv6 jack java jingle jpeg kde kerberos kipi ladspa lame lapack lash latex lcms ldap libcaca libnotify libsamplerate lm_sensors lua lzo mad mmap mmx mng modules mp3 mp4 mpeg mpi mplayer msn mtp mudflap multilib musicbrainz mysql nas ncurses netboot nis nls nptl nptlonly odbc ogg openal opengl openmp oscar pam pango pcre pdf perl phonon plasma plotutils png policykit ppds pppd python qt3support qt4 readline samba sasl scanner sdl semantic-desktop session slp sndfile sox spell sqlite sqlite3 sse sse2 ssl startup-notification subversion svg symlink sysfs taglib tcpd theora threads tidy tiff truetype udev unicode usb v4l2 vcd vnc vorbis x264 xattr xcb xcomposite xine xinerama xinetd xml xorg xpm xscreensaver xv xvid zeroconf zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en_GB en" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS |
| Code: | equery l debugedit
* Searching for debugedit ...
[IP-] [ ] dev-util/debugedit-4.4.6-r1:0 |
|
|
| Back to top |
|
 |
Hu Administrator

Joined: 06 Mar 2007 Posts: 22146
|
Posted: Wed Sep 28, 2011 1:59 am Post subject: |
|
|
| What is the output of ls -ld /lib /lib64 /usr/lib /usr/lib64 /lib64/ld-linux-x86-64.so.2 /lib64/libpthread.so.0 /usr/lib64/debug/lib64/ld-2.13.so.debug /usr/lib64/debug/lib64/libpthread-2.13.so.debug? |
|
| Back to top |
|
 |
[n00b@localhost] Apprentice


Joined: 30 Aug 2004 Posts: 266 Location: London, UK
|
Posted: Wed Sep 28, 2011 10:31 am Post subject: |
|
|
| Code: | $ ls -ld /lib /lib64 /usr/lib /usr/lib64 /lib64/ld-linux-x86-64.so.2 /lib64/libpthread.so.0 /usr/lib64/debug/lib64/ld-2.13.so.debug /usr/lib64/debug/lib64/libpthread-2.13.so.debug
lrwxrwxrwx 1 root root 5 Sep 27 22:34 /lib -> lib64
drwxr-xr-x 15 root root 4096 Sep 27 22:34 /lib64
lrwxrwxrwx 1 root root 10 Sep 27 22:34 /lib64/ld-linux-x86-64.so.2 -> ld-2.13.so
lrwxrwxrwx 1 root root 18 Sep 27 22:34 /lib64/libpthread.so.0 -> libpthread-2.13.so
lrwxrwxrwx 1 root root 5 Sep 16 2009 /usr/lib -> lib64
drwxr-xr-x 144 root root 143360 Sep 27 22:34 /usr/lib64
-rw-r--r-- 1 root root 133944 Sep 27 22:34 /usr/lib64/debug/lib64/ld-2.13.so.debug
-rw-r--r-- 1 root root 101280 Sep 27 22:34 /usr/lib64/debug/lib64/libpthread-2.13.so.debug |
The debugging information is there. It just seems that gdb doesn't want to use it because the CRCs are different. |
|
| Back to top |
|
 |
Hu Administrator

Joined: 06 Mar 2007 Posts: 22146
|
Posted: Thu Sep 29, 2011 1:45 am Post subject: |
|
|
| I did not doubt its presence, but I wanted to see if the debug information had a significantly different timestamp. That could indicate using stale files, which would then have a stale CRC. |
|
| Back to top |
|
 |
[n00b@localhost] Apprentice


Joined: 30 Aug 2004 Posts: 266 Location: London, UK
|
Posted: Fri Sep 30, 2011 10:46 am Post subject: |
|
|
| Does anyone else have any suggestions as to why the incorrect debug info is being installed for glibc or should I file it as a bug? |
|
| Back to top |
|
 |
zmedico Developer


Joined: 02 Jan 2004 Posts: 353 Location: California USA
|
Posted: Thu Jun 13, 2013 2:52 am Post subject: |
|
|
I've had this problem too, and haven't figured out what causes it yet. As a workaround, I have used this script to correct the CRC data:
| Code: | #!/bin/bash
for x in /usr/lib/debug/lib/*.debug ; do
y=${x#/usr/lib/debug}
y=${y%.debug}
objcopy -R .gnu_debuglink --add-gnu-debuglink="${x}" "${y}"
done |
_________________ Zac |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|