作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如何在 gdb 中附加多个正在运行的进程?
将一个进程附加到 gdb,gdb 无法附加第二个进程。
最佳答案
您可以添加另一个劣质。
这是示例 gdb session :
ks@ks-comp:~$ sleep 1d &
[1] 2917
ks@ks-comp:~$
ks@ks-comp:~$ sleep 2d &
[2] 2919
ks@ks-comp:~$
ks@ks-comp:~$ gdb -q
(gdb) attach 2919
Attaching to process 2919
Reading symbols from /bin/sleep...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libc.so.6...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libc-2.19.so...done.
done.
Loaded symbols for /lib/x86_64-linux-gnu/libc.so.6
Reading symbols from /lib64/ld-linux-x86-64.so.2...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/ld-2.19.so...done.
done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
0x00007f81492999a0 in __nanosleep_nocancel () at ../sysdeps/unix/syscall-template.S:81
81 ../sysdeps/unix/syscall-template.S: No such file or directory.
(gdb) add-inferior
Added inferior 2
(gdb) inferior 2
[Switching to inferior 2 [<null>] (<noexec>)]
(gdb) attach 2917
Attaching to process 2917
Reading symbols from /bin/sleep...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libc.so.6...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libc-2.19.so...done.
done.
Loaded symbols for /lib/x86_64-linux-gnu/libc.so.6
Reading symbols from /lib64/ld-linux-x86-64.so.2...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/ld-2.19.so...done.
done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
0x00007f159f0d29a0 in __nanosleep_nocancel () at ../sysdeps/unix/syscall-template.S:81
81 ../sysdeps/unix/syscall-template.S: No such file or directory.
(gdb) i inferiors
Num Description Executable
* 2 process 2917 /bin/sleep
1 process 2919 /bin/sleep
(gdb)
见
Debugging Multiple Inferiors and Programs
关于c - 如何在gdb中附加多个正在运行的进程?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27527316/
我是一名优秀的程序员,十分优秀!