Is there a way to get a list of all executed methods of a program with a certain input? For example:
public static void main(String[] args)
{
Car c1 = new Car("c1");
c1.drive();
if(args.length > 2)
{
Car c2 = new Car("c2");
c2.drive();
}
}
public class Car()
{
String name;
public Car(String name)
{
this.name = name;
}
public void drive();
{
System.out.println(name + " is driving!");
}
}
Now I'd like to get the executed methods with the input "1 2 3" (c1 and c2 will be created). So a list that looks like this:
void main(String[] args);
public Car(String name);
void drive();
void println(String input);
public Car(String name);
void drive();
void println(String input);
Maybe even more methods will be listed because of the "+
" in println or something else. Does anyone know how to create such a list automatically?
And if that is too easy for someone, it would also be great to filter the listed methods in such a way that only methods will be listed that were created by the programer and not methods that were used but not created, like println (I hope you know what I mean). The list would then look like this:
void main(String[] args);
public Car(String name);
void drive();
public Car(String name);
void drive();