`
haoningabc
  • 浏览: 1476955 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

人类已经阻止不了gdb了

    博客分类:
  • gdb
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完全手册.pdf.zip_GDB pdf_GDB中文手册_gdb_linux_linux gdb pdf

    GDB(GNU Debugger)是GNU项目的一个组成部分,是一款强大的源代码级调试器,适用于C、C++、Fortran、Objective-C、Python等语言。这款工具允许程序员在运行代码时检查程序的状态,包括变量值、内存区域、调用堆栈等...

    gdb64.exe和gdb.exe

    GDB(GNU Debugger)是GNU项目的一个开源工具,用于调试C、C++和其他语言编写的程序。...总之,GDB和GDB64是强大的调试工具,对于软件开发人员来说不可或缺。了解并熟练使用它们能够显著提高调试效率,解决复杂的问题。

    GDB.zip_debugger_gdb debgger保存_gdb调试_gnu debugger

    《深入理解GDB:GNU调试器的探索与实践》 ...熟练掌握GDB的使用,对于任何Unix环境下的开发者来说,都是必不可少的技能之一。通过阅读和学习GDB的相关资料,如《GDB.pdf》,你将能深入理解并充分利用这个强大的工具。

    gdb11.1 gdb9.2 无法读取clang dwarf

    如果gdb不支持clang生成的dwarf版本,就可能导致解析失败。 2. **bug或不兼容性**:gdb或clang可能存在已知的bug,导致在特定版本下dwarf信息不能正确读取。检查官方更新日志和社区论坛可以找出是否已有相关的修复...

    Linux下GDB的移植

    在编译GDB之前,需要确保ncurses已经编译成功,并将其生成的文件夹拷贝到指定的目录下。然后,进入GDB的根目录,输入以下命令生成Makefile文件: ./configure --host=arm-none-linux-gnueabi --prefix="$PWD/../...

    gdb手册debuging with gdb 中文

    GNU调试器(GDB)是一款功能强大的源码级调试工具,适用于多种编程语言,包括但不限于C、C++等。该手册针对的是GDB的第六版,版本号为6.8.50.20090706,提供了详细的使用指导。 #### 二、GDB入门 **2.1 调用GDB** ...

    gdb.exe文件

    在编程过程中,特别是进行低级别调试或优化代码时,GDB是一个不可或缺的工具。它允许程序员设置断点、单步执行代码、检查变量值、跟踪调用堆栈等,从而帮助找出程序中的错误。 描述中提到,在使用OpenCV(一个流行...

    GDB中文手册 GDB

    - **GDB命令体系**:GDB的命令体系丰富且强大,包括但不限于命令语法解析、自动补全、获取帮助等功能,极大地提高了调试效率和用户体验。 #### 三、在GDB下运行程序 - **适合调试的编译**:为了确保GDB能够正确...

    包括gdb64.exe和gdb.exe

    标签“资源文件”表明这是开发过程中可能需要的工具或库,对于编写和调试代码来说是必不可少的。 在压缩包中的"gdb文件"可能包含GDB的配置文件、文档、库或其他相关资源。这些资源可能包括: 1. **配置文件**:如`...

    GDB官网用户手册(gdb.pdf)

    GDB 官方用户手册是 GNU 调试器的一份官方文档,用于帮助用户学习和掌握 GDB 的使用方法和技术。本手册涵盖了 GDB 的基本概念、基本使用方法、调试技术、进阶技术等方面的知识点。 知识点 1: GDB 的基本概念 GDB...

    最新gdb8.1和gdb7.7

    gdb-8.1是GDB的一个较新版本,可能包含了更多的功能改进和错误修复,而gdb-7.7.1则是一个稍旧的稳定版本,适合那些对新特性需求不强但注重稳定性的用户。 描述中提到的“下载完该软件包,解压后可以看到gdb-7.7.1....

    GDB完全中文书册

    GDB的主要功能包括但不限于: 1. **程序启动控制**:用户可以根据自己的需求启动并运行程序。 2. **设置断点**:可以在特定位置或满足特定条件时暂停程序执行。 3. **状态检查**:当程序暂停时,可以检查当前程序的...

    gdb.zip gdb源码

    GDB,全称为GNU调试器(GNU Debugger),是开源的、跨平台的C/C++、Fortran、Python等编程语言的调试工具。它允许程序员在程序运行时检查其内部状态,包括变量值、内存区域、堆栈跟踪以及指令执行等,从而帮助定位和...

    virtual gdb vs2022可用

    这通常涉及到开发人员能够利用GDB的功能,通过VS2022的用户界面来调试不在本地运行的程序,比如在嵌入式设备或者不同操作系统上运行的程序。 标签"virtualgdb"和"vs2022"是关键词,分别代表虚拟GDB工具和Visual ...

    visualgdb 5.3r8

    《VisualGDB 5.3r8:高效ARM软件开发的得力助手》 VisualGDB是一款强大的集成开发环境插件,专为在Microsoft Visual ...如果你是Visual Studio的忠实用户,又需要处理ARM项目,VisualGDB无疑是你不可或缺的工具。

    GDB不完全手册( 入门篇)

    **GDB 不完全手册( 入门篇)** GDB,全称为GNU Debugger,是一款用于软件调试的强大工具,尤其在Linux环境下广泛使用。虽然它主要应用于Linux系统,但也有移植到Win32平台上的版本,使得Windows用户也能利用其进行...

    GDB查找内存泄露

    GDB(GNU Debugger)是一个强大的调试工具,能够帮助开发者在C/C++等语言的程序中查找和定位内存泄露的问题。下面将详细介绍如何使用GDB来查找和分析内存泄露。 首先,内存泄露通常发生在动态分配的内存没有被正确...

    GDB安装步骤,详细步骤

    同时,确保系统已经更新到最新版本,以避免兼容性问题。 2. **安装依赖** 在Ubuntu或Debian系系统中,GDB可能依赖于`build-essential`包,包含了编译GDB所需的工具。通过运行以下命令安装: ``` sudo apt-get ...

    Linux绿色gdb,无需安装,支持c++对象

    在Linux系统中,`/`是根目录,通常不建议在这里放置用户文件,但假设这是为了演示目的。实际操作时,推荐在个人目录如`/home/username`下创建一个特定的文件夹来存放这些工具。 解压完成后,你可以找到两个主要的...

Global site tag (gtag.js) - Google Analytics