LLDB調(diào)試器

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

help

使用help命令查看LLDB的幫助文檔,哪里不會(huì)查哪里

expression(簡(jiǎn)寫e、expr)
首先我們來(lái)看看幫助文檔怎么說(shuō)(太長(zhǎng)了,就不完全粘貼下來(lái)了):

(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(簡(jiǎn)寫p)

簡(jiǎn)單來(lái)講:'print' is an abbreviation for 'expression --'

驗(yàn)證一下:

(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 --'

經(jīng)常打斷點(diǎn)的你,如何更優(yōu)雅的使用斷點(diǎn)呢?

如何根據(jù)打印出來(lái)的堆棧信息,快速定位問題?

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 遠(yuǎn)程倉(cāng)庫(kù) 到目前為止,我們已經(jīng)掌握了如何在Git倉(cāng)庫(kù)里對(duì)一個(gè)文件進(jìn)行時(shí)光穿梭,你再也不用擔(dān)心文件備份或者丟失的問題...
    歸云丶閱讀 2,032評(píng)論 0 5
  • 本系列教程來(lái)自廖雪峰的官方網(wǎng)站,現(xiàn)在搬運(yùn)過來(lái),目的幫助自己和小白學(xué)習(xí)收藏!附贈(zèng):常用git命令清單 目錄 前言 創(chuàng)...
    Blizzard_liu閱讀 1,201評(píng)論 0 4
  • git分支使用的壞習(xí)慣 最近使用git提交代碼發(fā)現(xiàn)大家的方式都不一樣,自己在使用中也遇到了一些問題,導(dǎo)致代碼危險(xiǎn)。...
    好奇的小刺猬閱讀 1,812評(píng)論 0 1
  • 遠(yuǎn)程分支(remote branch)是對(duì)遠(yuǎn)程倉(cāng)庫(kù)中的分支的索引。它們是一些無(wú)法移動(dòng)的本地分支;只有在 Git 進(jìn)...
    幸運(yùn)的小強(qiáng)本人閱讀 509評(píng)論 0 0
  • 布什說(shuō):“我們準(zhǔn)備槍殺4千萬(wàn)伊拉克人和1個(gè)修單車的。”CNN記者:“1個(gè)修單車的?!為什么要?dú)⑺酪粋€(gè)修單車的?”布...
    凡了閱讀 273評(píng)論 0 7

友情鏈接更多精彩內(nèi)容