Come posso stampare gli attributi di tipo a GDB?
Domanda
C'è un modo per stampare un attributo del tipo dall'interno GDB?
Per esempio. Integer'Size.
Soluzione
Si
(gdb) p thing'attribute
Alcuni attributi vengono riconosciuti, e altri non lo sono. (In ciò che è elencati di seguito, trovato è una variabile booleana.)
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
Ecco l'elenco dal sezione Ada di Debug con 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, che elenco può essere datata, da quando ho potuto fare Integer'Last, nonostante il primo proiettile dicendo che non è valida per i tipi.)
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow