Xcode, LLDB Memo

Posted on 2018-10-18(목) in lldb

break point, 몇 가지 방법

(lldb) breakpoint set --name func001 --name func002
(lldb) break set --method method001
(lldb) br set --selector obj001_selector001:
(lldb) b set --name "-[class001 method001:]"
(lldb) breakpoint set --file test.swift --line 26
(lldb) breakpoint set --selector viewWillAppear
  • breakpoint 는 break, br, b 로 줄여서 쓸 수 있다.
  • -r’ : 정규식표현식

break point, 추가 설명

(lldb) breakpoint list
(lldb) tread backtrace all
(lldb) breakpoint disable 2
(lldb) b MyView.m:4
(lldb) b "-[MyViewA drawRect:]"
(lldb) b drawRect:
(lldb) break dis 1.4 # 1.4 is list number
1 breakpoints disabled.

참고 :

메모

  • ABI : Application Binary Interface

  • lldb 실행

% xcrun lldb
  • Command Syntax
(lldb) <noun> <verb> [options] [argument [argument...]]
  • Low level debug
(lldb) register read
(lldb) register read $arg1 $arg2
(lldb) memory read $arg1
error: memory read failed for 0x400
(lldb) reg read rax
  • for (int i = 0; i < count; i++) processElement(dataset[i]);
(lldb) parray `count` dataset
(int *) $8 = 0x0000000100200260 {
(int) [0] = 0
(int) [1] = 16842769
(int) [2] = 33685538
(int) [3] = 50528307
(int) [4] = 67371076
}
(lldb)
  • 포인터에 값 대입
  • Action
(lldb) br co a                   # breakpoint command add
(lldb) > p rect
(lldb) > bt
(lldb) > c
(lldb) > DONE
  • 값 처리
(lldb) p id $myModel = self       # p => primitive type
(lldb) b "-[MyModel dealloc]"
(lldb) br m -c "self == $myModel"
  • Watch
(lldb) w s v self->_needsSynchronization # watchpoint set variable
  • Thread 처리
(lldb) th u 11
  • Ignore 처리
(lldb) e -i false -- [self myMethod]
  • 포인터에 값 대입
(lldb) expr unsefeBitCast(0x10035708c, UIImageView.self)
  • 임시변수 사용.
$R4 <= 임시변수.
(lldb) expr let $bug1 = unsefeBitCast(0x10035708c, UIImageView.self)
(lldb) expr println($bug1)
(lldb) expr println(bugs)