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

migrate an old (somewhat useful) basicblock size vector #196

Open
4 tasks
nirizr opened this issue Feb 25, 2017 · 0 comments
Open
4 tasks

migrate an old (somewhat useful) basicblock size vector #196

nirizr opened this issue Feb 25, 2017 · 0 comments

Comments

@nirizr
Copy link
Owner

nirizr commented Feb 25, 2017

I old incarnations of rematch, we've used a feature extractor that proved to be occasionally useful.

The feature extractor was, put simply, a histogram of basic-block sizes.

This could easily be augmented by adding other types of information into the vector, but was useful enough on it's own so seems like a good start.

Additional data piece: External cross-references (cross-references to objects outside the function, usually other functions through calls or global data access).

Tasks:

  • Add Vector class
  • Add distance matcher (based on HistMatch or brand new one)
  • Include external cross references.
  • Include types of cross-references in a different vector portion.

A simple example:

  vector = np.zeros((4096,))
  size = 0
  for item_ea in FuncItems(ea):
    if InternalXrefsToItem(item_ea):
      vector[size] += 1
      size = ItemSize(item_ea)
    if InternalXrefsFromItem(item_ea):
      vector[size] += 1
      size = 0
    else:
      size += ItemSize(item_ea)

  if np.sum(vector) > 8:
    return vector
  else:
    return None
@nirizr nirizr changed the title migrate of old (somewhat useful) basicblock size vector migrate an old (somewhat useful) basicblock size vector Feb 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant