2

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?

1 Answer 1

2

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?

Sign up to request clarification or add additional context in comments.

4 Comments

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
What does ptype retval->_mp_d says? Tried set print union on?
Ah, I see. I needed print *retval[0][0]._mp_d, I found this using the ptype as you suggested. Thanks.
Oh, I see, that's an array. Didn't notice that on the first read.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.