问题描述
我正在使用 gem5 工具来查找陷阱说明。我正在尝试使用一个简单的 C 程序在 gem5 上执行并找到所有陷阱指令。 这是我的 C 代码:
#include <stdio.h>
#include <string.h>
int main () {
FILE *fp;
char c[] = "this is tutorialspoint";
char buffer[100];
/* Open file for both reading and writing */
fp = fopen("file1.txt","w+");
/* Write data to the file */
fwrite(c,strlen(c) + 1,1,fp);
/* Seek to the beginning of the file */
fseek(fp,SEEK_SET);
/* Read and display data */
fread(buffer,strlen(c)+1,fp);
printf("%s\n",buffer);
fclose(fp);
return(0);
}
Gem5 命令:
sudo ./build/X86/gem5.opt --strace -c --debug-flags=Exec --debug-file=example.out configs/example/se.py --cpu-type=DerivO3cpu --caches --mem-type=DDR4_2400_8x8 --mem-size=8GB --cmd=./example
我的目标是从日志中找到trap指令,也就是所有的系统调用。
我得到的输出:这是一个 X86 架构。但问题是我无法找到系统调用(陷阱指令),因为转储只有“系统调用”
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)