题
有没有办法从内部GDB打印类型属性?点击 例如。 Integer'Size。
解决方案
是:
(GDB)P thing'attribute
一些属性被识别,以及其他则不是。 (在什么下面列出,实测值是布尔变量。)
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:
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,尽管第一颗子弹说,它不是类型有效。)
不隶属于 StackOverflow