红联Linux门户
Linux帮助

gdb求助

发布时间:2010-03-08 18:12:30来源:红联作者:tusy0123456
[i=s] 本帖最后由 tusy0123456 于 2010-3-8 23:42 编辑 [/i]

小弟使用gdb查找段错误遇到点问题,希望各位达人帮忙解决一下!
内容如下:
gcc版本为:
[alex@W transmission_3Y]$ gcc -v
使用内建 specs。
目标:i586-redhat-linux
配置为:../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch=i586 --build=i586-redhat-linux
线程模型:posix
gcc 版本 4.4.0 20090506 (Red Hat 4.4.0-4) (GCC)

所写程序makefile中为:
gcc -g -o out $(objects) //$(objects)为out的依赖条件
然后:
[alex@W transmission_3Y]$ make
[alex@W transmission_3Y]$ ./out
段错误
[alex@W transmission_3Y]$ gdb ./out
GNU gdb (GDB) Fedora (6.8.50.20090302-21.fc11)
Copyright (C) 2009 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 "i586-redhat-linux-gnu".
For bug reporting instructions, please see:<http://www.gnu.org/software/gdb/bugs/>...
(gdb) r
Starting program: /home/alex/Spread/transmission_3Y/out
Program received signal SIGSEGV, Segmentation fault.
0x080486fb in main ()
Missing separate debuginfos, use: debuginfo-install glibc-2.10.1-2.i686

调试环境为Fedora-11-i386-DVD安装的虚拟机
哪位大虾能告诉我最后一句是这么回事?为什么会这样?怎样能解决?
文章评论

共有 4 条评论

  1. piaoyun1979 于 2010-03-15 22:06:21发表:

    可以在程序中增加信号量捕获,在使用
    backtrace()
    backtrace_symbols()
    跟踪程序调用栈

  2. tusy0123456 于 2010-03-09 18:59:18发表:

    3# alick


    帖子发错了,程序上写的是-o,不是-c

  3. alick 于 2010-03-08 21:25:41发表:

    gcc的-c选项生成的是目标代码文件,还没有链接,不是可执行文件吧

  4. compat 于 2010-03-08 20:34:29发表:

    帮不了