brew install gdb // homebrew를 통해 gdb 설치
설치위치: /usr/local/bin/gdb
gdb [실행파일명] // gdb 실행
✅ 오류 1: gdb r 옵션 사용 시 오류 발생
gdb 작동후에 r 옵션으로 인자를 주면
"Unable to find Mach task port for process-id 440: (os/kern) failure (0x5).
(please check gdb is codesigned - see taskgated(8))"
라는 에러가 발생함.
이유는 gdb 버전 업데이트 이후, gdb를 실행할 때에 인증서에 서명을 해야 하기 때문. 아래의 링크를 참고하여 문제해결함.
✅ 오류 2: 인증서 적용 후에도 문제 발생
인증서를 생성하고 적용까지 되었음에도 아래와 같은 오류가 발생함
"Note: this version of macOS has System Integrity Protection. Because 'startup-with-shell' is enabled"
아래의 명령어를 입력하여 해결함.
echo "set startup-with-shell off" >> ~/.gdbinit
참고:
https://github.com/cyrus-and/gdb-dashboard/issues/81
https://timnash.co.uk/getting-gdb-to-semi-reliably-work-on-mojave-macos/