简体   繁体   English

从Python调用CBMC吗?

[英]CBMC call from Python?

Is there a way that I can call CBMC from Python or is there any wrapper or API for it available? 有没有一种方法可以从Python调用CBMC,或者有可用的包装器或API?

My Problem is the following. 我的问题如下。 I want to create a C function automatically in Python (this works quite well) and sent them to CBMC from Python for checking and get feedback if the function is OK or not. 我想在Python中自动创建一个C函数(效果很好),然后将其从Python发送到CBMC进行检查,并在函数正常与否的情况下获取反馈。

Since CBMC can produce a significant amount of output your best bet would be to work out how to call if from the command line. 由于CBMC可以产生大量输出,因此最好的选择是确定如何从命令行调用。

Once you have done that then you can use the subprocess.call library function to call the same with the output redirected to a file, then process the contents of the file. 完成此操作后,您可以使用subprocess.call 库函数来调用相同的函数 ,并将输出重定向到文件,然后处理文件的内容。

I would suggest using the --xml-ui flag to tell CBMC that you would like machine processable output. 我建议使用--xml-ui标志告诉CBMC您想要机器可处理的输出。

CBMC can also produce JSON output using --json-ui since version 5.5, which is more compact than the XML output. 从5.5版开始,CBMC还可以使用--json-ui生成JSON输出,该输出比XML输出更紧凑。 Also note that you can suppress certain messages by adjusting the verbosity level using --verbosity <some number between 0 and 10> . 另请注意,您可以使用--verbosity <some number between 0 and 10>来调整详细程度,从而抑制某些消息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM