2013-05-02 1 views

답변

18

breakpoint command add 명령을 사용하면 쉽게 알 수 있습니다. 자세한 내용은 help breakpoint command add을 입력하십시오. 여기에 예제가 있습니다.

int main() 
{ 
    int i = 0; 
    while (i < 30) 
    { 
     i++; // break here 
    } 
} 

이에 대해 lldb를 실행하십시오. 첫째, (이런 예는 좋은 속기하지만 기본적으로 큰 프로젝트를위한, 그렇게 유용하지 귀하의 소스를 통해 grep을하는) 그 어딘가에서 "휴식"과 소스 라인에 중단 점을 넣어

(lldb) br s -p break 
Breakpoint 1: where = a.out`main + 31 at a.c:6, address = 0x0000000100000f5f 

가 중단 점을 추가 이 안타

(lldb) br mod -c 'i % 5 == 0' 1 

가 브레이크를 인쇄 i 및 역 추적의 현재 값을 갖는다 : i 5의 배수 일 때 조건은 브레이크 포인트 만 정지되도록

(lldb) br com add 1 
Enter your debugger command(s). Type 'DONE' to end. 
> p i 
> bt 
> DONE 
,

다음을 사용하십시오.

Process 78674 stopped and was programmatically restarted. 
Process 78674 stopped and was programmatically restarted. 
Process 78674 stopped and was programmatically restarted. 
Process 78674 stopped and was programmatically restarted. 
Process 78674 stopped 
* thread #1: tid = 0x1c03, 0x0000000100000f5f a.out`main + 31 at a.c:6, stop reason = breakpoint 1.1 
    #0: 0x0000000100000f5f a.out`main + 31 at a.c:6 
    3  int i = 0; 
    4  while (i < 30) 
    5  { 
-> 6   i++; // break here 
    7  } 
    8 } 
(int) $25 = 20 
* thread #1: tid = 0x1c03, 0x0000000100000f5f a.out`main + 31 at a.c:6, stop reason = breakpoint 1.1 
    #0: 0x0000000100000f5f a.out`main + 31 at a.c:6 
    #1: 0x00007fff8c2a17e1 libdyld.dylib`start + 1 
+0

감사합니다. 나는 그것이 "breakpoint set"의 어딘가에 있어야한다고 생각했고 나는 틀린 나무를 완전히 짖고 있었다. – PHD