I am trying to print a variable's address with lldb
. However, calling print &(myVar)
prints the variable's content instead of its address.
(lldb) print &(myVar)
(const string *) $18 = "hello"
Same for expression &(myVar)
.
(lldb) expression &(myVar)
(const string *) $19 = "hello"
I also tried expression
's -L
option :
(lldb) expression -L -- &(myVar)
0x00000000021aea80: (const string *) $20 = "hello"
(lldb) expression -L -- myVar
0x0000000002a15430: (std::string) $23 = "hello"
However the address outputted changes each time I invoke expression -L
. Hence I am assuming that it does not correspond to the variable's address in memory.
How do I get the variable's address in memory ?
(I use lldb 3.4)