z*y 发帖数: 1311 | 1 【 以下文字转载自 Programming 讨论区 】
【 原文由 zyy 所发表 】
For programming experts, please check the following code.
pid = fork() ;
if (pid == 0) {
exec("error_prog") ;
}
else {
waitpid(pid, ....) ;
}
The child process executes "error_prog" which later generates SIGSEGV. The
signal can be caught by the parent. However, is it possible for the parent to
know the address of the instruction of the child program that generates the
fault? If so, how?
Thanks. | p****k 发帖数: 130 | 2 If the child aborted after SIGSEGV, how about let the parent
launch gdb on the core (assume it is there) and do a little
analysis?:)
Seriously, is there any particular reason u want to get
the instruction address while the parent is running?
【在 z*y 的大作中提到】 : 【 以下文字转载自 Programming 讨论区 】 : 【 原文由 zyy 所发表 】 : For programming experts, please check the following code. : pid = fork() ; : if (pid == 0) { : exec("error_prog") ; : } : else { : waitpid(pid, ....) ; : }
|
|