gdb连接到一个进程没有停止 [英] gdb attach to a process without stop

查看:224
本文介绍了gdb连接到一个进程没有停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次我使用gdb附加到一个进程时,它会停止目标程序,我需要输入'cont'才能让它启动。有没有办法在不停止的情况下附加到进程?这使得事情变得更简单,如果进程在停止一段时间后表现不同。

。您可以立即继续...创建一个简单的批处理脚本,它将附加到特定的流程,并在附加后立即继续执行:

  gdb attach $ 1 -x<(echocont)




./attach PID



Everytime I attach to a process using gdb, it will stop the target program, and I need to type 'cont' to let it go. Is there a way to attach to a process without stopping it? This makes things easier if the process will behave differently if it stops for a while.

解决方案

You can't make it not stop. You can however instantly continue... Create a simple batch script which will attach to a specific process and instantly continuing execution after attaching:

gdb attach $1 -x <(echo "cont")

./attach PID

这篇关于gdb连接到一个进程没有停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆