-
Notifications
You must be signed in to change notification settings - Fork 539
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
Why do children of a node with type 'triton::ast::ast_e::REFERENCE_NODE' not exist? #1356
Comments
Reference nodes don't have children, just the reference to a symbolic expression. You need to follow references with This helps with things like backslicing because symbolic expressions have extra info like the associated disassembly. |
Anyway, it's too complicated. I expect to get children immediatly when I call .getChildren() method. But as you say I always have to cast SharedAbstractNode to ReferenceNode then getSymbolicExpresssion from it and then getAst from it again to finally get a real node with children. It sounds like choosing Jungles road instead of Highway. |
lol if you want to ride the highway, go use |
Thanks! |
But still one question. Is it a big deal to add Children to Refs? Why is it not implemented? |
To avoid duplicating nodes/sub-trees in memory and to keep an SSA form. |
Is there a problem in adding another shared_ptr? the lifetime of a real node will not change from this, and the API will become consistent and convenient without unnecessary static_cast |
Probably some. I do not remember exactly why I did this years ago. But for example, the first one that comes in mind is when do you stop printing an ast representation ( However, if you think this feature could improve the library for X or Y reason, feel free to provide an MR :). I will be happy to review and merge it :). |
Hey!
I emulated the code above.
Then I got a correct AST in graphviz and I tried to find a child (ZX) of a REF node (REF 366):
It obviously exists on AST graph below REF 366, but it doesn't exists in vector with children, so it looks like incorrect work of API for interacting with ASTs:
Am I thinking right?
The text was updated successfully, but these errors were encountered: