一句话:提出原型工具 code2graph,自动分析 Python 源码、构建静态调用图并生成执行路径相似度矩阵。
静态调用图是过程间分析与软件理解工具的基础,但 Python 生态中缺少能自动分析源代码并构建静态调用图的工具。本文提出原型工具 code2graph,可自动完成三项任务:分析 Python 源码并抽取其结构、从源码构建静态调用图、生成系统中所有可能执行路径之间的相似度矩阵。作者的目标有二:帮助开发者理解系统整体结构,并为软件搜索与相似性检测等后续研究提供基础,例如将执行路径聚类为系统的逻辑工作流以自动化特定软件任务。该工具已成功为 TensorFlow、Keras、PyTorch 三个流行开源深度学习项目生成静态调用图与路径相似度矩阵,并提供在线工具演示。
A static call graph is an imperative prerequisite used in most interprocedural analyses and software comprehension tools. However, there is a lack of software tools that can automatically analyze the Python source-code and construct its static call graph. In this paper, we introduce a prototype Python tool, named code2graph, which automates the tasks of (1) analyzing the Python source-code and extracting its structure, (2) constructing static call graphs from the source code, and (3) generating a similarity matrix of all possible execution paths in the system. Our goal is twofold: First, assist the developers in understanding the overall structure of the system. Second, provide a stepping stone for further research that can utilize the tool in software searching and similarity detection applications. For example, clustering the execution paths into a logical workflow of the system would be applied to automate specific software tasks. Code2graph has been successfully used to generate static call graphs and similarity matrices of the paths for three popular open-source Deep Learning projects (TensorFlow, Keras, PyTorch). A tool demo is available at https://youtu.be/ecctePpcAKU.
DOI 原文 ·
@inproceedings{paperbot4717,
title = {Code2graph: automatic generation of static call graphs for Python source code},
author = {Gharib Gharibi and Rashmi Tripathi and Yugyung Lee},
booktitle = {ASE},
year = {2018},
doi = {10.1145/3238147.3240484}
}