Skip to content

Commit

Permalink
Handle remove_bad_names=False from DAILA (#10)
Browse files Browse the repository at this point in the history
* Pass extra arguments from DAILA

* Handle remove_bad_names=False

* Add suffix to identify decompiler vars

---------

Co-authored-by: Edward J Schwartz <moo.github.z.edmcman@xoxy.net>
  • Loading branch information
edmcman and Edward J Schwartz authored Feb 23, 2024
1 parent e8c8c15 commit 943da21
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion varbert/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def predict_variable_names(

orig_name_2_popular_name, renamed_code = preprocessor.generate_popular_names(
processed_code, func_args, scores, score_origins,
predict_for_decompiler_generated_vars=False
predict_for_decompiler_generated_vars=not remove_bad_names
)
if not orig_name_2_popular_name:
self.warning(f"Unable to predict any names for function {function}")
Expand All @@ -92,6 +92,11 @@ def predict_variable_names(
orig_name_2_popular_name = {
k: v for k, v in name_pairs if "/*decompiler*/" not in v
}
else:
# rewrite decompiled based names
orig_name_2_popular_name = {
k: v.replace(" /*decompiler*/", "_dec") for k, v in orig_name_2_popular_name.items()
}

# check after filtering
self.info(f"Predicted {len(orig_name_2_popular_name)} new names for function {function}")
Expand Down

0 comments on commit 943da21

Please sign in to comment.