Function properties for checking function flags (is_library, is_thunk, etc)
Closed this issue · 8 comments
In my use of Sark, I am often checking function flags to see if a function is a recognized library or is a thunk function.
It would be quite convenient to have a properties such as Function.is_library or Function.is_thunk. This would make my code much more readable.
Is this a feature you would consider including? If so, I don't mind doing the work and creating a PR.
Yes, this sounds like a good idea.
@tmr232 Sorry, this had fallen to the bottom of my stack and I had all but forgotten about it. I've submitted a PR that has a 1-to-1 mapping from idaapi function flags to properties in function.Function
. If there's anything you want me to do differently, just let me know and I'll fixup the PR.
What do you think about adding a class to hold it? Something like Function.flags.is_far
?
I don't like the way it currently seems to clutter the function class.
What do you think about adding a class to hold it?
Brilliant. I've edited the PR to add a FunctionFlags
class to implement this.
A couple questions:
-
Do you want to keep the FUNC_FLAGS dictionary, or would you prefer everything be merged into the
FunctionFlags
class? -
At the moment, I'm creating a new
FunctionFlags
instance every timeFunction.flags
is invoked. Do you think this is good enough, or should we store theFunctionFlags
instance in theFunction
instance? (I'm not sure if the function flags can change or not. If they can, then clearly we can't store.)
Indeed. Apologies for not closing earlier.
no worries. :)
i was just helping clean up open issues and things. ;)