人类已经阻止不了gdb了

gdb保留历史:
show history
set history expansion
set history save
sethistory size 256
保存在 ~/.gdb_history

干掉的进程会重建
__epoll_wait_nocancel ()
怎么建立的?不要忽略!!

ctrl+f
(gdb)

[root@red54apple gdbtest]# gdb
GNU gdb Fedora (6.8-37.el5)
Copyright (C) 2008 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 "x86_64-redhat-linux-gnu".
(gdb) attach 4992
Attaching to process 4992
Reading symbols from /opt/backup/mynginx/workdir/nginx-1.0.5/objs/nginx...done.
Reading symbols from /lib64/libpthread.so.0...done.
[Thread debugging using libthread_db enabled]
[New Thread 0x2b8b4d052520 (LWP 4992)]
Loaded symbols for /lib64/libpthread.so.0
Reading symbols from /lib64/libcrypt.so.1...done.
Loaded symbols for /lib64/libcrypt.so.1
Reading symbols from /lib64/libm.so.6...done.
Loaded symbols for /lib64/libm.so.6
Reading symbols from /lib64/libcrypto.so.6...done.
Loaded symbols for /lib64/libcrypto.so.6
Reading symbols from /usr/lib64/libz.so.1...done.
Loaded symbols for /usr/lib64/libz.so.1
Reading symbols from /lib64/libc.so.6...done.
Loaded symbols for /lib64/libc.so.6
Reading symbols from /lib64/ld-linux-x86-64.so.2...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Reading symbols from /lib64/libdl.so.2...done.
Loaded symbols for /lib64/libdl.so.2
Reading symbols from /lib64/libnss_files.so.2...done.
Loaded symbols for /lib64/libnss_files.so.2
0x0000003b6e23079a in sigsuspend () from /lib64/libc.so.6
(gdb) info proc 
process 4992
cmdline = 'nginx: master process /usr/local/nginx/objs/nginx'
cwd = '/root/gdbtest'
exe = '/opt/backup/mynginx/workdir/nginx-1.0.5/objs/nginx'
(gdb) q
The program is running.  Quit anyway (and detach it)? (y or n) y
Detaching from program: /opt/backup/mynginx/workdir/nginx-1.0.5/objs/nginx, process 4992
[root@red54apple gdbtest]# pidof /usr/local/nginx/objs/nginx
5000 4999 4998 4997 4996 4995 4994 4993 4992
[root@red54apple gdbtest]# 
[root@red54apple gdbtest]# 
[root@red54apple gdbtest]# gdb 
GNU gdb Fedora (6.8-37.el5)
Copyright (C) 2008 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 "x86_64-redhat-linux-gnu".
(gdb) attach 4999
Attaching to process 4999
Reading symbols from /opt/backup/mynginx/workdir/nginx-1.0.5/objs/nginx...done.
Reading symbols from /lib64/libpthread.so.0...done.
[Thread debugging using libthread_db enabled]
[New Thread 0x2b8b4d052520 (LWP 4999)]
Loaded symbols for /lib64/libpthread.so.0
Reading symbols from /lib64/libcrypt.so.1...done.
Loaded symbols for /lib64/libcrypt.so.1
Reading symbols from /lib64/libm.so.6...done.
Loaded symbols for /lib64/libm.so.6
Reading symbols from /lib64/libcrypto.so.6...done.
Loaded symbols for /lib64/libcrypto.so.6
Reading symbols from /usr/lib64/libz.so.1...done.
Loaded symbols for /usr/lib64/libz.so.1
Reading symbols from /lib64/libc.so.6...done.
Loaded symbols for /lib64/libc.so.6
Reading symbols from /lib64/ld-linux-x86-64.so.2...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Reading symbols from /lib64/libdl.so.2...done.
Loaded symbols for /lib64/libdl.so.2
Reading symbols from /lib64/libnss_files.so.2...done.
Loaded symbols for /lib64/libnss_files.so.2
0x0000003b6e2d3fd3 in __epoll_wait_nocancel () from /lib64/libc.so.6
(gdb) info proc 
process 4999
cmdline = 'nginx: worker process'
cwd = '/root/gdbtest'
exe = '/opt/backup/mynginx/workdir/nginx-1.0.5/objs/nginx'
(gdb) info args 
No symbol table info available.
(gdb) b proc
Function "proc" not defined.
Make breakpoint pending on future shared library load? (y or [n]) n
(gdb) x proc
No symbol "proc" in current context.
(gdb) info *proc
Undefined info command: "*proc".  Try "help info".
(gdb) info program 
	Using the running image of attached Thread 0x2b8b4d052520 (LWP 4999).
Program stopped at 0x6e2d3fd3.
(gdb) x 0x2b8b4d052520
0x2b8b4d052520:	0x4d052520
(gdb) x/c 0x2b8b4d052520
0x2b8b4d052520:	32 ' '
(gdb) x/i 0x2b8b4d052520
0x2b8b4d052520:	and    %ah,0x2b8b4d05(%rip)        # 0x2b8b7890722b
(gdb) p port.6281 
No symbol "port" in current context.
(gdb) shell ps -ef|grep nginx
root      4992     1  0 Sep22 ?        00:00:00 nginx: master process /usr/local/nginx/objs/nginx
nobody    4993  4992  0 Sep22 ?        00:00:00 nginx: worker process      
nobody    4994  4992  0 Sep22 ?        00:00:00 nginx: worker process      
nobody    4995  4992  0 Sep22 ?        00:00:00 nginx: worker process      
nobody    4996  4992  0 Sep22 ?        00:00:00 nginx: worker process      
nobody    4997  4992  0 Sep22 ?        00:00:00 nginx: worker process      
nobody    4998  4992  0 Sep22 ?        00:00:00 nginx: worker process      
nobody    4999  4992  0 Sep22 ?        00:00:00 nginx: worker process      
nobody    5000  4992  0 Sep22 ?        00:00:00 nginx: worker process      
root      5121  5082  0 00:15 pts/1    00:00:00 bash -c ps -ef|grep nginx
root      5123  5121  0 00:15 pts/1    00:00:00 grep nginx
(gdb) attach 4992
A program is being debugged already.  Kill it? (y or n) y
Attaching to program: /opt/backup/mynginx/workdir/nginx-1.0.5/objs/nginx, process 4992
[Thread debugging using libthread_db enabled]
[New Thread 0x2b8b4d052520 (LWP 4992)]
Loaded symbols for /lib64/libpthread.so.0
Loaded symbols for /lib64/libcrypt.so.1
Loaded symbols for /lib64/libm.so.6
Loaded symbols for /lib64/libcrypto.so.6
Loaded symbols for /usr/lib64/libz.so.1
Loaded symbols for /lib64/libc.so.6
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Loaded symbols for /lib64/libdl.so.2
Loaded symbols for /lib64/libnss_files.so.2
ngx_vslprintf (buf=0x6d881c "", 
    last=0xffffffffffffffff <Address 0xffffffffffffffff out of bounds>, fmt=0x4ae2fb "%4d/%02d/%02d %02d:%02d:%02d", args=0x7fff1a77bb30)
    at src/core/ngx_string.c:157
157	    while (*fmt && buf < last) {
(gdb) shell ps -ef|grep nginx


[root@red54apple ~]# gdb
GNU gdb Fedora (6.8-37.el5)
Copyright (C) 2008 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 "x86_64-redhat-linux-gnu".
(gdb) shell pidof /usr/local/nginx/objs/nginx
5283 5279 5222 5000 4996 4995 4994 4993 4992
(gdb) x/i $pc
No registers.
(gdb) show reg
Undefined show command: "reg".  Try "help show".
(gdb) attach 5283
Attaching to process 5283
Reading symbols from /opt/backup/mynginx/workdir/nginx-1.0.5/objs/nginx...done.
Reading symbols from /lib64/libpthread.so.0...done.
[Thread debugging using libthread_db enabled]
[New Thread 0x2b8b4d052520 (LWP 5283)]
Loaded symbols for /lib64/libpthread.so.0
Reading symbols from /lib64/libcrypt.so.1...done.
Loaded symbols for /lib64/libcrypt.so.1
Reading symbols from /lib64/libm.so.6...done.
Loaded symbols for /lib64/libm.so.6
Reading symbols from /lib64/libcrypto.so.6...done.
Loaded symbols for /lib64/libcrypto.so.6
Reading symbols from /usr/lib64/libz.so.1...done.
Loaded symbols for /usr/lib64/libz.so.1
Reading symbols from /lib64/libc.so.6...done.
Loaded symbols for /lib64/libc.so.6
Reading symbols from /lib64/ld-linux-x86-64.so.2...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Reading symbols from /lib64/libdl.so.2...done.
Loaded symbols for /lib64/libdl.so.2
Reading symbols from /lib64/libnss_files.so.2...done.
Loaded symbols for /lib64/libnss_files.so.2
0x0000003b6e2d3fd3 in __epoll_wait_nocancel () from /lib64/libc.so.6
(gdb) show reg
Undefined show command: "reg".  Try "help show".
(gdb) info reg
rax            0xfffffffffffffffc	-4
rbx            0x3b6e01bbc0	255248677824
rcx            0xffffffffffffffff	-1
rdx            0x200	512
rsi            0x13cf1370	332338032
rdi            0x16	22
rbp            0x7fff1a77bfb0	0x7fff1a77bfb0
rsp            0x7fff1a77bf28	0x7fff1a77bf28
r8             0x17566ce	24471246
r9             0x4e7b688a	1316710538
r10            0x5	5
r11            0x246	582
r12            0x0	0
r13            0x7fff1a77c550	140733637444944
r14            0x0	0
r15            0x0	0
rip            0x3b6e2d3fd3	0x3b6e2d3fd3 <__epoll_wait_nocancel+10>
eflags         0x246	[ PF ZF IF ]
cs             0x33	51
ss             0x2b	43
ds             0x0	0
es             0x0	0
fs             0x0	0
gs             0x0	0
fctrl          0x37f	895
fstat          0x0	0
ftag           0xffff	65535
fiseg          0x0	0
fioff          0x0	0
foseg          0x0	0
fooff          0x0	0
fop            0x0	0
mxcsr          0x1f80	[ IM DM ZM OM UM PM ]
(gdb) x/i $pc
0x3b6e2d3fd3 <__epoll_wait_nocancel+10>:	cmp    $0xfffffffffffff001,%rax
(gdb)
(gdb) x/10i $pc
0x3b6e2d3fd3 <__epoll_wait_nocancel+10>:	cmp    $0xfffffffffffff001,%rax
0x3b6e2d3fd9 <__epoll_wait_nocancel+16>:	jae    0x3b6e2d4038 <epoll_wait+120>
0x3b6e2d3fdb <__epoll_wait_nocancel+18>:	retq   
0x3b6e2d3fdc <epoll_wait+28>:	sub    $0x28,%rsp
0x3b6e2d3fe0 <epoll_wait+32>:	mov    %rdi,0x8(%rsp)
0x3b6e2d3fe5 <epoll_wait+37>:	mov    %rsi,0x10(%rsp)
0x3b6e2d3fea <epoll_wait+42>:	mov    %rdx,0x18(%rsp)
0x3b6e2d3fef <epoll_wait+47>:	mov    %rcx,0x20(%rsp)
0x3b6e2d3ff4 <epoll_wait+52>:	callq  0x3b6e2dfa80 <__libc_enable_asynccancel>
0x3b6e2d3ff9 <epoll_wait+57>:	mov    0x8(%rsp),%rdi
(gdb)  

你可能感兴趣的:(gdb)