【发布时间】:2023-02-18 15:35:25
【问题描述】:
当我学习 Gem5 时,我按照教程通过以下命令启动 Gem5:
$ build/X86/gem5.opt configs/example/se.py -c tests/test-progs/hello/bin/x86/linux/hello
一般来说,执行命令后,工作目录下会出现m5out/目录,其中包含stats.txt和config.*文件。
但是,我得到了所有文件,期望 config.dot.pdf 和 config.dot.svg
控制台输出警告信息:
warn: failed to generate dot output from m5out/config.dot
我在互联网上到处搜索答案,但没有找到我想要的答案。
然后我回到 gem5 源代码并找到导致无法生成 config.dot.pdf 和 config.dot.svg 文件的源代码位置(~/gem5/src/python/m5/util/dot_writer.py)。尽管如此,我还是不明白为什么代码会报告一个错误。
# in ~/gem5/src/python/m5/util/dot_writer.py
def do_dot(root, outdir, dotFilename):
if not pydot:
warn("No dot file generated. " +
"Please install pydot to generate the dot file and pdf.")
return
callgraph = pydot.Dot(graph_type='digraph', ranksep='1.3')
dot_create_nodes(root, callgraph)
dot_create_edges(root, callgraph)
dot_filename = os.path.join(outdir, dotFilename)
callgraph.write(dot_filename)
# It didn't work!!!!!!!
try:
# dot crashes if the figure is extremely wide.
# So avoid terminating simulation unnecessarily
callgraph.write_svg(dot_filename + ".svg")
callgraph.write_pdf(dot_filename + ".pdf")
except:
warn("failed to generate dot output from %s", dot_filename)
有人可以帮忙吗?提前致谢!
【问题讨论】:
-
那个光秃秃的
except看起来令人担忧。您可以更改代码以打印出异常吗? -
@SamMason 我更改了打印信息的代码,但是它不起作用...太奇怪了