2013-08-01 1 views
5

앱을 일시 중지하고 콘솔에 무엇인가 인쇄 해 보았습니다. (예 : po foo()). 이렇게하면 다음 메시지가 표시됩니다.Xcode 콘솔에서 무언가를 인쇄하려고 할 때 "실행이 중단되었습니다. 이유 : 중단 점"

error: Execution was interrupted, reason: breakpoint 2.1.
The process has been returned to the state before execution.

그러나이 기능에는 중단 점이 없습니다. 왜이 오류를 보여 주며 함수를 실행하지 않는 것입니까?

이것은 Xcode 4.6입니다.

답변

5

문제 (2.1)의 중단 점이 모든 예외 중단 점이었습니다. 내가 호출 한 메서드는 예외를 발생시켜 All Exceptions 중단 점이 발생했습니다. po은 중단 점에 도달하면 실행을 중지합니다 (자세한 내용은 this answer 참조). 당신은 항상두면

error: Execution was interrupted, reason: signal SIGSTOP. 
The process has been returned to the state before execution. 

하면 브레이크 포인트가 활성화 된 모든 예외는, 다음 메시지가 모호 할 수 있습니다 : 당신이 중단 모든 예외를 해제하고 다시 실행하면

, 예외가 있다고 더 분명하다 : 실행 경로의 어딘가에 중단 점이 있었기 때문에 중단 점에 도달 했습니까? 예외가 발생 했습니까?

대안 솔루션 (All Exceptions 중단 점을 비활성화 할 필요가없는)은 po 대신 expr을 사용하는 것입니다 (다음 플래그에 대한 설명은 위 링크 참조). expr -u 0 -o -- foo()을 실행

는 다음과 같은 출력을 생성합니다

error: Execution was interrupted, reason: breakpoint 2.1 -2.1. 
The process has been left at the point where it was interrupted. 
* thread #1: tid = [...] libobjc.A.dylib`objc_exception_throw, stop reason = breakpoint 2.1 -2.1 
    frame #0: [...] libobjc.A.dylib`objc_exception_throw 

objc_exception_throw 문자열이 exception was raised 그 힌트입니다.