天天看點

Purify使用指南

  • 1. 簡介
  • 2. 安裝
    • 2.1. 安裝license
    • 2.2. 安裝Purify
  • 3. 使用
    • 3.1. 檢視幫助
    • 3.2. 使用步驟   ATTACH
    • 3.3. 檢視BUG   ATTACH
    • 3.4. 定位BUG在源代碼中的位置   ATTACH
    • 3.5. 查找洩漏的記憶體   ATTACH
    • 3.6. 修改BUG   ATTACH
    • 3.7. 隐藏消息   ATTACH
  • 4. 儲存/載入結果
    • 4.1. 儲存結果
    • 4.2. 載入結果
  • 5. API
  • 6. 指令選項
    • 6.1. Build-time options
    • 6.2. Runtime options

1 簡介

Purify是IBM開發的,用于定位C、C++代碼中bug和記憶體洩漏位置的自動化工具。

Purify的特點有:

  • Purify會檢查程式運作時用到的所有代碼,包括程式本身的代碼,作業系統提供的代碼和第三方庫的代碼。
  • Purify支援對多程序和對線程的程式進行檢測。
  • Purify支援windows,linux和UNIX平台。

2 安裝

2.1 安裝license

  1. 運作腳本license_setup
    [cnaps2]:/home/cnaps2/PurifyPlus.7.0.1.0-006>./license_setup      
  2. 按回車繼續
    ------------------------------------------------------------------------------
    License Setup                  IBM Corporation                 Version: 2.198
    ------------------------------------------------------------------------------
    
                                  Using License Setup
    
        You are running the license_setup command as cnaps2.
    
        Output from license_setup will be copied to a log file.  When you exit
        license_setup or license_setup completes, the location of the log file
        is displayed.
    
        The -help option can be used to display license_setup command line options.
        All of your inputs will be saved for future runs of license_setup.
    
        You can enter a q, q! or ? at any prompt:
        q    Will save your inputs and quit license_setup.
        q!   Quit license_setup without saving your inputs.
             Note that the 'Rational' directory is always saved.
        ?    Get help on the current prompt.
    
        Press the Enter key to continue, q to quit license_setup:      
  3.     Rational PurifyPlus for Linux and UNIX - Enter Install Location
    
    Enter the location to install IBM Rational products.
    This will be referred to as the 'Rational' directory.
    In 'Rational' directory, license_setup will create a releases
    directory to keep all of the products by name and version.
    
    For example, in 'Rational'/releases, this install will
    create a 'PurifyPlus.7.0.1.0-006' directory to install
    Rational PurifyPlus for Linux and UNIX 7.0.1.0-006.
    
    The 'Rational' directory must be accessible from
    every machine where you plan to run these IBM Rational products.
    The 'Rational' directory path must be identical on each machine.
    Thus, an automount path like /tmp_mnt/rational should not be used
    because you cannot access this directory from every machine.
    
    Checking for 'Rational' directories..  None found.
    
    Press the Enter key to continue, q to quit license_setup:      
  4. 輸入安裝将要安裝Purify的目錄
        Rational PurifyPlus for Linux and UNIX - Enter Install Location
    
    Enter the location to install IBM Rational products.
    This will be referred to as the 'Rational' directory.
    In 'Rational' directory, license_setup will create a releases
    directory to keep all of the products by name and version.
    
    For example, in 'Rational'/releases, this install will
    create a 'PurifyPlus.7.0.1.0-006' directory to install
    Rational PurifyPlus for Linux and UNIX 7.0.1.0-006.
    
    The 'Rational' directory must be accessible from
    every machine where you plan to run these IBM Rational products.
    The 'Rational' directory path must be identical on each machine.
    Thus, an automount path like /tmp_mnt/rational should not be used
    because you cannot access this directory from every machine.
    
    Checking for 'Rational' directories..  None found.
    
    Press the Enter key to continue, q to quit license_setup: 
    
    Enter 'Rational' directory: /home/cnaps2      
  5. 按1接收許可協定
              Initializing AIX JRE to display license agreement...
        Done.
    
        Please ignore the messages related to 'Could not lock System prefs.'
        It is a known issue with the JRE on AIX.
    
        Running LAP Tool:
    /home/cnaps2/releases/jre142.aix/jre/bin/java -classpath extras/LAP/lib/lapapp.jar:extras/LAP/lib/i18n.jar:/home/cnaps2/sqllib/java/db2java.zip:/home/cnaps2/sqllib/java/sqlj.zip:/home/cnaps2/sqllib/function:/home/cnaps2/sqllib/java/db2jcc_license_cu.jar:/home/cnaps2/sqllib/tools/clpplus.jar:/home/cnaps2/sqllib/tools/antlr-3.2.jar:/home/cnaps2/sqllib/tools/jline-0.9.93.jar:/home/cnaps2/sqllib/java/db2jcc.jar:. com.ibm.lex.lapapp.LAP -l extras/LAP/LA_files -text_only -s /home/cnaps2/releases/PurifyPlus.7.0.1.0-006
    ------------------------------------------------------------------------------
    重要資訊:請仔細閱讀
    
    下面提供了兩個許可協定。
    
    1. 評估程式的國際許可協定
    2. 國際程式許可協定
    
    如果被許可方為了生産性使用目的(而不是為了評估、測試、試用“先試後
    買”或示範)獲得本程式,單擊下面的“接受”按鈕即表示被許可方接受 
    國際程式許可協定,且不作任何修改。
    
    如果被許可方為了評估、測試、試用“先試後買”或示範(統稱為“評
    估”)目的獲得本程式:單擊下面的“接受”按鈕即表示被許可方同時接受
    (i)評估程式的國際許可協定(“評估許可”),且不作任何修改;和
    (ii)國際程式許可協定(“IPLA”),且不作任何修改。
    
    
    按 Enter 鍵繼續檢視本許可協定或按 "1" 接受本協定,按 
    "2" 拒絕本協定,按 "3" 列印本協定,按 "5" 用英語查
    看,或按 "99" 回到上一螢幕。
    1      
  6. 按1選擇Rational PurifyPlus for Linux and UNIX
              cnaps2 accepts the license agreement on 公元2014年07月31日  星期四  17時25分22秒.
    ------------------------------------------------------------------------------
                        Rational PurifyPlus for Linux and UNIX 
                   Product and License Configuration Selection Menu 
    
        Make a selection that best describes your desired license set up.
    
        Enter option 1 if you are doing license set up for:
          Rational PurifyPlus for Linux and UNIX
    
        Enter option 2 if you are doing license set up for:
          Rational Purify/Quantify/PureCoverage
    
        You can only select one item from the list.
        These products require FLEXlm licensing.  Enter option 'e' to see the
        specific FLEXlm licenses for each product.
    
            PurifyPlus or Individual License Configuration:
        1)  Rational PurifyPlus for Linux and UNIX 
        2)  Rational Purify/Quantify/PureCoverage Individual Licensing 
        3)  License setup only - IBM Rational products 
    
        e)  Explain what licenses are needed for each product.
        d)  Download the latest version of the license_setup command from
            ftp.software.ibm.com and run it.
        b)  Back to the previous menu.
        q)  Quit license_setup.  Enter q! to quit without saving your inputs.
        ?)  Help.
    
        Enter option: [e] 1      
  7. 按2選擇設定license檔案
        Enter option: [e] 1
    
        Installing: FLEXlm 11.8 for Solaris SPARC...
        from: /home/cnaps2/PurifyPlus.7.0.1.0-006/extras/flexlm.sol
          to: /home/cnaps2/base/cots/flexlm.11.8/sun4_solaris2
    
        Installing: FLEXlm 11.8 for Solaris x64...
        from: /home/cnaps2/PurifyPlus.7.0.1.0-006/extras/flexlm.solaris_x64
          to: /home/cnaps2/base/cots/flexlm.11.8/solaris_x64
    
        Installing: FLEXlm 11.8 for AIX...
        from: /home/cnaps2/PurifyPlus.7.0.1.0-006/extras/flexlm.aix
          to: /home/cnaps2/base/cots/flexlm.11.8/rs6k_aix
    
        Installing: FLEXlm 11.8 for Linux...
        from: /home/cnaps2/PurifyPlus.7.0.1.0-006/extras/flexlm.i386_linux2
          to: /home/cnaps2/base/cots/flexlm.11.8/i386_linux2
    ------------------------------------------------------------------------------
    
                          PurifyPlus - Licensing Options Menu
    
        Select one of the following 2 licensing options.
    
         1)  Use an existing IBM Rational license file (permanent or temporary) or license
             server for PurifyPlus 7.0.1.0-006.
         2)  Set up a license server using a permanent or term-license-agreement (TLA) license.
             You need a .upd license file to import into license_setup.
    
         b)  Back to the previous menu.
         e)  Explain the licensing options in more detail.
         q)  Quit license_setup.  Enter q! to quit without saving your inputs.
    
        Enter license option: [e] 2      
  8. 輸入license檔案的路徑
      ------------------------------------------------------------------------------
    
                          PurifyPlus - Import Licenses
    
    The import file you specify should be from a file you saved from an
    e-mail message you received from IBM.  This is not the
    license file license_setup will set up.  It is the license information this
    program will import to make decisions about what product(s) you
    have licensed and how the licenses should be set up with as a FLEXlm
    license server.
    
    The file is called something like license_for_server.upd.
    The file must contain FLEXlm SERVER and INCREMENT lines for
    PurifyPlus.
    
    Currently, license_setup cannot import a redundant server license file.
    
    If you do not have a .upd file to import licenses from, enter none.
    
    File to import from: [none] /home/cnaps2/PurifyPlus.7.0.1.0-006/IBM.Rational.PurifyPlus.v7.1.lic.eval.upd      
  9. 選擇1檢查license檔案
                            PurifyPlus - License Check Menu
    
    ---> 1)  Check license keys in:
             /home/cnaps2/PurifyPlus.7.0.1.0-006/IBM.Rational.PurifyPlus.v7.1.lic.eval.upd
             Will check for these licenses:
    
    License Feature                  Description
    PurifyPlusUNIX                   Rational PurifyPlus for UNIX
    DevelopmentStudioUNIX            Rational Suite DevelopmentStudio for UNIX
    DevelopmentStudioUNIXRT          Rational Suite DevelopmentStudio RealTime for
                                       UNIX
    purecov                          Rational PureCoverage for UNIX
    purify                           Rational Purify for UNIX
    quantify                         Rational Quantify for UNIX 
    
         The license server is not needed for uncounted licenses:
    
         2)  No need to start or restart the license server.
    
         3)  No need to check license server using lmstat--licenses are uncounted.
    
         4)  License settings for PurifyPlus up-to-date.
    
         b)  Back to the previous menu.
         q)  Quit license_setup.  Enter q! to quit without saving your inputs.
         ?)  Help.
    
        Enter menu option: [1]      
  10. license檔案檢查通過後按回車繼續
        Will check for these specific licenses:
    
    License Feature                  Description
    PurifyPlusUNIX                   Rational PurifyPlus for UNIX
    DevelopmentStudioUNIX            Rational Suite DevelopmentStudio for UNIX
    DevelopmentStudioUNIXRT          Rational Suite DevelopmentStudio RealTime for
    								   UNIX
    purecov                          Rational PureCoverage for UNIX
    purify                           Rational Purify for UNIX
    quantify                         Rational Quantify for UNIX
    
        Searching for 'ibmratl' specific license keys in:
          /home/cnaps2/PurifyPlus.7.0.1.0-006/IBM.Rational.PurifyPlus.v7.1.lic.eval.upd
        No ibmratl specific licenses found.
    
        Searching for 'rational' specific license keys...
        One rational specific license found.
    
        All 'rational' license keys are okay in:
          /home/cnaps2/PurifyPlus.7.0.1.0-006/IBM.Rational.PurifyPlus.v7.1.lic.eval.upd
    
        Searching for 'telelogic' specific license keys...
        No telelogic specific licenses found.
    
        Press the Enter key to continue, q to quit license_setup:      
  11. 按q退出,自此license安裝完畢
                            PurifyPlus - License Check Menu
    
         1)  Check license keys in:
             /home/cnaps2/PurifyPlus.7.0.1.0-006/IBM.Rational.PurifyPlus.v7.1.lic.eval.upd 
    
         The license server is not needed for uncounted licenses:
    
         2)  No need to start or restart the license server.
    
         3)  No need to check license server using lmstat--licenses are uncounted.
    
         4)  License settings for PurifyPlus up-to-date.
    
         b)  Back to the previous menu.
    ---> q)  Quit license_setup.  Enter q! to quit without saving your inputs.
         ?)  Help.
    
        Enter menu option: [q]      

2.2 安裝Purify

  1. 運作rs_install
    [cnaps2]:/home/cnaps2/PurifyPlus.7.0.1.0-006>./rs_install
    ------------------------------------------------------------------------------
    RS Install                     IBM Corporation                 Version: 2.198
    ------------------------------------------------------------------------------
    
                                    Using RS Install
    
        You are running the rs_install command as cnaps2.
    
        Output from rs_install will be copied to a log file.  When you exit
        rs_install or rs_install completes, the location of the log file
        is displayed.
    
        The -help option can be used to display rs_install command line options.
        All of your inputs will be saved for future runs of rs_install.
    
        You can enter a q, q! or ? at any prompt:
        q    Will save your inputs and quit rs_install.
        q!   Quit rs_install without saving your inputs.
             Note that the 'Rational' directory is always saved.
        ?    Get help on the current prompt.
    
        Press the Enter key to continue, q to quit rs_install:      
  2. ------------------------------------------------------------------------------
    
            Rational PurifyPlus for Linux and UNIX - Enter Install Location
    
        Enter the location to install IBM Rational products.
        This will be referred to as the 'Rational' directory.
        In 'Rational' directory, rs_install will create a releases
        directory to keep all of the products by name and version.
    
        For example, in 'Rational'/releases, this install will
        create a 'PurifyPlus.7.0.1.0-006' directory to install
        Rational PurifyPlus for Linux and UNIX 7.0.1.0-006.
    
        The 'Rational' directory must be accessible from
        every machine where you plan to run these IBM Rational products.
        The 'Rational' directory path must be identical on each machine.
        Thus, an automount path like /tmp_mnt/rational should not be used
        because you cannot access this directory from every machine.
    
        Checking for 'Rational' directories..  One found.
    
        Enter 'Rational' directory: [/home/cnaps2]      
  3. 輸入安裝目錄
    Enter 'Rational' directory: [/home/cnaps2] /home/cnaps2      
  4. 選擇1Rational PurifyPlus for Linux and UNIX
        cnaps2 accepted the license agreement on 公元2014年07月31日  星期四  17時25分22秒.
    ------------------------------------------------------------------------------
                        Rational PurifyPlus for Linux and UNIX 
                   Product and License Configuration Selection Menu 
    
        Make a selection that best describes your desired installation.
    
        Enter option 1 if you are installing and have a license for:
          Rational PurifyPlus for Linux and UNIX
    
        Enter option 2 if you are installing and have a license for:
          Rational Purify/Quantify/PureCoverage
    
        You can only select one item from the list.
        These products require FLEXlm licensing.  Enter option 'e' to see the
        specific FLEXlm licenses for each product.
    
            PurifyPlus or Individual License Configuration:
    --> 1)  Rational PurifyPlus for Linux and UNIX 
        2)  Rational Purify/Quantify/PureCoverage Individual Licensing 
        3)  License setup only - IBM Rational products 
    
        e)  Explain what licenses are needed for each product.
        d)  Download the latest version of the rs_install command from
            ftp.software.ibm.com and run it.
        b)  Back to the previous menu.
        q)  Quit rs_install.  Enter q! to quit without saving your inputs.
        ?)  Help.
    
        Enter option: [1] 1      
  5. 輸入yes,表示使用之前標明的license檔案
        Installed: FLEXlm 11.8 for Solaris SPARC
    
        Installed: FLEXlm 11.8 for Solaris x64
    
        Installed: FLEXlm 11.8 for AIX
    
        Installed: FLEXlm 11.8 for Linux
    
        Installed: FLEXlm 11.8 for Solaris SPARC
    
        Installed: FLEXlm 11.8 for Solaris x64
    
        Installed: FLEXlm 11.8 for AIX
    
        Installed: FLEXlm 11.8 for Linux
    
        Checking if PurifyPlus license is configured:
    Rational PurifyPlus for UNIX
          yes: /home/cnaps2/PurifyPlus.7.0.1.0-006/IBM.Rational.PurifyPlus.v7.1.lic.eval.upd  (Has product licenses)
    
        Found one license file:
    
        /home/cnaps2/PurifyPlus.7.0.1.0-006/IBM.Rational.PurifyPlus.v7.1.lic.eval.upd contains:
        License: PurifyPlusUNIX  Evaluation key expires: 15-aug-2014  
    
        Would you like to configure PurifyPlus
        to use this license file? [yes] yes      
  6. 輸入1,安裝預設元件
                     PurifyPlus - Typical/Custom Install Preference
    
        Choose the install option you prefer:
    
    ---> 1)  Typical      Install recommended product components.
    
         2)  Custom       Select specific product components to install.
    
         b)  Back to the previous menu.
         f)  Forward to install and post-install PurifyPlus now.
         q)  Quit rs_install.  Enter q! to quit without saving your inputs.
         ?)  Help.
    
        Enter install preference: [1]      
  7. 選擇f,表示确定
    ------------------------------------------------------------------------------
    
                     PurifyPlus - Typical/Custom Install Preference
    
        Choose the install option you prefer:
    
         1)  Typical      Install recommended product components.
    
         2)  Custom       Select specific product components to install.
    
        You have chosen to do a typical install.
    
         b)  Back to the previous menu.
    ---> f)  Forward to install and post-install PurifyPlus now.
         q)  Quit rs_install.  Enter q! to quit without saving your inputs.
         ?)  Help.
    
        Enter install preference: [f]      
  8. Purify會自動檢測作業系統,并安裝相應版本的程式
    ------------------------------------------------------------------------------
    
                                  Documentation Table
    
        The docs/ directory on the release media contains the on-line
        documentation for the product.  This may include the installation
        guide, release note, getting started docs or on-line help.
    
             Install?   Size (KB)  Product Documentation
             --------   ---------  ---------------------
         1)       yes       14164  Documents in HTML. (Documentation)
         2)       yes        3756  Documents for Adobe Acrobat reader. (Documentation)
         3)       yes           1  Rs Help List (Documentation)
             --------   ---------  ---------------------
                  all       17921  Total (does not account for documents
                                          already installed.)
    
        Updating:   /home/cnaps2/config/PurifyPlus_License_Map [rev 198]
    Rational PurifyPlus for UNIX
    ------------------------------------------------------------------------------
    
    
       ......
    
        Creating/updating setup files
        in /home/cnaps2/releases/PurifyPlus.7.0.1.0-006...
             Created: purifyplus_setup.csh in PurifyPlus.7.0.1.0-006
             Created: purifyplus_setup.sh in PurifyPlus.7.0.1.0-006
    
        You can source the setup file to help you start the programs in this
        install.  If you are installing this for users in addition to yourself
        you will want to have them add one of these commands to their login
        environment.
    
        Users of csh, tcsh and other csh-compatible shells do this:
    
    source /home/cnaps2/purifyplus_setup.csh
    
        Users of sh, ksh, bash and other bourne-compatible shells do this:
    
    . /home/cnaps2/purifyplus_setup.sh
    
    ------------------------------------------------------------------------------
        The rs_install command completed successfully.
        Defaults saved in:
        /home/cnaps2/config/defaults/rs_install.PurifyPlus.7.0.1.0-006.cnaps2
        rs_install log file:
        /home/cnaps2/releases/PurifyPlus.7.0.1.0-006/rs_install.L2601H8.cnaps2.log
    
        End of rs_install.      

3 使用

3.1 檢視幫助

  • 使用web浏覽器檢視幫助文檔

    purify -onlinehelp

  • 檢視完整的線上幫助

    菜單Help>Help topics

    菜單Help>On window

    菜單Help>On content

3.2 使用步驟   ATTACH

  1. 隻要将purify放在普通的編譯/連結指令前
    purify cc -g hello.c      
    若編譯和連結是分成不同的步驟分布進行的,則隻需要将purify放在連結操作前即可.
    cc -c -g hello.c
    purify cc -g hello.o      
  2. 執行編譯出來的程式.

    程式會照常運作,并顯示Purify Viewer視窗展示找到的BUG.

    值得一提的是,Purify在找到BUG後并不會暫停程式的執行,程式的啟動,運作,退出與原程式一般無疑.

    Purify使用指南

3.3 檢視BUG   ATTACH

NOTE: Purify Viewer一次隻顯示一個可執行程式的資訊. 它會指明所顯示的可執行程式名稱,所處于的目錄和執行該程式的使用者ID

Purify使用指南

3.4 定位BUG在源代碼中的位置   ATTACH

NOTE: 若在編譯時使用了-g選項,則Purify View會顯示BUG所在的源檔案,行号和涉及的變量名. 若沒有帶-g選項,則隻能顯示檔案名和函數名.

Purify使用指南

3.5 查找洩漏的記憶體   ATTACH

當程式退出,Purify會查找洩漏的記憶體并給出未釋放的記憶體報告.

Purify将記憶體分為三個狀态,每個狀态都會統計記憶體塊的數量和大小.

  • Leaked memory

    沒有指針指向這塊記憶體

  • Potentially Leaked memory

    沒有指針指向這塊記憶體的頭部,但是有指針指向這塊記憶體的内部.

  • Memory in use

    有指針指向的記憶體塊(不存在洩漏的情況)

NOTE: 若運作的是一個需要長期不退出的程式,可以在程式尚在運作時,通過單擊菜單欄中的`New Leaks tool`按鈕來産生記憶體洩漏的情況報告.

Purify使用指南

3.6 修改BUG   ATTACH

按下Edit tool按鈕(工具欄第5個按鈕顯示是一支筆寫文檔)會打開編輯器供你修改源代碼

NOTE: 預設情況下,Purify View隻顯示7行相關的源代碼. 但你可以通過修改Xresource來修改顯示的行數

3.7 隐藏消息   ATTACH

若檢測的程式很大,則可能會産生成百上千的關于BUG的資訊報告. 這種情況下,要想快速的定位到最重要的BUG位置,可以隐藏指定類型或來源的資訊.

在Purify viewer中隐藏消息的方法為:

  1. 選擇想隐藏的消息
  2. 選擇菜單Options>Suppressions

    在Message to suppress處選擇要隐藏的消息的類型

    在Where to suppress處選擇要隐藏的消息的來源

    按下左下方的`Make permanent`按鈕會将隐藏配置保持在.purify檔案中

    右下方的`Select File…`按鈕可以選擇保持隐藏配置的.purify檔案

    Purify使用指南

4 儲存/載入結果

Purify可以将檢測的結果儲存到字尾為.pv的Purify View file中, 也可以從Purify View file中載入檢測結果

4.1 儲存結果

  1. 選擇菜單`File>Save As`
  2. 輸入儲存的檔案名,字尾名使用.pv,表示為Purify view file

4.2 載入結果

有兩種方式載入結果檔案

  1. 從View中選擇菜單`File>Open`,打開Purify view file
  2. 在指令行運作:
    purify -view filename.pv      

5 API

Purify提供了一系列的API可以插入到源代碼中提供更個性化的檢測功能.

要使用Purify API,需要include `<purifyhome>/purify.h`并且連結庫`<purifyhome/purify_stubs.a>`

Table 1: Purify API簡要說明

Commonly used API functions Description
int purify_describe (char *addr) Prints specific de tails about memory
int purify_is_running (void) Returns "TRUE" if the program is instrumented
int purify_new_inuse (void) Prints a message on all memory newly in use
int purify_new_leaks (void) Prints a message on all new leaks
int purify_new_fds_inuse (void) Lists the new open file descriptors
int purify_printf (char *format, …) Prints formatted text to the Viewer or log-file
int purify_watch (char *addr) Watches for memory write ,  malloc, free
int purify_watch_n (char *addr, int size, char *type) Watches memory: type = " r", "w", "rw"
int purify_watch_info (void) Lists active watchpoints
int purify_watch_remove (int watchno) Removes a specified watchpoint
int purify_what_colors (char *addr, int size) Prints the color coding of memory

6 指令選項

6.1 Build-time options

purify -cache-dir=$HOME/cache -always-use-cache-dir cc -o hello hello.c      

Table 2: Build-time options說明

options 說明 預設值
-always-use-cache-dir Forces all instrumented object files to be written to the global cache directory no
-cache-dir Specifies the global directory where Purify caches instrumented object files <purifyhome>/cache
-ignore-runtime-environment Prevents the runtime Purify environment from overriding the option values used in building the program
-linker Sets the alternative linker to build the executables instead of the system default system-dependent
-print-home-dir Prints the name of the directory wher e Purify is installed, then exits

6.2 Runtime options

setenv PURIFYOPTIONS "-log-file=mylog.%v.%p ‘printenv PURIFYOPTIONS‘"      

Table 3: 常用Runtime options說明

選項
-auto-mount-prefix Removes the prefix used by file system auto-mounters /tmp_mnt
-chain-length Sets the maximum number of stack frames to print in a report 6
-fds-in-use-at-exit Specifies that the file descriptor in us e message be displaye d at program exit yes
-follow-child-processes Controls whether Purify monitors child  processes in an instrumented program
-jit-debug Enables just-in-time debugging none
-leaks-at-exit Reports all leaked memory at program exit
-log-file Writes Purify output to a log file instead of the Viewer  window stderr
-messages Controls display of repeated messages:  "first",  "all" , or in a  "batch" at program exit first
-program-name Specifies the full pathname of  the instrumented program if  argv[ 0] contains an undesirable or incorrect value argv[ 0]
-show-directory Shows the directory path for each file in the call chain, if the information is available
-show-pc Shows the full pc value in each frame of the call chain
-show-pc-offset Appends a pc-offset to each function name in the call chain
-view-file Saves Purify output to a view file ( .pv ) instead of the Viewer .
-user-path Specifies a list of directories in which to search for programs and source code
-windows Redirects Purify output to stderr instead of the  Viewer  if -windows=no