I have a program that only generates the output when it returns normally or when it calls the exit()
function (I'm trying to use gcov
on a C program). On a special input my program hangs in an infinite loop so I have to terminate it by sending termination signal. In this situation it won't produce the output I need since it wouldn't call exit()
.
Is there any way that I can force a running program to call exit()
and terminate without touching the source code and writing a signal handler?
正如评论中所建议的那样,我在gdb
执行了我的程序,并在收到信号后手动调用exit()
,它的工作方式就像魅力。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.