1. 程式人生 > >高效程式碼靜態分析 Scientific Toolworks Understand

高效程式碼靜態分析 Scientific Toolworks Understand

原文地址:https://www.luochenzhimu.com/archives/4920.html

原始碼閱讀工具(Scientific Toolworks Understand)的特色

1、支援多語言:Ada, C, C++, C#, Java, FORTRAN, Delphi, Jovial, and PL/M ,混合語言的project也支援
2、多平臺: Windows/Linux/Solaris/HP-UX/IRIX/MAC OS X
3、程式碼語法高亮、程式碼折迭、交叉跳轉、書籤等基本閱讀功能。
4、可以對整個project的architecture、metrics進行分析並輸出報表。
5、可以對程式碼生成多種圖(butterfly graph、call graph、called by graph、control flow graph、UML class graph等),在圖上點選節點可以跳轉到對應的原始碼位置。
6、提供Perl API便於擴充套件。作圖全部是用Perl外掛實現的,直接讀取分析好的資料庫作圖。
7、內建的目錄和檔案比較器。
8、支援project的snapshot,並能和自家的TrackBack整合便於監視project的變化。

匯入專案

匯入專案有兩種方法,一種是從選單欄點選File–>New–>Project,另一種是點選下面介面中間的New Project

點選後,會進入到如下介面,你可以更改專案名稱為你要匯入的專案名稱,以便於以後查詢,你可以直接匯入你正在開發的專案,你的程式碼更改後,這個專案也會自動更新,方便你快速開發,不需要每次匯入。

更改名稱後點擊Next進入如下介面,這個介面是讓你選擇你要匯入專案包含了哪幾種語言,注意,在C/C++後面有兩種模式,下面有註釋,其中Strict模式包含Object-C和Object—C++,還有Web的註釋,自己看看就好了,在此就不再解釋,

然後點選Next進入下面介面:

在此介面點選上面的“Add a Directory”,也就是新增你要匯入專案的路徑,點選後會彈出如下介面,此時有個奇葩就是彈出的介面會被上圖介面遮擋,此時你要移開該介面,然後會出現下面介面:

點選後面的帶有三個點的按鈕選擇你要加入的專案資料夾,此處不用開啟資料夾,只要點中資料夾點選open按鈕:

此時只需要點選OK即可,介面會跳轉到如下介面:

此時有兩個選項,一個是立即分析程式碼,一個選擇配置,對於我們來說只需要預設即可,然後點選OK按鈕,此時軟體開始分析程式碼,分析完成後會出現如下介面:

左側會出你的專案結構,中間出現你專案的名稱,此時你可以操作左面專案來檢視相關程式碼,如下圖所示:

這麼多類和方法如何快速定位,那肯定是搜尋,該軟體針對不同位置,不同屬性有不同的搜尋方法,下面介紹搜尋功能。

搜尋功能

1.左側專案結構中搜索:在這個搜尋中你可以快速搜尋你要檢視的類,快捷鍵,滑鼠點選左側上面專案結構視窗,然後按command + F鍵會出現如下圖所示的搜尋框,在框中輸入你想要的類回車即可

2.類中方法搜尋:將滑鼠定位到右側程式碼中,點選command + F,會彈出搜尋框,輸入方法回車即可:
 

3.在檔案中搜索:也就是全域性搜尋,快捷鍵F5或者去上面選單欄中的search欄中查詢,輸入你想要的類或者方法,回車查詢,下面會列出所有使用的地方:

4.實體類查詢:軟體選單欄search中最後一項–Find Entity,點選輸入你要查詢的實體類,回車查詢:

快速搜尋是軟體快速使用必備的技能,包括我們常用的idea一樣,快速定位類,方法,常量等,可以快速幫助我們解決問題。

上面我介紹改軟體時提到可以繪製流程圖等功能,下面就針對這個功能介紹一些一些圖形的繪製功能,幫助你快速分析程式碼。

專案檢視

專案檢視包含很多的功能,能夠自動生成各種流程圖結構圖,幫助你快速理清程式碼邏輯、結構等,以便快速理解專案流程,快速開發,檢視檢視方式有兩種,一種是滑鼠點選你要檢視的類或者方法等上面,然後右鍵彈出選單,滑鼠移動到Graphical Views,然後彈出二級選單,如下圖所示:

另一種方式是點選要檢視的類或者方法,然後找到程式碼上面選單欄中的如下圖示:

然後點選圖示右下角的下拉箭頭,彈出如下選單,即可選擇檢視相關檢視:

層級關係檢視分類:

1.Butterfly:如果兩個實體間存在關係,就顯示這兩個實體間的呼叫和被呼叫關係;如下圖為Activity中的一個方法的關係圖:

2.Calls:展示從你選擇的這個方法開始的整個呼叫鏈條;

3.Called By:展示了這個實體被哪些程式碼呼叫,這個結構圖是從底部向上看或者從右到左看;

4.Calls Relationship/Calledby Relationship:展示了兩個實體之間的呼叫和被呼叫關係,操作方法:首先右鍵你要選擇的第一個實體,然後點選另一個你要選擇的實體,如果選擇錯誤,可以再次點選其他正確即可,然後點選ok;

5.Contains:展示一個實體中的層級圖,也可以是一個檔案,一條連線線讀作”x includes y“;

6.Extended By:展示這個類被哪些類所繼承,

7.Extends:展示這個類繼承自那個類:

結構關係檢視分類:

1.Graph Architecture:展示一個框架節點的結構關係;

2.Declaration:展示一個實體的結構關係,例如:展示引數,則返回型別和被呼叫函式,對於類,則展示私有成員變數(誰繼承這個類,誰基於這個類)

3.Parent Declaration:展示這個實體在哪裡被聲明瞭的結構關係;

4.Declaration File:展示所選的檔案中所有被定義的實體(例如函式,型別,變數,常量等);

5.Declaration Type:展示組成型別;

6.Class Declaration:展示定義類和父類的成員變數;

7.Data Members:展示類或者方法的組成,或者包含的型別;

8.Control Flow:展示一個實體的控制流程圖或者類似實體型別;

9.Cluster Control Flow:展示一個實體的流程圖或者類似實體型別,這個比上一個更具有互動性;

10.UML Class Diagram:展示這個專案中或者一個檔案中定義的類以及與這個類關聯的類

11.UML Sequence Diagram:展示兩個實體之間的時序關係圖;

12.Package:展示給定包名中宣告的所有實體

13.Task:展示一個任務中的引數,呼叫,實體

14.Rename Declaration:展示實體中被重新命名的所有實體

Code Knowledge

Understand provides you with pertinent information regarding your code. Quickly see all information on functions, classes, variables, etc., how they are used, called, modified, and interacted with. Easily see call trees, metrics, references and any other information you would want to know about your code.

Metrics & Reports

Understand is very efficient at collecting metrics about the code and providing different ways for you to view it. There is a substantial collection of standard metrics quickly available as well as options for writing your own custom metrics when we don’t cover exactly what you need.

Graphing

Understand offers graphs that allow you to see how your code connects (dependencies), how it flows (control flow graphs), what functions call other functions (call graphs), and many more. There are many customization options to easily allow you to display only what you are interested in seeing so the graph is best suited to what you need.

Standards Testing

Understand provides a way to check your code using published coding standards, or your own custom standards. These checks can be used to verify naming guidelines, metric requirements, published best practices, or any other rules or conventions that are important for your team.

Dependency Analysis

See all the dependencies in your code and how they connect. See these dependencies using Understand’s interactive graph or using the textual Dependency Browser. Both allow you to see all dependencies quickly and easily at a high level or dig in and get the details.

Editor

Understand’s powerful editor is a full modern programming GUI that incorporates all the modern features you would expect. It is designed from the ground-up for multi-monitor use and it includes tabs, tab groups, docking, syntax colorization, auto-completion, and syntax-based collapsing and folding just to name a few.

Search

Multiple options are available for searching in Understand. For instant results, use our “Instant Search” feature which provides results before you are even done typing. Understand also provides search options for more customized and complicated searches, such as Regular Expression and Wildcard searches.

Languages

Understand supports more than a dozen languages and can handle code bases that are written in multiple languages. This allows you to see calls and dependencies between languages so you can get information about the complete system.

Home Page: https://scitools.com

下載地址

高效程式碼靜態分析 Scientific Toolworks Understand 5.0.967 Windows/Linux/macOS
官方下載:
understand-macosx.zip
Understand-5.0.967-MacOSX-x86.dmg
Understand-5.0.967-Linux-32bit.tgz
Understand-5.0.967-Linux-64bit.tgz
Understand-5.0.967-Windows-32bit.exe
Understand-5.0.967-Windows-32bit.zip
Understand-5.0.967-Windows-64bit.exe
Understand-5.0.967-Windows-64bit.zip
落塵之木:https://pan.luochenzhimu.com/disk/software/Understand/Understand_v5.0.967/
百度網盤:https://pan.baidu.com/s/180pMdI9op3Y2kw4u6Mq1kQ