Fw: [问题] 关于 core dump

楼主: shiningboy   2018-07-10 06:41:36
※ [本文转录自 C_and_CPP 看板 #1RG-B07J ]
作者: shiningboy () 看板: C_and_CPP
标题: [问题] 关于 core dump
时间: Tue Jul 10 06:33:33 2018
开发平台(Platform): (Ex: Win10, Linux, ...)
Linux 4.13
编译器(Ex: GCC, clang, VC++...)+目标环境(跟开发平台不同的话需列出)
GCC
额外使用到的函数库(Library Used): (Ex: OpenGL, ...)
n/a
问题(Question):
我的问题是
第一个程式
int main(){
// code to line 9
abort();
}
第二个程式
pid_t parent = getpid();
int main(){
// code to line 9
fork();
if( getpid() != parent ){
abort();
}
// parent process still working to end
}
在同一个程式的某一个特定点 ,
ex. 假设都在第 10 行左右 call abort()
第一个程式
single process
在第 10 行 abort() , 产生一个 core dump 档
第二个程式
在第 10 行左右 fork 一个 child process
然后这个 child process 就马上 abort()
在第 10 行左右 fork 的 child process 有跟 parent 一样的 data
在没有做其他的变量处理的状况之下
第一个程式跟第二个程式的 core dump 的内容是否应该是一样的???
喂入的资料(Input):
如上
预期的正确结果(Expected Output):
因为在第 10 行左右 fork 的 child process 有跟 parent 一样的 data
所以在没有做其他的变量处理的状况之下
第一个程式跟第二个程式的 core dump 的内容是否应该是一样的???
错误结果(Wrong Output):
n/a
程式码(Code):(请善用置底文网页, 记得排版,禁止使用图档)
如上
补充说明(Supplement):
n/a
作者: leolarrel (真.粽子无双)   2018-07-10 09:37:00
大致上会一样,但不可能会一模一样
作者: b0920075 (Void)   2018-07-10 12:55:00
把两个core dump做杂凑比较看看?
楼主: shiningboy   2018-07-12 02:23:00
了解 , 谢谢大家

Links booklink

Contact Us: admin [ a t ] ucptt.com