user3144125
user3144125

Reputation: 59

GDB print the fields of a structure

I've a

struct addrinfo *s;

and i want to see the fields

struct sockaddr *ai_addr;

inside my struct (s) when I'm in debug mode. I use code-blocks ide for testing my programs, and in the Debug Watches window I have set the correct watch

*s->ai_addr

but it print only the memory address. Then I use the debugger console of the ide, and i try to print the ai_addr struct with this command

p s->ai_addr

but gdb print the address again. How I can print correctly the content of the ai_addr struct in debug mode?

Upvotes: 2

Views: 1688

Answers (1)

Digital_Reality
Digital_Reality

Reputation: 4738

Because you trying to print ai_addr which is pointer aka address

Upvotes: 1

Related Questions