6
我想用lldb
打印一個變量的地址。但是,撥打print &(myVar)
將打印變量的內容而不是其地址。lldb:打印一個變量的地址
(lldb) print &(myVar)
(const string *) $18 = "hello"
與expression &(myVar)
相同。
(lldb) expression &(myVar)
(const string *) $19 = "hello"
我也試過expression
的-L
選項:
(lldb) expression -L -- &(myVar)
0x00000000021aea80: (const string *) $20 = "hello"
(lldb) expression -L -- myVar
0x0000000002a15430: (std::string) $23 = "hello"
但是地址輸出改變每個我調用expression -L
時間。因此我假設它不對應於內存中變量的地址。
如何獲取內存中變量的地址?
(我用LLDB 3.4)
感謝詳細的解答! –