Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added reset methods to Scene and SourceLocator to load multiple sources into one Scene and Concrete Native Methods #2015

Merged
merged 7 commits into from
Jan 30, 2024

Conversation

lukaswd
Copy link
Contributor

@lukaswd lukaswd commented Nov 6, 2023

These two methods allow for subsequent calls of loadNecessaryClasses().

With that it is possible, if the two methods are called before the next loadNecessaryClasses() method call, to load multiple sources into the same Soot Scene.

Example code to load two programs into the same Soot Scene:

// Options setting for the first source here

Scene.v().loadNecessaryClasses();

// Options setting for the second source here

SourceLocator.v().resetCaches();
Scene.v().resetSootClassPathCache();
Scene.v().setResolving(false);

Scene.v().loadNecessaryClasses();

@lukaswd lukaswd changed the title added reset method to Scene and SourceLocator that resets some Object variables to null added reset methods to Scene and SourceLocator to load multiple sources into one Scene and Concrete Native Methods Jan 19, 2024
@@ -230,7 +230,7 @@ public boolean isPhantom() {
* Returns true if this method is not phantom, abstract or native, i.e. this method can have a body.
*/
public boolean isConcrete() {
return !isPhantom() && !isAbstract() && !isNative();
return !isPhantom() && !isAbstract();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should only use this semantics if the native code module is enabled. Maybe we can add a flag to the Options to enable or disable native code and check this flag here. Keep in mind that the options are generated from XML files via XSLT, so don't modify the Java file directly.

@MarcMil What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like a good idea, this implementation right here would brick things.

I wonder whether it would be better to do something like hasActiveBody() || ms != null, so if it is possible to retrieve a body at all, which is what every caller seems to actually want to know.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be an option, but it would also force us to refactor the Jimple Native reader to make it a proper MethodSource.

@lukaswd lukaswd requested a review from StevenArzt January 29, 2024 16:21
@StevenArzt
Copy link
Contributor

@lukaswd The code style check failed. Please have a look and fix the code accordingly.

@StevenArzt StevenArzt merged commit 61a1215 into soot-oss:develop Jan 30, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants