티스토리 뷰

Tip and Error/C

lldb Tips

geonwoopaeng@gmail.com 2021. 3. 28. 20:11

compile 주의

  • -g 가 있는 경우에만 가능 합니다.

순서(

  • breakpoint 찾기 -> r로 실행 -> s,c,n으로 파악 -> fr,po 로 파악
lldb -- ./cub3d map.cub // ./cub3d 와 map.cub을 가지고 lldb 하겠다 (target 설정)
(lldb) r // lldb 실행

(lldb) bt // backtrace로 어디가 틀린지 자세히 확인
(lldb) br s -f main.c -l 1047 
//b main.c:1047 main.c함수의 1047에 문제가 발생되었을 떄 breakpoint 걸어주는 것

//breakpoint로 들어가서 진행 과정
(lldb) r
(lldb) s // step in 함수 안으로 들어가기
(lldb) c // 계속 프로그램 진행(프로그램이 멈출때까지, 중단점 만날때 까지)
(lldb) n // 코드 한줄씩 진행

// 특정 줄에 있는 것을 알고 싶을 때 
(lldb) b 줄수 
(lldb) r

// 다른 breakpoint를 하고 싶을 때 break point를 삭제 해줘야 한다.
(lldb) br del 

//변수 알아보기
(lldb) fr v all -p [단계] //구조체 어느 단계까지 들어갈 것인가
(lldb) po [변수]

1

반응형

'Tip and Error > C' 카테고리의 다른 글

lldb (Debugger)  (2) 2021.02.23
[Error] multiple definition of '...'  (0) 2021.02.18
[Error] control reaches end of non-void function  (0) 2021.02.17
[Error] *** stack smashing detected ***: terminated Aborted  (0) 2021.02.08
포인터  (0) 2020.08.27
공지사항
최근에 올라온 글