[问题] 关于 core dump

楼主: shiningboy   2018-07-10 06:33:33
开发平台(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

Links booklink

Contact Us: admin [ a t ] ucptt.com