Debugging, Profiling, Code improvement tools
  • Introduction
  • Chapter1: 追蹤問題
    • 1.1.找出錯誤來源
  • Chapter2: 解決問題
    • 2.1.Check list
      • 2.1.1.確認前後條件
  • Chapter3: 錯誤訊息
    • 3.1.python
      • 'charmap' codec can't decode byte 0x8f in position 17: character maps to <undefined>
  • Chapter4:版本管理工具
    • 4.1.Git
      • 4.1.1.Working tree, Index/Cache, Repository and Object
      • 4.1.2.commit
      • 4.1.3.cherry-pick
      • 4.1.4.rebase
    • 4.2.TortoiseGit
      • 4.2.1.bisect
      • 4.4.2.reflog & reset
      • 4.2.3.blame
  • Chapter5: 除錯工具
    • 5.1.Visual studio
      • 5.1.1.輸出debug訊息
      • 5.1.2.中斷點
      • 5.1.3.載入符號, 檢視堆疊
      • 5.1.4.追蹤點
      • 5.1.5.單步執行程式
      • 5.1.6.日誌
      • 5.1.7.靜態程式分析
    • 5.2. WinDbg
      • 5.2.1.安裝WinDbg
      • 5.2.2.設定project及symbol path
      • 5.2.3.分析.dmp file
    • 5.3.API
      • 5.3.1.核心傾印
  • Chapter6: 效能分析工具
    • 6.1.Introduction
    • 6.2.Windows
      • 6.2.1.效能分析指標
      • 6.2.2.Windows Performance Monitor
      • 6.2.3.Process monitor
      • 6.2.4.Windows Performance Toolkit
    • 6.3.C++ project
      • 6.3.1.SMART BEAR AQ Time
    • 6.4.Python project
      • 6.4.1.cProfile, snakeviz
  • Chapter7: 程式碼優化工具
    • 7.1.Python
      • 7.1.1.vulture
Powered by GitBook
On this page
  • 1.目的
  • 2.作法

Was this helpful?

  1. Chapter2: 解決問題
  2. 2.1.Check list

2.1.1.確認前後條件

Previous2.1.Check listNextChapter3: 錯誤訊息

Last updated 5 years ago

Was this helpful?

1.目的

  • 1.檢視程式的進入點 (前置條件 - 程式的狀態與輸入)

  • 2.檢視程式的離開點 (後置條件 - 程式狀態與回傳值)

2.作法

  • 1.進入點

    • 在程序的開始處或呼叫它的地方或關鍵演算法開始執行處設置

    • 檢驗前置條件是否符合: 包括參數, 被叫用方法的物件與程序使用的全域狀態:

      • 1.是否有不應該為null的值

      • 2.檢查呼叫數學函式的值域 (例如檢查傳給log的值是否大於零)

      • 3.檢查傳給程序的物件, 結構與陣列以驗證其內容是否符合要求, 也可以找出無效的指標

        

        • 例如map是否帶有預期中的鍵和值, 或是否能正確遍歷雙向連結list

      • 4.未初始化的變數通常具有可疑的值, 例如6.89851e-308或61007410

  • 2.離開點

    • 在程序的尾端或呼叫後或關鍵演算法執行完成後設定

    • 檢視程序執行後的效應

      • 1.判斷計算結果是否合理

      • 2.判斷計算結果是否正確

中斷點
中斷點
手動執行程式檢查