The title says all, gdb crashes on my uclibc development system. I ran strace on it and got something interesting: $ tail gdb.strace.log getrusage(RUSAGE_SELF, {ru_utime={0, 4000}, ru_stime={0, 1000}, ...}) = 0 getcwd("/home/rener", 1024) = 12 getcwd("/home/rener", 1024) = 12 brk(0xc263000) = 0xc263000 ioctl(2147483647, SNDCTL_TMR_TIMEBASE or TCGETS, 0x59ec28e4) = -1 EBADF (Bad file descriptor) brk(0xc264000) = 0xc264000 ioctl(2147483647, SNDCTL_TMR_TIMEBASE or TCGETS, 0x59ec28e4) = -1 EBADF (Bad file descriptor) brk(0xc265000) = 0xc265000 --- SIGSEGV (Segmentation fault) @ 0 (0) --- +++ killed by SIGSEGV +++ The ioctl system calls are interesting. It looks like a call to a termios family libc function that tries to use a bogus file handle: 0x7FFFFFFF. Reproducible: Always Steps to Reproduce: 1. emerge gdb 2. gdb Actual Results: "Segmentation fault" appreared on the console. Expected Results: Start and wait user input to load a program to debug Gentoo Base System version 1.6.13 Portage 2.0.51.22-r2 (uclibc/x86/hardened/2.4, gcc-3.3.6, uclibc-0.9.27-r0, 2.4.31-repzilon-r2 i686) ================================================================= System uname: 2.4.31-repzilon-r2 i686 AMD Athlon(tm) XP 2500+ dev-lang/python: 2.3.4-r1 sys-apps/sandbox: 1.2.12 sys-devel/autoconf: 2.13, 2.59-r6 sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1 sys-devel/binutils: 2.15.92.0.2-r10 sys-devel/libtool: 1.5.18-r1 virtual/os-headers: 2.4.22-r1 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CBUILD="i386-gentoo-linux-uclibc" CFLAGS="-pipe -O2 -march=pentium3 -mcpu=athlon-xp -fomit-frame-pointer" CHOST="i386-gentoo-linux-uclibc" CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-pipe -O2 -march=pentium3 -mcpu=athlon-xp -fomit-frame-pointer" DISTDIR="/usr/portage/distfiles" FEATURES="autoconfig buildpkg digest distlocks maketest nodoc noinfo sandbox sfperms strict test userpriv usersandbox" GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/Linux/distributions/gentoo" MAKEOPTS="-j2 -s" PKGDIR="/usr/local/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage" USE="x86 16bit 3dfx 3dnow 3dnowext a52 aac apm asm async bidi blender-game bootsplash bzip2 cap cdparanoia cdr chroot cjk cracklib crypt dga dhcp dlloader droproot dv dvd dvdr dvdread encode exif expat faad flac ftp gatos gd-external gif glep gpm hal hardened hardenedphp imagemagick immqt-bc innodb jack jit jpeg kdeenablefinal kdexdeltas lcms libclamav lm_sensors logitech-mouse lzw mad md5sum mdb minimal mmx mmx2 mozdevelop mozp3p mozsvg mp3 mpeg4 msn multicall ncurses noplugin ogg oggvorbis on-the-fly-crypt openal oscar oss pcre pdflib pic png posix readline sharedmem spell sql sqlite sse ssl subversion svg svgz sysvipc tcpmd5 theora threads truetype truetype-fonts uclibc usb userlocales utf8 v4l vim-pager voodoo3 vorbis xmms xpm xrandr xscreensaver xv xvmc zlib userland_GNU kernel_linux elibc_uclibc" Unset: ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS
works fine on my uclibc we need something to reproduce this
> we need something to reproduce this More exactly what?
some example source code would be helpful :P
I got new information this weekend. First, the ioctl system calls with a bogus file handle are not the source of the problem. Second, I pinpointed the source of the crash to be rl_reset_terminal (NULL);, used by init_page_info in gdb/utils.c, circa line 1670. I do not know whether GDB uses the system readline or its own copy. As I cannot get a usable backtrace using my working GDB on my half-Mandr* 9.0 system from my 37MB broken gdb and a corresponding core dump, I had to resort to the good-old printf technique. By the way, ioctl with bogus handle is called from initialize_targets() (directly or indirectly). gdb_init() calls initialize_targets().
Created attachment 71736 [details, diff] Patch used to find the source of the bug I used the printf technique (in fact, I do fprintf(stderr, "message\n")), going deeper at each step. The attached patch is the 4th version. When I run gdb with this patch applied, I get this: captured_main: start captured_main: after variables captured_main: after i18n captured_main: after variables 2 captured_main: after error_init() captured_main: after setting sysroot path captured_main: after argument parsing gdb_init: start gdb_init: after pre_init_ui_hook() gdb_init: after getting current directory gdb_init: after init_cmd_lists() gdb_init: after initialize_targets() initialize_utils: start initialize_utils: after setting width initialize_utils: after setting height init_page_info: start init_page_info: inside block init_page_info: before readline code Segmentation fault (core dumped) To try it, simply add an epatch to the gdb ebuild and emerge gdb.
(In reply to comment #3) > some example source code would be helpful :P > Closing as NEEDINFO. We need a testcase.