Chinaunix
标题:
HP上system调用别的程序,coredown返回值的问题
[打印本页]
作者:
macleehit
时间:
2008-11-10 09:39
标题:
HP上system调用别的程序,coredown返回值的问题
我的机器是HP的6600,操作系统是HP-UX B.11.23
我的测试程序如下:
#include <iostream>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
using namespace std;
int main(int argc, char ** argv)
{
int status = system(argv[1]);
printf("status=0x%x\n", status);
if (WIFEXITED(status))
printf("normal termination, exit status = %d\n",
WEXITSTATUS(status));
else if (WIFSIGNALED(status))
printf("abnormal termination, signal number = %d%s\n",
WTERMSIG(status),
#ifdef WCOREDUMP
WCOREDUMP(status) ? " (core file generated)" : "");
#else
"");
#endif
else if (WIFSTOPPED(status))
printf("child stopped, signal number = %d\n",
WSTOPSIG(status));
}
然后执行一些coredown的程序,测试结果如下:
1.浮点异常
***********> ./systest ./cored
sh: 6331 浮点异常(coredump)
status=0x8800
normal termination, exit status = 136
2.内存错误
***********> ./systest ./cored1
sh: 9202 内存错误(coredump)
status=0x8b00
normal termination, exit status = 139
大家帮忙看看,按照HP-UX的(man system) 的结果,这两个结果都应该是 (core file generated)的。
为啥我的coredown程序却没有 (core file generated)呢?到底coredown返回值是个什么样的结果呢?
作者:
macleehit
时间:
2008-11-10 10:51
刚又测试了一个,结果如下:
3.assert错误
***********> ./systest ./cored3
Assertion failed: 1 == 0, file cored3.c, line 6
sh: 16682 中止(coredump)
status=0x8600
normal termination, exit status = 134
现在看来应该是0x8000是coredown位,可是这和HP上man的描述不一致啊。
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2