变更记录

序号 录入时间 录入人 备注
2 2015-12-24 Alfred Jiang -

方案名称

Xcode - 使用 LLDB 调试代码

关键字

Xcode \ 调试 \ Debug \ LLDB

需求场景

  1. 利用 LLDB 调试代码

参考链接

  1. 简书 - 小笨狼与LLDB的故事
  2. Objc - Dancing in the Debugger — A Waltz with LLDB
  3. The LLDB Debugger

详细内容

expression

简写 e ,别名有 expr & p & print & call

作用 1 是执行某个表达式。

// 改变颜色
(lldb) expression -- self.view.backgroundColor = [UIColor redColor]
// 刷新界面
(lldb) expression -- (void)[CATransaction flush]

作用 2 是将返回值输出。

(lldb) expression -- self.view
(UIView *) $1 = 0x00007fe322c18a10
po

LLDB 为 expression -O -- 别名,等价于 expression -O -- ,

作用是打印对象信息。

(lldb) po self.view
<UIView: 0x7fb2a40344a0; frame = (0 0; 375 667); autoresize = W+H; layer = <CALayer: 0x7fb2a4018c80>>
thread backtrace

简写 bt

作用是打印堆栈信息。

(lldb) bt
thread return

作用是取消方法继续执行或者直接返回某个特定值。

thread return [<expr>]
更多内容参考 简书 - 小笨狼与LLDB的故事

效果图

(无)

备注

results matching ""

    No results matching ""