If the executable is stripped, gdb 'backtrace' cannot generate correct stack output. I produced one executable(a.out), set breakpoint, ran it, then backtraced it. Then stripped binary(a.out-strip), set breakpoint on that address, ran it, then backtraced it. Both backtrace result address should be same, but it was not. (a.out and a.out-strip was generated by gcc 4.3.4 in gentoo) If I copied a.out and a.out-strip to ubuntu system (gdb version 7.0), both backtrace output are same, as I expected, as followed: == Unstripped binary == $ gdb -q a.out Reading symbols from /home/cinsk/tmp/a.out...(no debugging symbols found)...done. (gdb) br m_alloc Breakpoint 1 at 0x80484b3 (gdb) r Starting program: /home/cinsk/tmp/a.out Breakpoint 1, 0x080484b3 in m_alloc () (gdb) bt #0 0x080484b3 in m_alloc () #1 0x080484e5 in get_greeting () #2 0x08048486 in main () == Stripped Binary == $ gdb -q a.out-strip Reading symbols from /home/cinsk/tmp/a.out-strip...(no debugging symbols found)...done. (gdb) br *0x80484b3 Breakpoint 1 at 0x80484b3 (gdb) r Starting program: /home/cinsk/tmp/a.out-strip Breakpoint 1, 0x080484b3 in ?? () (gdb) bt #0 0x080484b3 in ?? () #1 0x080484e5 in ?? () #2 0x08048486 in ?? () #3 0xf7e99b56 in __libc_start_main () from /lib32/libc.so.6 #4 0x080483d1 in ?? () (gdb) Note that the first three frame pointers of both output is same. However, on my gentoo system, gdb 7.0.1 p1: $ gdb -q a.out-strip Reading symbols from /home/cinsk/src/a.out-strip...(no debugging symbols found)...done. (gdb) br *0x80484b3 Breakpoint 1 at 0x80484b3 (gdb) r Starting program: /home/cinsk/src/a.out-strip Breakpoint 1, 0x080484b3 in ?? () (gdb) bt #0 0x080484b3 in ?? () #1 0x08048298 in ?? () #2 0x0000000b in ?? () #3 0xbfffeb98 in ?? () #4 0x080484e5 in ?? () #5 0x00000032 in ?? () #6 0xb7ea37e5 in ?? () from /lib/libc.so.6 #7 0x00000000 in ?? () (The backtrace output of a.out is same as ubuntu gdb 7.0) It seems that some of the stack trace is broken (esp. addresses in #2 and #5) Reproducible: Always Steps to Reproduce: 1. build a program using gcc 2. in GDB, set a breakpoint and ran, then backtrace it. 3. strip the binary from step 1 4. using binary from step.3, generate same backtrace as in step 2 5. compare the two backtrace output Actual Results: If the binary was stripped, GDB 7.0.1p in gentoo seems to show broken backtrace. Expected Results: The output of both backtrace should contains the same addresses. # emerge --info Portage 2.1.8.3 (default/linux/x86/10.0, gcc-4.3.4, glibc-2.11.2-r0, 2.6.28-gentoo-r5 i686) ================================================================= System uname: Linux-2.6.28-gentoo-r5-i686-Intel-R-_Core-TM-2_Quad_CPU_Q9400_@_2.66GHz-with-gentoo-1.12.13 Timestamp of tree: Mon, 05 Jul 2010 00:30:01 +0000 distcc 3.1 i686-pc-linux-gnu [disabled] ccache version 2.4 [enabled] app-shells/bash: 4.0_p37 dev-java/java-config: 2.1.11 dev-lang/python: 2.6.5-r2, 3.1.2-r3 dev-util/ccache: 2.4-r7 dev-util/cmake: 2.6.4-r3 sys-apps/baselayout: 1.12.13 sys-apps/sandbox: 1.6-r2 sys-devel/autoconf: 2.13, 2.65 sys-devel/automake: 1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r3, 1.10.3, 1.11.1 sys-devel/binutils: 2.20.1-r1 sys-devel/gcc: 4.1.2, 4.3.4, 4.4.3-r2 sys-devel/gcc-config: 1.4.1 sys-devel/libtool: 2.2.6b virtual/os-headers: 2.6.30-r1 ACCEPT_KEYWORDS="x86" ACCEPT_LICENSE="*" CBUILD="i686-pc-linux-gnu" CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer -ggdb" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /opt/openfire/resources/security/ /usr/share/X11/xkb /var/lib/hsqldb" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c" CXXFLAGS="-O2 -march=i686 -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="assume-digests ccache distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch" GENTOO_MIRRORS="http://gentoo.gg3.net/ http://ftp.kaist.ac.kr/pub/gentoo http://ftp.gentoo.or.kr http://distfiles.gentoo.org http://www.ibiblio.org/pub/Linux/distributions/gentoo" LANG="ko_KR.UTF-8" LDFLAGS="-Wl,-O1" LINGUAS="en ko" MAKEOPTS="-j8" 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/gentoo-kr /usr/portage/local" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="X acl acpi alsa bash-completion berkdb branding bzip2 cairo cjk cli consolekit cracklib crypt cups cxx dbus device-mapper dri emacs encode esd fam firefox flac fortran gdbm gif gnome gpm gstreamer gtk hal iconv jpeg kpathsea libnotify mad mikmod mmx mmx2 modules mp3 mpeg mudflap ncurses nls nptl nptlonly nvidia ogg opengl openmp pam pcre pdf perl png policykit ppds pppd python qt3support readline reflection samba sdl session spell spl sqlite sse sse2 ssl svg sysfs tcpd tiff truetype unicode vorbis x86 xml xorg zlib" ALSA_CARDS="intel8x0 intel8x0m hda-intel" 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 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" ELIBC="glibc" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en ko" 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, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
(In reply to comment #0) The USE flags for glibc, gcc, gdb are here: # emerge -pv glibc gcc gdb These are the packages that would be merged, in order: Calculating dependencies... done! [ebuild R ] sys-devel/gdb-7.0.1 USE="expat nls python -multitarget -test -vanilla" 0 kB [ebuild R ] sys-libs/glibc-2.11.2 USE="gd nls profile -debug -glibc-omitfp (-hardened) (-multilib) (-selinux) -vanilla" 0 kB [ebuild R ] sys-devel/gcc-4.4.3-r2 USE="doc fortran gtk mudflap nls nptl openmp (-altivec) -bootstrap -build (-fixed-point) -gcj -graphite (-hardened) (-libffi) (-multilib) -multislot (-n32) (-n64) -nocxx -objc -objc++ -objc-gc -test -vanilla" 0 kB Total: 3 packages (3 reinstalls), Size of downloads: 0 kB * IMPORTANT: 5 news items need reading for repository 'gentoo'. * Use eselect news to read news items.
ubuntu applies fixes backported from upstream. try gdb-7.1 already in the tree.
(In reply to comment #2) > ubuntu applies fixes backported from upstream. try gdb-7.1 already in the > tree. > Thanks, I installed gdb-7.1 and it does not have this bug.
we're not backporting anything. eventually 7.1 will go stable.