LLDB

Groot·2022년 6월 7일
0

TIL

목록 보기
16/148
post-thumbnail

TIL

🌱 난 오늘 무엇을 공부했을까?

📌 LLDB

📍 Help

  • 해당 문법으로 사용가능한 유용한 명령어로 Subcommand, Option리스트의 사용법을 보여준다.

  • 기본 명령어 : help [command name]

# LLDB에서 제공하는 모든 명령어를 보고 싶을 때
(lldb) help

# 특정 명령어의 Subcommand나, Option이 보고 싶을 때
(lldb) help po

📍 Apropos

  • 관련 키워드를 통해 원하는 기능의 명령어가 있는지 알아볼 수 있는 명령어이다.

  • 기본 명령어 : apropos [keyword]

(lldb) apropos ignore

📍 breakpoint

  • Breakpoint를 만드는 기본적인 명령어
  • 기본 형태 : breakpoint set [option] "arguments"
(lldb) br s --name startStudy()

📍 Function Name

  • 특정 이름을 가진 모든 함수에 break를 걸기 위해 -name (-n) option을 이용할 수 있다.

  • 기본 명령어 : break s --name startStudy

📍 File

  • file (-f), –line (-l) option을 이용하면 파일의 이름과 line 번호를 이용해 break를 걸수 있다.

📍 Command 실행 & AutoContinue

  • lldb command를 실행 하기 위해 -command (-C) option을 이용할 수 있다.
br s -f main.swift -l 28 -C "po person" -G1

📍 list

  • 현재 프로그램에 생성되어있는 Breakpoint의 목록을 확인하기 위해 breakpoint list command를 이용할 수 있다

  • 간단히 보는 옵션 -b
  # breakpoint 목록 전체 출력
  (lldb) breakpoint list
  (lldb) br list
  # breakpoint 목록 간단하게 출력
  (lldb) br list -b
  # 특정 id를 가진 breakpoint의 정보만 출력
  (lldb) br list 1

📍 delete, disable (Subcommand)

  • Breakpoint를 삭제하거나, 비활성화 하기 위해 delete, disable Subcommand를 이용할 수 있습니다.

  • delete

  • disable

  # breakpoint 전체 삭제
  (lldb) breakpoint delete
  (lldb) br de
  # 특정 breakpoint 삭제
  (lldb) br de 1
  # breakpoint 전체 비할성화
  (lldb) breakpoint disable
  (lldb) br di
  # 특정 breakpoint 비활성화
  (lldb) br di 1.1

📍 Stepping Over

  • 현재 Break 걸려있는 지점에서 다음 Statement로 넘어갈 수 있으며 이를 step Over라고 한다.
(lldb) `n`(next Command)

📍 Stepping In

  • Debugger를 해당 함수 내부에 위치한 시작 지점으로 이동하기 위해서는 다음 Statement가 Function Call일 때 Stepping In을 해줘야 한다.
(lldb) `s`(step Command)

📍 Stepping Out

  • Stepping Out을 사용하여 현재 진행중인 function이 return 될때까지 프로그램을 진행한 후 프로그램 Break걸어줄 수 있습니다.
(lldb) `finish` 

Stack Memory 관점에서 Stepping Out은 Stack Frame을 Pop하는 것과 동일하다.


profile
I Am Groot

0개의 댓글