llmhyy / microbat

A feedback-based debugger for interactively recommending suspicious step in buggy program execution.
54 stars 15 forks source link

Unable to run tests programmatically #224

Open dingyuchen opened 2 years ago

dingyuchen commented 2 years ago

It is hard to pinpoint a program and Execute a trace recording to compare 2 traces for correctness.

From within the microbat_instrumentator project, we do not have access to programmatically access the eclipse dropins directory. From the microbat main plugin project, we cannot generate the AppClassPath as it requires the caller to be an Eclipse instance ( there will be a "Workspace not open error").

On the other hand, a manually written command is also unable to perform a trace recording. I currently suspect that the target program needs to follow a certain project structure in order for the instrumentation to occur. The current test runner records no trace. Upon debugging the instrumentator, it seems like none of the callbacks are hit.

Sample command in question:

/usr/lib/jvm/java-1.8.0-openjdk-amd64/bin/java -ea -noverify -javaagent:/home/dingyuchen/microbat/microbat/lib/instrumentator.jar=precheck=false,stepLimit=14090898,java_home=/usr/lib/jvm/java-1.8.0-openjdk-amd64,log=printProgress:error,varLayer=2,working_dir=/home/dingyuchen/microbat/microbat_instrumentator/src/test/java/microbat/instrumentation/trace/testdata,trace_recorder=FILE,launch_class=microbat.instrumentation.trace.testdata.Sample,class_path=/home/dingyuchen/eclipse/committers-2021-03/eclipse/dropins/junit_lib/junit.jar:/home/dingyuchen/eclipse/committers-2021-03/eclipse/dropins/junit_lib/org.hamcrest.core.jar:/home/dingyuchen/eclipse/committers-2021-03/eclipse/dropins/junit_lib/testrunner.jar:/home/dingyuchen/eclipse/committers-2021-03/eclipse/dropins/junit_lib/bcel-6.0.jar:/home/dingyuchen/eclipse/committers-2021-03/eclipse/dropins/junit_lib/javassist.jar:/home/dingyuchen/microbat/microbat_instrumentator/bin:/home/dingyuchen/microbat/microbat_instrumentator/src:/home/dingyuchen/microbat/microbat_instrumentator,entry_point="microbat.instrumentation.trace.testdata.Sample.main([Ljava/lang/String;)V",dump_file_path=/tmp/trace8635584115944053561.exec -cp /home/dingyuchen/eclipse/committers-2021-03/eclipse/dropins/junit_lib/junit.jar:/home/dingyuchen/eclipse/committers-2021-03/eclipse/dropins/junit_lib/org.hamcrest.core.jar:/home/dingyuchen/eclipse/committers-2021-03/eclipse/dropins/junit_lib/testrunner.jar:/home/dingyuchen/eclipse/committers-2021-03/eclipse/dropins/junit_lib/bcel-6.0.jar:/home/dingyuchen/eclipse/committers-2021-03/eclipse/dropins/junit_lib/javassist.jar:/home/dingyuchen/microbat/microbat_instrumentator/bin:/home/dingyuchen/microbat/microbat_instrumentator/src:/home/dingyuchen/microbat/microbat_instrumentator microbat.instrumentation.trace.testdata.Sample
dingyuchen commented 2 years ago

As a patch, I will write a script to run a working command on the simple test programs in microbat_experiment and store the file record in to a folder. Subsequent runs will read trace contents from file and compare the equality of both runs.