This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
RE: Strange GDB behavior
- From: "Atul Talesara" <atul dot talesara at nevisnetworks dot com>
- To: <gdb at sources dot redhat dot com>
- Date: Mon, 26 Jul 2004 17:28:21 +0530
- Subject: RE: Strange GDB behavior
>From your following command it is evident that "bnp" is a pointer to a
>structure.
>
>>(gdb) p *bnp
>>$1 = {egp_next = 0x0, egp_sort_next = 0x0, egp_group = 0x82a45ef0,
>> egp_flags = 138412032, egp_hisrcvdcaps = 0, egp_hiscaps = 0,
egp_conf
>= {
>> action = 0 '\000'}, egpc_peer_as = 0, egpc_description = 0x0,
>>as_count
>>= 0,
>> ---Type <return> to continue, or q <return> to quit---q
>>Quit
>
>
> Hence I think this statement is incorrect
>> (gdb) p *bnp->as_count
*bnp->as_count is equivalent to *(bnp->as_count).
This will take the value of as_count and try to
dereference it, and you should typically get an error
something like "Cannot access memory at address 0x..."
and not "There is no member named ..." Nonetheless
*bnp->as_count won't give you desired value.
>
>It should be
>
>(gdb) p bnp->as_count
Or equivalently:
p (*bnp).as_count
Regards,
Atul P Talesara
----------------------------------------------------------
Be not afraid of life. Believe that life is worth living,
and your belief will help create the fact."
- Henry James
----------------------------------------------------------