Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 GDB 中,给定一个指向结构的变量,print将显示原始指针值并x显示指向的原始字节。有没有办法显示指向该结构的数据,即字段列表及其值?
print
x
print *variable
如果这样做,它将在 GDB 中显示该变量的值。 您还可以选择在缩进和换行中显示结构:
$1 = { next = 0x0, flags = { sweet = 1, sour = 1 }, meat = 0x54 "Pork" }
为此,您需要设置漂亮的打印:
set print pretty on
如果你想打印一个值数组,你可以这样做:
print *array@len