如何使用 Soot 创建控制流图? [英] How to create a control-flow graph with Soot?

查看:99
本文介绍了如何使用 Soot 创建控制流图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一段时间以来,我一直在努力使用 Soot 创建控制流图,而我有点迷失在它的教程中.我一直在尝试将 Soot 用作库或 API,而不是将 Soot 用作 Eclipse 插件.

For a while I have been struggling with creating a control-flow graph with Soot and I kinda got lost in its tutorials. Rather than using Soot as an Eclipse plugin, I have been trying to use Soot as a library or API.

我想做的是,我有一堆 Java 项目,我想创建/生成这些项目的控制流图.我还看到 Soot 中有一个功能,我可以生成DOT"格式的控制流图,这对我来说也是可以接受的.

What I want to do is, I have a bunch of Java projects and I want to create/generate a control-flow graph of these projects. I also saw that there is a feature in Soot that I can generate control-flow graphs in "DOT" format, which is quite acceptable for me as well.

任何展示如何使用 Soot 创建/生成控制流图的指南或代码示例都很棒!

Any guide or sample of code that shows how to create/generate a control-flow graph with Soot would be great!

推荐答案

您可以通过创建一个新的 ExceptionalUnitGraph 并将方法的 SootBody 传递给它来创建方法本地 CFG.维基中的烟尘教程向您展示了如何做到这一点.

You can create a method-local CFG by just creating a new ExceptionalUnitGraph, passing it the method's SootBody. The Soot Tutorial in the wiki shows you how to do that.

要获得过程间 CFG,即 ICFG,您可以使用 Soot 扩展 Heros:https://github.com/Sable/heros/blob/develop/src/heros/InterproceduralCFG.java

To get an inter-procedural CFG, i.e., an ICFG, you can use the Soot extension Heros: https://github.com/Sable/heros/blob/develop/src/heros/InterproceduralCFG.java

这篇关于如何使用 Soot 创建控制流图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆