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

我的程序怎么进不了main函数?
不知咋回事,我写的这个程序启动不了,进不了main函数,调试输出如下。
[fnzh@wmlin linux]$ gdb ./SockTest
GNU gdb Red Hat Linux (6.3.0.0-1.21rh)
Copyright 2004 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) start
Breakpoint 1 at 0x804b1be: file MainExe.cpp, line 212.
Starting program: /home/fnzh/rkt/out/linux/SockTest 
Reading symbols from shared object read from target memory...done.
Loaded system supplied DSO at 0x138000
[Thread debugging using libthread_db enabled]
[New Thread -1209092416 (LWP 4611)]

(不动了,按ctrl-c)
Program received signal SIGINT, Interrupt.
[Switching to Thread -1209092416 (LWP 4611)]
0x00138402 in __kernel_vsyscall ()
(gdb)

我写的另外一个程序能够正常运行,不知为什么这个却不行了。
以前多在windows下开发,linux开发没什么经验,还望大家多多指教!

------解决方案--------------------
什么地方阻塞了,贴代码看看。
------解决方案--------------------
进入main函数了。如果ld-linux.so.2加载进程映像有错误,gdb也可以调试进入main之前的代码。
进入main之前都是ld-linux.so.2和libc的工作,这个没必要调试。
lz另外一个程序的运行结果是什么样的?
------解决方案--------------------
用strace命令跟踪..如果不熟悉该命令去网上查查strace资料,该工具也很使用