Myeclipse如何跟蹤調試

來源:互聯網
上載者:User

在Myeclipse下如何跟蹤調試,只要採用以下步驟就行:

 

1 在建立好的工程下面:

要先debug as -> java application
2 然後再設定斷點。
3 最後在啟動,並在瀏覽器上運行即可,當程式走到斷點處就會轉到debug視圖下,

以下說明:

如何設定斷點?

    雙擊程式碼首位置即可,再次雙擊即取消斷點。

 

以下內容如何設定(借鑒他人的):

1、條件斷點 2、變數斷點 3、方法斷點 4、改變變數值 5、重新調試 6、遠端偵錯 7、異常斷點

(這7點內容參考網址:http://www.javaeye.com/topic/633824)

 

功能鍵說明:

2, F5鍵與F6鍵均為單步調試,F5是step into,也就是進入本行代碼中執行,F6是step over,

也就是執行本行代碼,跳到下一行,
3,F7是跳出函數 step return
4,F8是執行到最後。

=====================================

1.Step Into (also F5)
跳入

2.Step Over (also F6) 跳過
3.Step Return (also F7) 執行完當前method,然後return跳出此method
4.step Filter 逐步過濾 一直執行直到遇到未經過濾的位置或斷點(設定Filter:window-preferences-java-Debug-step Filtering)
5.resume 重新開始執行debug,一直運行直到遇到breakpoint
6.hit count 設定執行次數 適合程式中的for迴圈(設定 breakpoint view-右鍵hit count)
7.inspect 檢查 運算。執行一個運算式顯示執行值
8.watch 即時地監視變數的變化
9.我們常說的斷點(breakpoints)是指line breakpoints,除了line breakpoints,還有其他的斷點類型:field(watchpoint)breakpoint,method breakpoint,exception breakpoint.
10.field breakpoint 也叫watchpoint(監視點) 當成員變數被讀取或修改時暫掛
11.添加method breakpoint 進入/離開此方法時暫掛(Run-method breakpoint)
12.添加Exception breakpoint 捕抓到Execption時暫掛(待續...)
斷點屬性:
1.hit count 執行多少次數後暫掛 用於迴圈
2.enable condition 遇到符合你輸入條件(為ture\改變時)就暫掛
3.suspend thread 多線程時暫掛此線程
4.suspend VM 暫掛虛擬機器
13.variables 視圖裡的變數可以改變變數值,在variables 視圖選擇變數點擊右鍵--change value.一次來進行快速調試。
14.debug 過程中修改了某些code後--〉save&build-->resume-->重新暫掛於斷點

===========================
例如你有如下程式:
public static void main(String args[]) {

MyDate aa = new MyDate();
aa.addDays(day);                      =============》(1)
System.out.println("eeeeeeeeeeeeeee");=============》(2)
}

public String addDays(int more_days) {
System.out.println("1");               =============》(3)
String result = "";         =============》(4)
System.out.println("2");               =============》(5)
return result;
}

你在(1)處加斷點,運行到此處時如果Step Into (also F5)為跳入,則接著執行到(3)。再執行Step Over (also F6)執行本行,則執行到(4)。最後執行Step Return (also F7),則跳出addDays方法,跳到(2)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.