gdb process core.6019 //调试core文件
(gdb) bt //进入栈
(gdb) i threads //查看当时的线程
9 process 7036 0xffffe410 in __kernel_vsyscall ()
8 process 7042 0xffffe410 in __kernel_vsyscall ()
7 process 7050 0xffffe410 in __kernel_vsyscall ()
6 process 7052 0xffffe410 in __kernel_vsyscall ()
5 process 7053 0xffffe410 in __kernel_vsyscall ()
4 process 7062 0xffffe410 in __kernel_vsyscall ()
3 process 7066 0xffffe410 in __kernel_vsyscall ()
2 process 7068 0x00736747 in ?? () from /lib/libgcc_s.so.1
* 1 process 7014 0xffffe410 in __kernel_vsyscall ()
(gdb) t 6 //进入6号线程
(gdb) bt //进入线程栈
#0 0xffffe410 in __kernel_vsyscall ()
#1 0x00612aa8 in recv () from /lib/libpthread.so.0
#2 0x0806a8c3 in CDomainAlive::getHttpResHeader (this=0xe385cea0, domain=@0xb5cc007c, port=@0xb5cc0074, ipInt=299025528, path=@0xb5cc0078,
method=0, httpResHeader=@0xb5cbfe04, fp=0xc0901238) at DomainAliveLib/DomainAlive.cpp:942
#3 0x0806cf90 in CDomainAlive::queryDomainAliveOnIP (this=0xe385cea0, domain=@0xb5cc007c, port=@0xb5cc0074, ipInt=299025528,
path=@0xb5cc0078, doRedirect=true, pJumpUlrList=0xb5cc0390, fp=0xc0901238) at DomainAliveLib/DomainAlive.cpp:372
#4 0x0806e1ac in CDomainAlive::queryDomainAliveOnIP (this=0xe385cea0, domain=@0xe385cea4, port=@0xe385cea8, ipInt=500417656,
path=@0xb5cc0398, doRedirect=false, pJumpUlrList=0xb5cc0390, fp=0xc0901238) at DomainAliveLib/DomainAlive.cpp:700
#5 0x0806ef15 in CDomainAlive::QueryDomainAliveOnIPThread (parameter=0xe385cdac) at DomainAliveLib/DomainAlive.cpp:343
#6 0x0060b5ab in start_thread () from /lib/libpthread.so.0
#7 0x00589cfe in clone () from /lib/libc.so.6
(gdb) t 1
//进入1号线程,1号线程为主线程
[Switching to thread 1 (process 7014)]#0 0xffffe410 in __kernel_vsyscall ()
(gdb) where
#0 0xffffe410 in __kernel_vsyscall ()
#1 0x0057a95b in write () from /lib/libc.so.6
#2 0x0051ad14 in _IO_new_file_write () from /lib/libc.so.6
#3 0x0051a9d5 in new_do_write () from /lib/libc.so.6
#4 0x0051acbf in _IO_new_do_write () from /lib/libc.so.6
#5 0x0051b5ae in _IO_new_file_overflow () from /lib/libc.so.6
#6 0x0051abac in _IO_new_file_xsputn () from /lib/libc.so.6
#7 0x004f7736 in vfprintf () from /lib/libc.so.6
#8 0x004fde42 in fprintf () from /lib/libc.so.6
#9 0x0806e9e2 in CDomainAlive::queryDomainAliveOnIP (this=0xeba69ea0, domain=@0xceaf3dfc, port=@0xceaf3df4, ipInt=1509870810,
path=@0xceaf3df8, doRedirect=true, pJumpUlrList=0xceaf4390, fp=0xc8d00640) at DomainAliveLib/DomainAlive.cpp:521
#10 0x0806de72 in CDomainAlive::queryDomainAliveOnIP (this=0xeba69ea0, domain=@0xceaf407c, port=@0xceaf4074, ipInt=1509870810,
path=@0xceaf4078, doRedirect=true, pJumpUlrList=0xceaf4390, fp=0xc8d00640) at DomainAliveLib/DomainAlive.cpp:722
#11 0x0806de72 in CDomainAlive::queryDomainAliveOnIP (this=0xeba69ea0, domain=@0xeba69ea4, port=@0xeba69ea8, ipInt=1509870810,
path=@0xceaf4398, doRedirect=false, pJumpUlrList=0xceaf4390, fp=0xc8d00640) at DomainAliveLib/DomainAlive.cpp:722
#12 0x0806ef15 in CDomainAlive::QueryDomainAliveOnIPThread (parameter=0xeba69dc0) at DomainAliveLib/DomainAlive.cpp:343
#13 0x0060b5ab in start_thread () from /lib/libpthread.so.0
#14 0x00589cfe in clone () from /lib/libc.so.6
(gdb) f 9
//进入1号线程栈的第9层
#9 0x0806e9e2 in CDomainAlive::queryDomainAliveOnIP (this=0xeba69ea0, domain=@0xceaf3dfc, port=@0xceaf3df4, ipInt=1509870810,
path=@0xceaf3df8, doRedirect=true, pJumpUlrList=0xceaf4390, fp=0xc8d00640) at DomainAliveLib/DomainAlive.cpp:521
521
DomainAliveLib/DomainAlive.cpp: No such file or directory.
in DomainAliveLib/DomainAlive.cpp
(gdb) info locals //查看当前变量 同(gdb) i locals 只是缩写info
pos2 =
pos3 = 3369076672
strPort = {static npos = 4294967295,
_M_dataplus = {> = {<__gnu_cxx::new_allocator> = {}, },
_M_p = 0xc8d0155c "bbs.wichina.cn:80/forum.phpmember.php?mod=logging&action=login&referer=%2Fforum.php"}}
pos5 =
url = {static npos = 4294967295,
_M_dataplus = {> = {<__gnu_cxx::new_allocator> = {}, },
_M_p = 0xc8d014dc "forum.php"}}
host = {static npos = 4294967295,
_M_dataplus = {> = {<__gnu_cxx::new_allocator> = {}, },
_M_p = 0x8c82264 "bbs.wichina.cn"}}
strPath = {static npos = 4294967295,
_M_dataplus = {> = {<__gnu_cxx::new_allocator> = {}, },
_M_p = 0xc8d007cc "/forum.phpmember.php?mod=logging&action=login&referer=%2Fforum.phpforum.php"}}
pos1 = 148
httpResHeader = {static npos = 4294967295,
_M_dataplus = {> = {<__gnu_cxx::new_allocator> = {}, },
_M_p = 0xc8d01634 "HTTP/1.1 301 Moved Permanently\r\nDate: Tue, 20 Mar 2012 06:14:45 GMT\r\nServer: Apache/2.2.6 (Unix) PHP/5.2.16 Resin/3.0.25\r\nX-Powered-By: PHP/5.2.16\r\nlocation: forum.php\r\nContent-Length: 0\r\nConnection: "...}}
ret =
retcode = 301
(gdb) ptype strPath //查看strPath的类型和使用
type = class std::basic_string,std::allocator > {
public:
static const size_t npos;
private:
std::basic_string,std::allocator >::_Alloc_hider _M_dataplus;
char * _M_data() const;
char * _M_data(char*);
class std::basic_string,std::allocator >::_Rep * _M_rep() const;
class __gnu_cxx::__normal_iterator, std::allocator > > _M_ibegin() const;
class __gnu_cxx::__normal_iterator, std::allocator > > _M_iend() const;
void _M_leak();
size_t _M_check(unsigned int, char const*) const;
void _M_check_length(unsigned int, unsigned int, char const*) const;
size_t _M_limit(unsigned int, unsigned int) const;
bool _M_disjunct(char const*) const;
static void _M_copy(char*, char const*, unsigned int);
static void _M_move(char*, char const*, unsigned int);
static void _M_assign(char*, unsigned int, char);
(gdb) ptype url
//查看url的类型和使用
type = class std::basic_string,std::allocator > {
public:
static const size_t npos;
private:
std::basic_string,std::allocator >::_Alloc_hider _M_dataplus;
char * _M_data() const;
char * _M_data(char*);
(gdb) ptype retcode
//查看retcode的类型和使用
type = int
(gdb)set print pretty //人性化显示输出