binaryninja-api icon indicating copy to clipboard operation
binaryninja-api copied to clipboard

PossibleValueSet merging api

Open mostobriv opened this issue 2 weeks ago • 2 comments

What is the feature you'd like to have? Sometimes when developing workflows or some scripts I need to traverse PVS and then get the accumulated PVS of some variable (mostly this happened in cases when BN automatically fails to build PVS by itself), in this cases ability to merge one PVS with another is helpful, however current python api is lacking of such feature.

So, I think, having __add__ and __iadd__ for PossibleValueSet class would be a handy QoL feature.

  • UndeterminedValue + Any == UndeterminedValue or exception
  • ConstantValue / ConstantPointerValue + ConstantValue / ConstantPointerValue == InSetOfValues or (in case of equality) ConstantPointerValue
  • InSetOfValues + InSetOfValues == InSetOfValues
  • NotInSetOfValues + NotInSetOfValues == NotInSetOfValues
  • etc.

mostobriv avatar Dec 09 '25 17:12 mostobriv

If it worth a shot, I can try to implement it and make a PR, just didn't want to bother you guys with meaningless or unwanted PRs.

mostobriv avatar Dec 09 '25 17:12 mostobriv

We have a bunch of these implemented in the core. It may be worth exposing them or moving the source to the public repo so that others can use them as well. CC core/possiblevalueset.h

CouleeApps avatar Dec 09 '25 17:12 CouleeApps

APIs for PVS operations added in 5.3.8793-dev using e.g. .add(other, size)

negasora avatar Dec 16 '25 04:12 negasora