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

Implement option to print unresolved methods to file #163

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

phreppo
Copy link
Contributor

@phreppo phreppo commented Jun 5, 2024

This PR implements the possibility to dump the methods that Mariana Trench was not able to resolved to a unresolved-methods.json file.
By setting the --dump-unresolved-methods flag, the unresolved calls are printed to a unresolved-methods.json file.
The number of unresolved calls is logged into the metadata.json file.
This feature is useful for the user of the analyzer to detect which method were not resolved (and could then lead to false negatives).

@arthaud
Copy link
Contributor

arthaud commented Jun 6, 2024

Thanks, I think that's useful.

Could we rename the option to --dump-unresolved-calls though? "unresolved methods" is a bit confusing.
Also, could you explain why we are doing this in the forward and backward analysis? The more natural place to collect unresolved calls is in the call graph construction.
And finally, wouldn't you want to also log the caller and possibly line/column number?

@phreppo
Copy link
Contributor Author

phreppo commented Jun 6, 2024

I have been discussing with @the-storm, and including the information about the call site for the methods that have not been resolved could generate noise in the output. The interesting information is which methods are not being resolved, so that the user of the analyzer can try to provide the needed code to reduce the number of false negatives. By not including the information about the call site we effectively log the unresolved methods rather than the calls, hence the name of the flag.

Regarding the fact that we could collect the unresolved calls in the call graph construction: I did not know that! The reason why I went this way is that by inspecting the code, there is a logging statement in the same place where I put the collection of the unresolved methods:

statistics.log_unable_to_resolve_call(instruction->get_method());
WARNING_OR_DUMP(
context,
3,
"Unable to resolve call to `{}`",
show(instruction->get_method()));

I though it was the best place to put the collection of unresolved calls, since logging happens there. Do you know if there is a specific reason for logging to be there rather than the call graph construction?

Thanks!

@arthaud
Copy link
Contributor

arthaud commented Jun 6, 2024

Do you know if there is a specific reason for logging to be there rather than the call graph construction?

I think it should be in both. It's still useful there in case someone is looking at the logs for that specific caller method (using --log-method).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants