在eclipse中怎麼樣設定斷點,並調試啊~
//===============================
用EclipseMe外掛程式,在preference 裡邊把Java--Debug的Debuger timeout 調到15000ms,同時確認
suspend execution on uncaught exceptions 和suspend executioen on complication
errors沒有被選中,然後debug的時候,debug as Emulated midlet,然後就可以調試了。
為什麼這個debug總是進入一些基礎類庫,而且這些基礎類庫還提示沒有找到,這是為什麼。我不想進入這
些基礎類庫,太多了。調試的我暈頭轉向。
//-----------------------
斷點簡單的解釋就是告訴編譯器在執行到該點(該句)的時候,停一下,方便使用者看看當前的情況,包括
變數等等。
Eclipse的設定斷點很簡單的啊,在java視圖下,直接在你要設定斷點的那行的最左邊,雙擊即可,右鍵也
有這個選項的。
調式 選擇debug即可,自動進入debug視圖,F6單步調式
//-----------------------
在你想調試的程式前的地方雙擊左鍵,就出現了斷電.程式運行到斷電的時候會進入DEBUG模式,可以查看個
個變數的變化,從觀察程式的正確與否
//----------------------- 視窗焦點定位在eclipse,進去後我找不到F5,F6那些調試功能。
在 debug 視圖下你 應該會發現 step into ,step over ..等功能
一般都是設定在擷取值的地方,看得到值沒有或者值有改變沒有
或者還有設定在一個語句處,看能不能運行到這一句
設定了斷點後,eclipse運行程式會到debug介面
斷點資訊和變數值都會在debug視圖中顯示,調試的時候,eclipse會自動的將視圖切換到debug視圖的。
如要調試jsp,需要你設定好應用伺服器,也可以調試的,很方便。
//============================
debugging with eclipse 2.1.1 windows works fine if you allow the
debugged VM to exit. Otherwise, mine just crashed the moment when
eclipse attached.
1. for wtkrun use debug="3452" or some other port you like
2. make a debugger config for remote debugging
3. enable "Allow termination of remote VM"
4. specify the same port in debugger config
5. just leave the host name blank
6. never start the debugger before the emulator
Step 6 is important, otherwise you make your eclipse hang up on you
and block. Wait for the emulator to get ready (it won't start
execution though) and then connect from eclipse. Interestingly enough, it
seems to be ready when it prints "VM not ready".
If the emulator complains about address already in use, move on to
a different port. Be sure to change the port both in wtkrun and
debug config. Sometimes it seems that a locked debugger or crashed
emulator wastes a port. Maybe something with windows. Just move on to
another. Or reboot...
Once the connection is up it works like a charm, source level
debugging and local variables are as you expect them to be.