Repro steps:
1. Installing Nginx
2. Start the Nginx process
3. Uninstall Nginx, delete files on disk
4. Installing Nginx
5. Resulting in the inability to GDB attach PID
1. Query process start time
[Email protected]_js_011_174 home]# ps-p 181300-o Lstart
STARTED
Wed Dec 10 12:42:52 2014
2. Query file time
[Email protected]_js_011_174 home]# Stat/usr/sbin/nginx
File: '/usr/sbin/nginx '
size:1713256 blocks:3360 IO block:4096 Regular file
device:802h/2050d inode:27265 links:1
Access: (0755/-rwxr-xr-x) Uid: (0/root) Gid: (0/root)
Access:2015-01-27 16:42:42.000000000 +0800
modify:2014-12-09 13:26:43.000000000 +0800
change:2014-12-11 03:46:11.000000000 +0800
3. Although the same version of Nginx, the process started to overwrite the original file, the process startup time than the disk file last modified time, resulting in the process/pro/pid/exe soft connection and disk files are not on the number, can not directly gdb attach the process
[[Email protected]_js_011_174 home]# gdb-p 181300
GNU gdb (gdb) Red Hat Enterprise Linux (7.2-64.el6_5.2)
Copyright (C) Free Software Foundation, Inc.
License gplv3+: GNU GPL version 3 or later
This was free software:you was 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 is configured as "X86_64-redhat-linux-gnu".
For bugs reporting instructions, please see:
Attaching to process 181300
/usr/sbin/nginx (Deleted): No such file or directory.
(GDB) bt
#0 0x0050e7ea in?? ()
Cannot access memory at address 0x8a70ff24
4. Install the corresponding version of Debuginfo
5. Use Gdb/proc/181300/exe 181300 to successfully attach the process
Unable to attach debug process after overwriting file