tags:

views:

15

answers:

1

I am debugging some C code with gdb. My program has a variable of type mpz_t * retval. If I run the command

print *retval

I get the output

$23 = {{
    _mp_alloc = 6, 
    _mp_size = 5, 
    _mp_d = 0x1001008d0
}}

Is there anything else I can do to get more information about the value stored in retval?

A: 

Try these:

(gdb) set print object on
(gdb) set print pretty on
(gdb) ptype *retval
(gdb) print *retval

What else do you you want to know?

Nikolai N Fetissov
I'd like to know what the value of `_mp_d` is. But if I try `print (*retval)._mp_d` then I get `Attempt to extract a component of a value that is not a structure`
Full Decent
What does `ptype retval->_mp_d` says? Tried `set print union on`?
Nikolai N Fetissov
Ah, I see. I needed `print *retval[0][0]._mp_d`, I found this using the ptype as you suggested. Thanks.
Full Decent
Oh, I see, that's an array. Didn't notice that on the first read.
Nikolai N Fetissov