Usage instructions

Requirements

  • Java (JRE ≥ 8).
  • Erlang/OTP 24 (erl must be in your PATH).

If you wish to build the program from source, you'll need:

  • Java (JDK ≥ 8).
  • Apache Ant.

Compilation in Linux and macOS

Extract the sources, and run ant in the root folder.

Then, you'll find a directory dist/e-Knife, containing a jar file and a Resources folder.

How can I use a different version of Erlang?

You'll need to replace the Java-Erlang interface with the appropriate version for your Erlang installation. This interface is called jinterface, and is located in the lib folder of your Erlang distribution. The path to it may vary depending on your system.

You must remove the existing library in e-Knife/src/com/ericsson/otp/erlang and replace it with your installation.

rm -rf e-Knife/src/com/ericsson/otp/erlang
cp /usr/lib/erlang/lib/jinterface-*/src_java/com/ericsson/otp/erlang e-Knife/src/com/ericsson/otp/erlang

Usage

Extract the downloaded executable or build it yourself, then open a terminal.

The program is invoked by running java -jar path/to/e-Knife.jar and placing the following arguments afterwards:

-i,--input <file/dir>: Input path
The file to slice, or the root folder where the source files are located.
-o,--output <file/dir>: Output path
The file or folder where the resulting slice will be placed.
-f,--file <filename>
Optional. The name of the file, relative to --input. This is only necessary if you've specified a directory.
-l,--line <num>
The line where the slicing criterion is located.
-v,--var <name>
The name of the slicing criterion's variable.
-n,--occurrence <num>
Optional. The number of occurrence of a variable, starting with 1. This numbering is done in execution order, not in the order the variables appear in the source code.
If you call the program without any arguments, or with some missing, you'll see a help message.

Troubleshooting

The program exists but the slice is not generated

That is likely caused by a wrong version of Erlang. You can try to recompile the Erlang programs in the Resources/scripts folder. Within the folder, run erlc *.erl. Otherwise, you'll need to compile the program from source.

Could not create and connect to an erlang process!

See the previous error. This may also be caused by remaining Erlang process whose name is in conflict. Killing these rogue processes should help.

Erlang will use your hostname to communicate between processes. If your hostname has dots (e.g. name.local), verify that the first element resolves to your computer (i.e. there is a line in your hosts file with the content 127.0.0.1 name).