如何在GDB中打印类型属性?

时间:2009-04-13 20:10:40

标签: debugging gdb ada

有没有办法从GDB内部打印一个类型属性?
例如。 Integer'Size。

1 个答案:

答案 0 :(得分:8)

是:

(gdb)p thing'attribute

某些属性被识别,而其他属性则不被识别。 (在下面列出的内容中,Found是一个布尔变量。)

gdb) p integer'size
Attempt to use a type name as an expression
(gdb) p found'size
$2 = 8
(gdb) p integer'first
$3 = -2147483648
(gdb) p integer'last
$4 = 2147483647

以下是使用gdb进行调试Ada section的列表:

Only a subset of the attributes are supported:

     * 'First, 'Last, and 'Length on array objects (not on types and subtypes).
     * 'Min and 'Max.
     * 'Pos and 'Val.
     * 'Tag.
     * 'Range on array objects (not subtypes), but only as the right operand of the membership (in) operator.
     * 'Access, 'Unchecked_Access, and 'Unrestricted_Access (a GNAT extension).
     * 'Address.

(嗯,这个列表可能已过时,因为我可以做Integer'Last,尽管第一个子弹说它在类型上无效。)