AIX 服务器中的 g++ 编译 - 抛出核心转储
g++ Compilation in AIX server - Throwing core dump
我有下面的代码。
猫sample.c
#include<stdio.h>
#include "hello.c"
int main()
{
hello_world();
return 0;
}
猫hello.c
#include<stdio.h>
void hello_world()
{
printf("Hello World");
}
使用的编译命令:
g++ -gxcoff -maix64 -shared -fpic -fpermissive -w -Ihello.c -o sample sample.c -Xlinker -e.main
执行
$./样本
段错误(核心转储)
我尝试调试核心。但是找不到太多
$ dbx 样本核心
Type 'help' for help.
[using memory image in core]
reading symbolic information ...internal error: 1283-232 index("16;0;", ':') failed
internal error: 1283-232 index("16;0;", ':') failed
internal error: 1283-232 index("8;0;", ':') failed
internal error: 1283-228 expected char ',', found ';-31,448,256;;'
internal error: 1283-228 expected char ';', found ',256;;'
internal error: 1283-232 index("256;;", ':') failed
Segmentation fault in . at 0x7c0802a6f8010010
0x7c0802a6f8010010 (???) warning: Unable to access address 0x7c0802a6f8010010 from core
请帮我解决这个核心转储问题
g++ -gxcoff -maix64 -shared -fpic ...
以上命令构建了一个 共享库 ,而不是您可以 运行 的可执行文件。从中删除 -shared
以及 -Xlinker -e.main
,它应该可以正常工作。
我有下面的代码。
猫sample.c
#include<stdio.h>
#include "hello.c"
int main()
{
hello_world();
return 0;
}
猫hello.c
#include<stdio.h>
void hello_world()
{
printf("Hello World");
}
使用的编译命令:
g++ -gxcoff -maix64 -shared -fpic -fpermissive -w -Ihello.c -o sample sample.c -Xlinker -e.main
执行
$./样本
段错误(核心转储)
我尝试调试核心。但是找不到太多
$ dbx 样本核心
Type 'help' for help. [using memory image in core] reading symbolic information ...internal error: 1283-232 index("16;0;", ':') failed internal error: 1283-232 index("16;0;", ':') failed internal error: 1283-232 index("8;0;", ':') failed internal error: 1283-228 expected char ',', found ';-31,448,256;;' internal error: 1283-228 expected char ';', found ',256;;' internal error: 1283-232 index("256;;", ':') failed Segmentation fault in . at 0x7c0802a6f8010010 0x7c0802a6f8010010 (???) warning: Unable to access address 0x7c0802a6f8010010 from core
请帮我解决这个核心转储问题
g++ -gxcoff -maix64 -shared -fpic ...
以上命令构建了一个 共享库 ,而不是您可以 运行 的可执行文件。从中删除 -shared
以及 -Xlinker -e.main
,它应该可以正常工作。