myEclipse Debug

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

  myEclipse Debug     快捷键  

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

***简要描写叙述

MyEclipse中有例如以下一些和执行调试相关的快捷键。
1. 【Ctrl+Shift+B】:在当前行设置断点或取消设置的断点。
2. 【F11】:调试最后一次运行的程序。
3. 【Ctrl+F11】:执行最后一次执行的程序。
4. 【F5】:跟踪到方法中,当程序运行到某方法时,能够按【F5】键跟踪到方法中。
5. 【F6】:单步运行程序。
6. 【F7】:运行完方法,返回到调用此方法的后一条语句。
7. 【F8】:继续运行,到下一个断点或程序结束。

 

***具体描写叙述

首先以debug模式启动tomcat,并文件里设断点,然后执行,当程序走到断点处就会转到debug视图下
[1]快捷键(F8)直接运行程序。
[2]快捷键(F5)单步运行程序,遇到方法时进入。
[3]快捷键(F6)单步运行程序,遇到方法时跳过。
[4]快捷键(F7)单步运行程序,从当前方法跳出。

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

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)

原文地址:https://www.cnblogs.com/mengfanrong/p/4216314.html