LLDB调试器

我们常用的p、po究竟是什么?

help

使用help命令查看LLDB的帮助文档,哪里不会查哪里

expression(简写e、expr)
首先我们来看看帮助文档怎么说(太长了,就不完全粘贴下来了):

(lldb) help expression
     Evaluate an expression on the current thread.  Displays any returned value
     with LLDB's default formatting.  Expects 'raw' input (see 'help
     raw-input'.)

Syntax:

Command Options Usage:
......

Timeouts:
......

User defined variables:
......

Continuing evaluation after a breakpoint:
......

Examples:

    expr my_struct->a = my_array[3]
    expr -f bin -- (index * 8) + 5
    expr unsigned int $foo = 5
    expr char c[] = \"foo\"; c[0]
     
     Important Note: Because this command takes 'raw' input, if you use any
     command options you must use ' -- ' between the end of the command options
     and the beginning of the raw input.

归纳一下就是:

print(简写p)

简单来讲:'print' is an abbreviation for 'expression --'

验证一下:

(lldb) expression @"123"
(NSTaggedPointerString *) $0 = 0xa000000003332313 @"123"
(lldb) print @"123"
(NSTaggedPointerString *) $1 = 0xa000000003332313 @"123"

po

(lldb) help po
    Evaluate an expression on the current thread.  Displays any returned value
    with formatting controlled by the type's author. 
    'po' is an abbreviation for 'expression -O --'

经常打断点的你,如何更优雅的使用断点呢?

如何根据打印出来的堆栈信息,快速定位问题?

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 远程仓库 到目前为止,我们已经掌握了如何在Git仓库里对一个文件进行时光穿梭,你再也不用担心文件备份或者丢失的问题...
    归云丶阅读 5,944评论 0 5
  • 本系列教程来自廖雪峰的官方网站,现在搬运过来,目的帮助自己和小白学习收藏!附赠:常用git命令清单 目录 前言 创...
    Blizzard_liu阅读 4,799评论 0 4
  • git分支使用的坏习惯 最近使用git提交代码发现大家的方式都不一样,自己在使用中也遇到了一些问题,导致代码危险。...
    好奇的小刺猬阅读 5,668评论 0 1
  • 远程分支(remote branch)是对远程仓库中的分支的索引。它们是一些无法移动的本地分支;只有在 Git 进...
    幸运的小强本人阅读 3,255评论 0 0
  • 布什说:“我们准备枪杀4千万伊拉克人和1个修单车的。”CNN记者:“1个修单车的?!为什么要杀死一个修单车的?”布...
    凡了阅读 1,612评论 0 7