Is there a way to print a type attribute from inside GDB?
E.g. Integer'Size.
views:
386answers:
1
+4
A:
Yes:
(gdb) p thing'attribute
Some attributes are recognized, and others aren't. (In what's listed below, Found is a Boolean variable.)
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
Here's the list from the Ada section of Debugging with 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.
(Hmm, that list may be dated, since I could do Integer'Last, despite the first bullet saying that it's not valid on types.)
Marc C
2009-04-14 01:14:36