On Thu, 04 Jun 2015 10:55:59 +0200, Jakub Jelinek wrote:
> (gdb) p *(int (*)[4])&a[0]
> $1 = {1, 2, 3, 4}
> (gdb) p *(char (*)[4])&b[1]
> $2 = "bcde"
> 
> Though, admittedly that is more typing than a[0]@4 or b[1]@4 .

I forgot during this discussion about the C style cast, you are right.

For some GDB functions needing to print arrays, one can use:
        *POINTER@LENGTH
        ->
        *(typeof(*(POINTER))(*)[LENGTH])POINTER
So that one can even extract type of the expression POINTER.

So that @ operator is only for user convenience and I agree it can be
implemented by LHS@RHS splitting on GDB side and some unsupported corner cases
do not matter much.


Jan

Reply via email to