- 论坛徽章:
- 0
|
[root@localhost update_server]#gdb update
GNU gdb (GDB) Red Hat Enterprise Linux (7.0.1-32.el5_6.2)
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 "i386-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /root/update_server/update...done.
(gdb) l
1 #include "HandlerMessage.h"
2 #include "update_server.h"
3 #include "spserver.hpp"
4
5 static const int LISTEN_PORT = 9999;
6 static const char* SERVER_IP = "192.168.0.199";
7
8 int main( int argc, char** argv )
9 {
10 SP_Server server( SERVER_IP, 9999, new Update_HandlerFactory() );
(gdb) l
11 server.setTimeout( 3600 );
12 server.runForever();
13 }
14
(gdb) b 5
Breakpoint 1 at 0x6767: file /root/update_server/Server.cpp, line 5.
(gdb) info b
Num Type Disp Enb Address What
1 breakpoint keep y 0x00006767 in main(int, char**) at /root/update_server/Server.cpp:5
(gdb) r
Starting program: /root/update_server/update
Program received signal SIGSEGV, Segmentation fault.
0x00000001 in ?? ()
(gdb) bt
#0 0x00000001 in ?? ()
(gdb) quit
A debugging session is active.
Inferior 1 [process 3029] will be killed.
Quit anyway? (y or n) y
为何连主函数都没有进去?
下面的是代码:
#include <iostream>
#include "HandlerMessage.h"
#include "update_server.h"
#include "spserver.hpp"
static const int LISTEN_PORT = 9999;
static const char* SERVER_IP = "192.168.0.199";
int main( int argc, char** argv )
{
SP_Server server( SERVER_IP,LISTEN_PORT, new Update_HandlerFactory() );
server.setTimeout( 3600 );
server.runForever();
} |
|