Description
Introduction
An interesting approach for studying the behavior of an application is to trace the set of system calls
invoked during the lifetime of the application. The strace command in the Linux Operating System
executes an application given as arguments to it and prints all system calls and their arguments
used by the application. In this project you will use strace to analyze the behavior of different
applications.
To begin the project, you should use strace to execute a few commands and observe the output.
For example, try “strace ls” or “strace ls -l”. The system call trace is printed to stderr (standard
error) rather than stdout (standard out). This distinction allows it to be redirected to an alternate
location. A small shell script in
https://web.cs.wpi.edu/˜cs3013/a20/dostrace
is available for you to use. This script executes the command given to it with strace and redirects
the trace of system calls to a log file. Use of the script also allows interactive commands to be
more easily traced.
You can use wget to retrieve the shell script (the quotes prevent your shell from interpreting the
tilde character) and then use chmod to change the permission mode for execution. Once done, you
can execute any command with the script, such as shown for ls in the following:
% wget ’https://web.cs.wpi.edu/˜cs3013/a20/dostrace’
% chmod 755 dostrace
% ./dostrace ls