resess / Slicer4J

Slicer4J is an accurate, low-overhead dynamic slicer for Java programs.
MIT License
39 stars 17 forks source link

Library classes in jar are thrown out during instrumentation #15

Open Lms24 opened 2 years ago

Lms24 commented 2 years ago

Hello,

I am currently trying to create dynamic slices from the test cases of this project. The project depends on the following libraries:

<dependencies>
  <dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>servlet-api</artifactId>
    <version>2.5</version>
  </dependency> 
  <dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.11</version>
    <scope>test</scope>
  </dependency>
</dependencies>

I've created a fat jar containing the compiled source and test classes, as well as the classes of all libraries.

After instrumenting the jar with SLice4J (mode i), the classes from javax.servlet are all missing in the resulting *_i.jar file! This is a problem as I get exceptions like this one for obvious reasons when I want to trace the execution:

Exception in thread "main" java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest

Is there something I can do as a user of Slicer4J to fix this or is this a problem/bug in the implementation or one of its libraries (soot?)?

Thanks and have a nice day!

khaled-e-a commented 2 years ago

It seems like a bug. Can you please attach the fat jar?

Lms24 commented 2 years ago

Thanks for the quick response.

This is my original fat jar (packed as zip) cors-filter-1.0.2-SNAPSHOT-fat-tests.zip

And just in case you need it, here's the instrumented version from Slicer4J: cors-filter-1.0.2-SNAPSHOT-fat-tests_i.zip