I need to find the dominance tree or a dominance of a program function #3707
-
There is a |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 20 replies
-
You should be able to use the API you mentioned after first creating a graph of all functions, with edges connecting functions via calls (it should work in headless). The 'V,E' represent 'vertex' and 'edge' type of your choosing. In your case, the V is a ghidra Most of our code uses dominance based on code blocks. For an example, see the
|
Beta Was this translation helpful? Give feedback.
-
You appear to no be creating the edges correctly. You are not using the destinations of the code blocks to create edges. As I referenced before, you can see an example of this in
I suggest use use that class as a guide to setup your graph. |
Beta Was this translation helpful? Give feedback.
-
I do not see any obvious flaw in your script. My guess is that the structure of your graph is such that you do not have a single source and/or a single sink in the graph. The algorithm will create dummy source/sink vertices as needed in this case. The algorithm appears to not handle the case where a dummy node is a dominator. I am surpised by this, as I think we would have seen this already in our code. Unfortunately, for you to work around this issue, you will have to change our source code. You can do this if you setup a developer environment using our github repo. Alternatively, you could copy our class(es) as needed, writing them in Python, which would allow you to fix the bug. (Admittedly, this is not a nice solution.) The fix we need is in
Specifically, the code adding an edge needs to be changed to this:
I intend to fix this, but I don't know how long it will be before you can access the updated code. |
Beta Was this translation helpful? Give feedback.
I do not see any obvious flaw in your script. My guess is that the structure of your graph is such that you do not have a single source and/or a single sink in the graph. The algorithm will create dummy source/sink vertices as needed in this case. The algorithm appears to not handle the case where a dummy node is a dominator. I am surpised by this, as I think we would have seen this already in our code.
Unfortunately, for you to work around this issue, you will have to change our source code. You can do this if you setup a developer environment using our github repo. Alternatively, you could copy our class(es) as needed, writing them in Python, which would allow you to fix the bug. (Admit…