Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 431678

Summary: sys-devel/gdb-7.5 - broken back trace
Product: Gentoo Linux Reporter: wbrana
Component: [OLD] Core systemAssignee: Gentoo Toolchain Maintainers <toolchain>
Status: RESOLVED INVALID    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: http://sourceware.org/bugzilla/show_bug.cgi?id=14492
See Also: http://code.google.com/p/crack-language/issues/detail?id=103
http://sourceware.org/bugzilla/show_bug.cgi?id=14492
Whiteboard:
Package list:
Runtime testing required: ---

Description wbrana 2012-08-16 19:25:59 UTC
when I try to debug crack, output from gdb doesn't make sense
see http://code.google.com/p/crack-language/issues/detail?id=103

Portage 2.1.11.10 (hardened/linux/amd64, gcc-4.6.4, glibc-2.14.1-r3, 3.5.1-3 x86_64)
=================================================================
System uname: Linux-3.5.1-3-x86_64-Intel-R-_Core-TM-2_Quad_CPU_Q6600_@_2.40GHz-with-gentoo-2.1
Timestamp of tree: Wed, 15 Aug 2012 00:45:01 +0000
ccache version 3.1.8 [enabled]
app-shells/bash:          4.2_p37
dev-java/java-config:     2.1.12
dev-lang/python:          2.7.3-r2, 3.2.3-r1
dev-util/ccache:          3.1.8
dev-util/cmake:           2.8.8-r3
dev-util/pkgconfig:       0.27
sys-apps/baselayout:      2.1-r1
sys-apps/openrc:          0.9.8.4
sys-apps/sandbox:         2.6
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.6, 1.12.3
sys-devel/binutils:       2.22-r1, 2.22.90
sys-devel/gcc:            4.4.7, 4.5.4::x-portage, 4.6.4_pre9999::toolchain, 4.6.4::x-portage, 4.7.1, 4.7.2_pre9999::toolchain, 4.7.2::x-portage, 4.8.0_pre9999::toolchain
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r3
sys-kernel/linux-headers: 3.5 (virtual/os-headers)
sys-libs/glibc:           2.14.1-r3
Repositories: gentoo qt toolchain x-portage
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA PUEL dlj-1.1 ETQW RTCW-ETEULA googleearth AdobeFlash-10.3 Oracle-BCLA-JavaSE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -O3 -pipe -march=core2 -mtune=core2 -fomit-frame-pointer -funroll-loops --param max-unrolled-insns=64"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /var/bind /var/lib/hsqldb"
CONFIG_PROTECT_MASK="${EPREFIX}/etc/gconf /etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.4/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cli-php5.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -O3 -pipe -march=core2 -mtune=core2 -fomit-frame-pointer -funroll-loops --param max-unrolled-insns=64"
DISTDIR="/mnt/md3/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs buildpkg ccache compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles metadata-transfer news parallel-fetch parse-eapi-ebuild-head protect-owned sandbox sfperms split-elog split-log splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv webrsync-gpg"
FFLAGS="-O2 -O3 -pipe -march=core2 -mtune=core2 -fomit-frame-pointer -funroll-loops --param max-unrolled-insns=64"
LANG="en_GB.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu  -Wl,--as-needed"
LINGUAS="en_GB"
MAKEOPTS="-j2"
PKGDIR="/mnt/md3/cache/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/mnt/md3/cache"
PORTDIR="/mnt/md3/portage"
PORTDIR_OVERLAY="/var/lib/layman/qt /var/lib/layman/toolchain /usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 aac acpi aio alsa amd64 amr apng berkdb bzip2 cairo caps chm cli consolekit cracklib crypt curl cxx dbus device-mapper dlz dri dts dvb eix enca exif extensions extras faad ffmpeg flac gcj gdbm glib glibc-omitfp glitz gnutls gold graphite gtk gudev handbook hardened iconv jit jpeg jpeg2k justify lcms lm_sensors logrotate lzma matroska mikmod minizip mmx mng modplug modules mp3 mpeg mudflap multilib multislot ncurses nodrm nptl nsplugin ogg openal opengl openmp pam pax_kernel pch pcntl pcre pcre16 pdf pic png pppd qt qt3support qt4 rar readline rtsp sandbox schroedinger session slang spell sqlite sqlite3 sse sse2 sse3 ssl ssse3 symlink theora threads tiff truetype unicode urandom usb userpriv v4l2 vlc vorbis vpx x264 xcb xcomposite xml xv xvid zlib" ALSA_CARDS="virtuoso" 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 sheets 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="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en_GB" PHP_TARGETS="php5-3" PYTHON_TARGETS="python3_2 python2_7" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" 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, USE_PYTHON
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2012-08-17 15:34:50 UTC
(In reply to comment #0)
> when I try to debug crack, output from gdb doesn't make sense
> see http://code.google.com/p/crack-language/issues/detail?id=103

Please attach/post all relevant information here. Also, the bug description is rather nondescript - we'll need to find something more specific.
Comment 2 wbrana 2012-08-17 16:32:42 UTC
I tried to disassemble. There are things which don't make sense
example
according to gdb it crashes at instruction "test   %eax,%eax"
#10 0x0000038e3338d57f in operator< (other=..., this=<optimized out>) at debug/DebugTools.cc:41

   0x0000038e3338d572 <+98>:	49 8b 74 24 20	mov    0x20(%r12),%rsi
   0x0000038e3338d577 <+103>:	48 89 ef	mov    %rbp,%rdi
   0x0000038e3338d57a <+106>:	e8 f1 07 fe ff	callq  0x38e3336dd70 <strcmp@plt>
   0x0000038e3338d57f <+111>:	85 c0	test   %eax,%eax
   0x0000038e3338d581 <+113>:	78 2d	js     0x38e3338d5b0 <(anonymous namespace)::lookUpString((anonymous namespace)::InternedString const&)+160>
   0x0000038e3338d583 <+115>:	48 8b 54 24 08	mov    0x8(%rsp),%rdx
   0x0000038e3338d588 <+120>:	64 48 33 14 25 28 00 00 00	xor    %fs:0x28,%rdx
   0x0000038e3338d591 <+129>:	49 8d 44 24 20	lea    0x20(%r12),%rax

There are nonsensical addresses
#3  0x00000000000205e0 in ?? ()
#6  0x0000000000000020 in ?? ()

Program received signal SIGSEGV, Segmentation fault.
0x0000038e342cbff9 in ?? ()
(gdb) bt
#0  0x0000038e342cbff9 in ?? ()
#1  0x0000038e342e28da in ?? ()
#2  0x0000038e31d9ce60 in using_malloc_checking () from /lib64/libc.so.6
#3  0x00000000000205e0 in ?? ()
#4  0x0000004a6ffaac40 in ?? ()
#5  0x0000038e342d57d7 in ?? ()
#6  0x0000000000000020 in ?? ()
#7  0x0000038e31a92252 in __libc_calloc (n=<optimized out>, elem_size=<optimized out>) at malloc.c:4065
#8  0x0000038e342e0830 in ?? ()
#9  0x000003c61d4a1a00 in ?? ()
#10 0x0000038e3338d57f in operator< (other=..., this=<optimized out>) at debug/DebugTools.cc:41
#11 operator() (__y=..., __x=..., this=<optimized out>) at /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.4/include/g++-v4/bits/stl_function.h:236
#12 find (this=0x38e3414eaa0, __k=...) at /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.4/include/g++-v4/bits/stl_tree.h:1539
#13 find (__x=..., this=0x38e3414eaa0) at /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.4/include/g++-v4/bits/stl_set.h:605
#14 (anonymous namespace)::lookUpString (key=...) at debug/DebugTools.cc:60
#15 0x0000038e3343c750 in builder::mvll::LLVMJitBuilder::run (this=0x38e342df6a9) at builder/llvm/LLVMJitBuilder.cc:217
#16 0x0000038e3343d297 in builder::mvll::LLVMJitBuilder::doRunOrDump (this=0x4a6fb69460, context=...) at builder/llvm/LLVMJitBuilder.cc:375
#17 0x0000038e3343ebb3 in builder::mvll::LLVMJitBuilder::innerCloseModule (this=0x4a6fb69460, context=..., moduleDef=0x4a6fc2e4a0) at builder/llvm/LLVMJitBuilder.cc:360
#18 0x0000038e3343f40d in recursiveClose (builder=<optimized out>, context=..., this=<optimized out>) at builder/llvm/BJitModuleDef.h:73
#19 closeOrDefer (builder=0x4a6fb69460, context=..., this=0x4a6fc2e4a0) at builder/llvm/BJitModuleDef.h:82
#20 builder::mvll::LLVMJitBuilder::closeModule (this=0x4a6fb69460, context=..., moduleDef=<optimized out>) at builder/llvm/LLVMJitBuilder.cc:383
#21 0x0000038e333cb327 in model::ModuleDef::close (this=0x4a6fc2e4a0, context=...) at model/ModuleDef.cc:48
#22 0x0000038e3339c916 in model::Construct::parseModule (this=0x4a6f7b8230, context=..., module=0x4a6fc2e4a0, path=..., src=...) at model/Construct.cc:397
#23 0x0000038e3339f2bc in model::Construct::loadModule (this=0x4a6f7b8230, moduleNameBegin="crack", moduleNameEnd=..., canonicalName=...) at model/Construct.cc:605
#24 0x0000038e333d7324 in parser::Parser::parseImportStmt (this=0x3c61d4a3020, ns=0x4a6fc14458) at parser/Parser.cc:2679
#25 0x0000038e333e439d in parser::Parser::parseStatement (this=0x3c61d4a3020, defsAllowed=true) at parser/Parser.cc:356
#26 0x0000038e333e477b in parser::Parser::parseBlock (this=0x3c61d4a3020, nested=false, closeEvent=parser::Parser::noCallbacks) at parser/Parser.cc:485
#27 0x0000038e333e4a36 in parser::Parser::parse (this=<optimized out>) at parser/Parser.cc:3396
#28 0x0000038e3339c90b in model::Construct::parseModule (this=0x4a6f7b8230, context=..., module=0x4a6fc14420, path=..., src=...) at model/Construct.cc:396
#29 0x0000038e3339d59b in model::Construct::runScript (this=0x4a6f7b8230, src=..., name="example/hello.crk") at model/Construct.cc:782
#30 0x0000038e3348a736 in Crack::runScript (this=0x3c61d4a3630, src=..., name="example/hello.crk") at Crack.cc:108
#31 0x0000004a6dd7b15a in main (argc=4, argv=0x3c61d4a3a78) at crack_main.cc:277

crash seems to be caused by null pointer dereference in strcmp

(gdb) frame 10
#10 0x000003b9ef45257f in operator< (other=..., this=<optimized out>) at debug/DebugTools.cc:41
41	            return strcmp(val, other.val) < 0;
(gdb) info locals
No locals.
(gdb) p val
value has been optimized out
(gdb) p other
$1 = (const (anonymous namespace)::InternedString &) @0x3b9ee636f00: {val = 0x0}
(gdb) quit


int
strcmp (p1, p2)
     const char *p1;
     const char *p2;
{
  register const unsigned char *s1 = (const unsigned char *) p1;
  register const unsigned char *s2 = (const unsigned char *) p2;
  unsigned reg_char c1, c2;

  do
    {
      c1 = (unsigned char) *s1++;
      c2 = (unsigned char) *s2++;
      if (c1 == '\0')
        return c1 - c2;
    }
  while (c1 == c2);

  return c1 - c2;
}
Comment 3 wbrana 2012-08-17 16:35:43 UTC
glibc was compiled with -ggdb, but there are no symbols in back trace
Comment 4 wbrana 2012-08-17 16:39:55 UTC
crash doesn't happen if crack is compiled with -fno-PIE -fPIC
Comment 5 wbrana 2012-08-18 08:29:17 UTC
compile crack trunk:
hg clone https://crack-language.googlecode.com/hg/ crack-language
cd crack-language
./bootstrap
./configure
make
paxctl -m .libs/crack

debugging:
$ ./crack_dbg -- -l lib example/hello.crk
GNU gdb (Gentoo 7.5 p1) 7.5
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>...
Reading symbols from /mnt/md3/cache/inst/crack-language/.libs/crack...done.
(gdb) r
Starting program: /mnt/md3/cache/inst/crack-language/.libs/crack -l lib example/hello.crk
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.

$ gcc -v
Reading specs from /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.4/specs
COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.6.4/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.6.4/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /mnt/md3/cache/portage/sys-devel/gcc-4.6.4/work/gcc-4.6-20120803/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.6.4 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.4/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.4 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.4/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.4/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.4/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --without-ppl --without-cloog --enable-lto --disable-nls --with-system-zlib --enable-obsolete --disable-werror --enable-secureplt --enable-multilib --disable-libmudflap --disable-libssp --enable-esp --disable-libgomp --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.6.4/python --enable-checking=release --disable-libgcj --disable-libquadmath --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-targets=all --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo Hardened 4.6.4 p1.5, pie-0.5.2'
Thread model: posix
gcc version 4.6.4 20120803 (prerelease) (Gentoo Hardened 4.6.4 p1.5, pie-0.5.2)
Comment 6 wbrana 2012-08-18 08:37:26 UTC
upstream bug http://sourceware.org/bugzilla/show_bug.cgi?id=14492
Comment 7 Jeroen Roovers (RETIRED) gentoo-dev 2012-08-18 15:24:43 UTC

*** This bug has been marked as a duplicate of bug 428238 ***