'Breakpoint'에 해당되는 글 1건
2008/12/23 19:00
[컴퓨팅환경]
Xcode와 Emacs를 함께 사용할 때 가장 불편한 것부터 하나씩 해결해 볼려고 한다.
오늘의 주제는 Emacs에서 breakpoint를 만드는 것. 방법은 Emacs의 AppleScript 실행기능을 이용하는 것이다.
사용한 AppleScript는 다음과 같다.
tell application "Xcode"
set theFile to "/Users/han9kin/Prototype/MyDocument.m"
set theLine to 25
repeat with aProj in projects
repeat with aFile in file references of aProj
if full path of aFile = theFile then
repeat with aBreak in file breakpoints of aProj
if full path of file reference of aBreak = theFile and line number of aBreak = theLine then
set aFile to null
exit repeat
end if
end repeat
if aFile is not equal to null then
tell aProj
set aBreak to make new file breakpoint with properties {line number:theLine}
set file reference of aBreak to aFile
set enabled of aBreak to true
end tell
end if
exit repeat
end if
end repeat
end repeat
end tell
.emacs 파일에 다음과 같이 넣어주면 F9를 눌렀을 때 해당 라인에 breakpoint를 설정해준다.
(defun xcode-break ()
(interactive)
(do-applescript
(format
(concat
"tell application \"Xcode\" \r"
" set theFile to \"%s\" \r"
" set theLine to %d \r"
" repeat with aProj in projects \r"
" repeat with aFile in file references of aProj \r"
" if full path of aFile = theFile then \r"
" repeat with aBreak in file breakpoints of aProj \r"
" if full path of file reference of aBreak = theFile and line number of aBreak = theLine then \r"
" set aFile to null \r"
" exit repeat \r"
" end if \r"
" end repeat \r"
" if aFile is not equal to null then \r"
" tell aProj \r"
" set aBreak to make new file breakpoint with properties {line number:theLine} \r"
" set file reference of aBreak to aFile \r"
" set enabled of aBreak to true \r"
" end tell \r"
" end if \r"
" exit repeat \r"
" end if \r"
" end repeat \r"
" end repeat \r"
"end tell \r"
)
buffer-file-name
(line-number-at-pos)
))
)
(define-key global-map [f9] 'xcode-break)
AppleScript가 굉장히 난해한 언어라 애플의 김정현부장님 도움을 많이 받았다. (감사합니다. 가까이 계셨으면 식사라도 한끼 대접해 드리고 싶었으나... 제 마음 아시죠? ㅋㅋ)
오늘은 요기까지
이 글은 스프링노트에서 작성되었습니다.


