2

Using a code example provided in the PIN API titled strace.cpp on a binary should provide an output file containing all the system calls used, as well as some other information. The binary I use as a test is a simple C binary that contains a getpid() system call, which is the 20th system call. The source looks like this:

struct {
  unsigned int pid;
  char data [16];
}test;

void foo(){
  printf("In Foo!\n");
  char *p = "hello world";
  test.pid = getpid();
  strcpy(test.data,p);  
}

int main()
{
  printf("Hello World!\n");
  foo();
  return 0;
}

After the PIN tool completes there is an output file in the working directory titled strace.out, which contains all of the system call information. The file contains about 28 different system calls, but none of them are labeled 20, or the getpid() system call. The system call number is the first number following the colon on each line.

TypeKazt
  • 318
  • 1
  • 13

0 Answers0