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

How to work with graphiz along retdec? #553

Closed
MBilalQureshi opened this issue Apr 18, 2019 · 4 comments
Closed

How to work with graphiz along retdec? #553

MBilalQureshi opened this issue Apr 18, 2019 · 4 comments

Comments

@MBilalQureshi
Copy link

I have installed retdec, what i want the graphical representation of code that is decompiled in C, how can i do this using graphiz as i am new to this work, can someone kindly explain.

@s3rvac s3rvac changed the title How to work with graphiz along retdec How to work with graphiz along retdec? Apr 19, 2019
@s3rvac
Copy link
Member

s3rvac commented Apr 19, 2019

Hi. First of all, you have to install Graphviz. Then, run decompilations with parameters --backend-emit-cfg and --backend-emit-cg, e.g.

python retdec-decompiler.py --backend-emit-cfg --backend-emit-cg file.exe

The former parameter enables the generation of control-flow graphs while the latter enables the generation of a call graph.

After the decompilation finishes, you should see PNG images in the same directory where the input file is located, which are the control-flow and call graphs. If you do not see any images, it either means there was an error (probably Graphviz has not been installed properly) or there are no functions in the file you are trying to decompile.

BTW, if you want something else than a PNG image, you can use the --graph-format parameter, whose value can be png, pdf, or svg.

@MBilalQureshi
Copy link
Author

@s3rvac thank you so much i knew you would reply, Its says please install graphviz to generate graphics where as it is already installed but is in Program files folder do i need to put it in retdec folder if yes than in retdec which folder.
image

s3rvac added a commit that referenced this issue Apr 20, 2019
RetDec runs the `dot` (or `dot.exe` on Windows) program from Graphivz to convert
the graphs from `.dot` files to PNG files. This program has to be reachable
from PATH. We should mention this as it may not be obvious (see #553).
@s3rvac
Copy link
Member

s3rvac commented Apr 20, 2019

You will need to add the folder containing dot.exe etc. into Path so that RetDec can find it (HOWTO).

BTW, in commit fe27942, I have added this piece of information into the error message to make this fact more obvious for people who stumble upon it in the future.

@MBilalQureshi
Copy link
Author

@s3rvac thank you so much this helped me alot, sorry for late reply. I will contact you if i found any more issue again thank you :)

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

2 participants