日期:2014-05-16  浏览次数:20720 次

不显示删除回复显示所有回复显示星级回复显示得分回复 gdb调试无法定位段错误 求救



写了一段程序,总是出现段错误,于是gdb调试,结果无法找到段错误的位置。

gdb调试结果如下

[root@localhost udp_server4.9.3]# gcc -g -rdynamic -o server udp_server4.9.3.c
[root@localhost udp_server4.9.3]# gdb ./server  
GNU gdb Red Hat Linux (6.5-15.fc6rh)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) r
Starting program: /home/zyy/udp_socket/udp_server4.9.3/server  


Program received signal SIGSEGV, Segmentation fault.
0x39313030 in ?? ()
(gdb) bt
#0 0x39313030 in ?? ()
#1 0x3839392e in ?? ()
#2 0x302c562c in ?? ()
#3 0x2e303030 in ?? ()
#4 0x30303030 in ?? ()
#5 0x302c4e2c in ?? ()
#6 0x30303030 in ?? ()
#7 0x3030302e in ?? ()
#8 0x2c452c30 in ?? ()
#9 0x30332c2c in ?? ()
#10 0x32323130 in ?? ()
#11 0x312a2c2c in ?? ()
#12 0x240a0d36 in ?? ()
#13 0x54565047 in ?? ()
#14 0x542c2c47 in ?? ()
#15 0x2c4d2c2c in ?? ()
#16 0x2c2c4e2c in ?? ()
#17 0x45342a4b in ?? ()
#18 0x47240a0d in ?? ()
#19 0x41474750 in ?? ()
#20 0x3030302c in ?? ()
#21 0x2e303230 in ?? ()
#22 0x2c383939 in ?? ()
---Type <return> to continue, or q <return> to quit---

关键位置全是问号,情何以堪?这可怎么看啊



代码有点长,先不帖了。

各位大侠指点

------解决方案--------------------
先b到某一处,再next试试。
------解决方案--------------------
貌似现场已经被破坏了,要么单步,要么查下内存操作的代码。