I'm using the gem5 tool to find the trap instructions. I'm trying to use a simple C program to execute on gem5 and find all the trap instructions. Here's my C code :
#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, 0, SEEK_SET);
/* Read and display data */
fread(buffer, strlen(c)+1, 1, fp);
printf("%s\n", buffer);
fclose(fp);
return(0);
}
Gem5 command:
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
I aim to find the trap instruction from the log, that is all the system calls.
The output I got: This is an X86 architecture. But the problem is I'm not able to find the syscalls (trap instructions) as the dump only has "syscall"