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

can't generate graph #28

Closed
Bearshanjun opened this issue Oct 30, 2020 · 1 comment
Closed

can't generate graph #28

Bearshanjun opened this issue Oct 30, 2020 · 1 comment

Comments

@Bearshanjun
Copy link

Bearshanjun commented Oct 30, 2020

hi
i want use CFGFast generate CFG
my code is:

proj=angr.Project('/opt/png')
cfg = proj.analyses.CFGFast()
plot_cfg(cfg, "mycfg",asminst=True, remove_imports=True, remove_path_terminator=True)

but an error occurred:

"dot" with args ['-Tpng', '/tmp/tmpd9c_cdp3'] returned code: -11

stdout, stderr:
 b''
b''

Traceback (most recent call last):
  File "outputGraph.py", line 135, in <module>
    outputGraph()
  File "outputGraph.py", line 88, in outputGraph
    plot_cfg(cfgs, "static", asminst=True, remove_imports=True, remove_path_terminator=True) #, format='raw')
  File "/opt/angr-utils/angrutils/visualize.py", line 34, in plot_cfg
    vis.process(cfg.graph) 
  File "/opt/bingraphvis/bingraphvis/base.py", line 310, in process
    return self.output.generate(graph)
  File "/opt/bingraphvis/bingraphvis/output.py", line 217, in generate
    dotfile.write("{}.{}".format(self.fname, self.format), format=self.format)
  File "/usr/local/lib/python3.6/site-packages/pydot.py", line 1817, in write
    s = self.create(prog, format, encoding=encoding)
  File "/usr/local/lib/python3.6/site-packages/pydot.py", line 1945, in create
    assert process.returncode == 0, process.returncode
AssertionError: -11

when instead of using the png format as output, add format='raw' (or svg)parameter to plot_cfg, use
dot -Tpng xxx.raw > xxx.png

also an error occurred:
Segmentation fault (core dumped)

can you give me some advice or hints.

thanks

@axt
Copy link
Owner

axt commented Nov 8, 2020

Hi. Sorry for my late answer.

I think the problem is with your graphviz installation.

The code just creates the graph in a 'dot' file format and then calls graphviz to render it.

If you use the format 'raw' then no rendering is done, the output is just saved into a file. If you use the format 'dot', then the output still will be in a dot format, bud every node will have some layouting info attached.

If you can produce raw or svg files, but have problems with the others, that clearly indicates that the problem is with the graphviz dot command, as the Segfault also indicates that.

Can you try to render a simple graph to see if graphviz fails with it:

graph {
A -- B
}

@axt axt closed this as completed Mar 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants