2017년 11월 12일 일요일

[이클립스] 디버깅

브레이크 포인트 걸기

  • 해당 소스 줄의 앞을 더블 클릭
  • 해당 줄에 커서를 놓은 뒤 Ctrl + Shift + B
  • 해당 줄에 커서를 놓은 뒤 메뉴에서 Run > Toggle Break 선택





디버깅 진행
F5 : 진행 시 메서드 호출이 있는 경우 메서드 안으로 들어간다. (Step Into)
F6: 메서드 호출이 안으로 들어가지 않고 다음 라인으로 이동한다. (Step Over)
F7: 현재 메서드에서 더이상 차례로 진행하지 않고 리턴한다. (Step Return)
F8: 다음 브레이크 포인트로 이동한다. (Resume)



class AClass{
int AMethod(int a, int b) {
int sum = 0;
for(int i = a; i < b; i++) {
sum += i;
}
return sum;
}
}

class BClass{
int bMember;
String bMember2;
BClass(int bMember, String bMember2){
this.bMember = bMember;
this.bMember2 = bMember2;
}
int BMethod(int inputN) {
bMember += inputN;
return bMember;
}
}

public class DebugTest {
static int[] staticMember = new int[10];
static int staticMemberLens = 10;
static boolean staticMethod(int index, int value) {
if(index >= staticMemberLens) 
return false;
staticMember[index] = value;
return true;
}

public static void main(String[] args) {
AClass a = new AClass();
BClass b = new BClass(3, "으아악");
b.BMethod(2);
a.AMethod(3, 5);
b.BMethod(10);
staticMethod(1, 5);
staticMethod(2, 3);
}
}


댓글 없음:

댓글 쓰기