Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Strange GDB behavior
@ 2004-07-26 11:34 True Sylvia
  2004-07-26 11:48 ` Monika Chaddha
  2004-07-26 13:15 ` Daniel Jacobowitz
  0 siblings, 2 replies; 6+ messages in thread
From: True Sylvia @ 2004-07-26 11:34 UTC (permalink / raw)
  To: gdb

Hi,

Am using the following flavor of GDB

Current directory is /tftproot/code/
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.16 (sparc-sun-solaris2.5.1 --target mips64orion-elf),
Copyright 1996 Free Software Foundation, Inc...
(gdb)

I have attached GDB to my executable and the following happens when i stop
on one of the breakpoints that i have set

(gdb) info br
Num Type           Disp Enb Address    What
1   breakpoint     keep y   0x8087c728 in egp_peer_close at egp_init.c:5265
(gdb)
(gdb) c
Continuing.
[New thread 22682896]
[Switching to thread 22682896]

Breakpoint 1, egp_peer_close (bnp=0x82a461c8, event=2) at egp_init.c:5265
(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
(gdb)

(gdb) p *bnp->as_count
There is no member named as_count.
(gdb)
(gdb) p *bnp->egp_options
There is no member named egp_options.

*Why* is this happening? I have members as_count and egp_options in my bnp
structure. Why isnt GDB showing me thses?

Regards,
Sylvia T.



^ permalink raw reply	[flat|nested] 6+ messages in thread
* RE: Strange GDB behavior
@ 2004-07-26 11:58 Arun Vishwanathan
  2004-07-26 13:00 ` Monika Chaddha
  0 siblings, 1 reply; 6+ messages in thread
From: Arun Vishwanathan @ 2004-07-26 11:58 UTC (permalink / raw)
  To: Monika Chaddha, True Sylvia; +Cc: gdb

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

It should be 

(gdb) p bnp->as_count



Regards,
Arun

-----Original Message-----
From: gdb-owner@sources.redhat.com [mailto:gdb-owner@sources.redhat.com]
On Behalf Of Monika Chaddha
Sent: Monday, July 26, 2004 4:51 PM
To: 'True Sylvia'
Cc: gdb@sources.redhat.com
Subject: RE: Strange GDB behavior

Hi Sylvia,

Compile yours source code with option -O0 and than try again.... As this
can be a problem due to optimization...
Are you getting the same problem with the other structures also?

Regards
Monika

>-----Original Message-----
>From: True Sylvia [mailto:truesylvia@yahoo.co.uk]
>Sent: Monday, July 26, 2004 2:24 PM
>To: gdb@sources.redhat.com
>Subject: Strange GDB behavior
>
>Hi,
>
>Am using the following flavor of GDB
>
>Current directory is /tftproot/code/
>GDB is free software and you are welcome to distribute copies of it
> under certain conditions; type "show copying" to see the conditions.
>There is absolutely no warranty for GDB; type "show warranty" for
details.
>GDB 4.16 (sparc-sun-solaris2.5.1 --target mips64orion-elf),
>Copyright 1996 Free Software Foundation, Inc...
>(gdb)
>
>I have attached GDB to my executable and the following happens when i
stop
>on one of the breakpoints that i have set
>
>(gdb) info br
>Num Type           Disp Enb Address    What
>1   breakpoint     keep y   0x8087c728 in egp_peer_close at
egp_init.c:5265
>(gdb)
>(gdb) c
>Continuing.
>[New thread 22682896]
>[Switching to thread 22682896]
>
>Breakpoint 1, egp_peer_close (bnp=0x82a461c8, event=2) at
egp_init.c:5265
>(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
>(gdb)
>
>(gdb) p *bnp->as_count
>There is no member named as_count.
>(gdb)
>(gdb) p *bnp->egp_options
>There is no member named egp_options.
>
>*Why* is this happening? I have members as_count and egp_options in my
bnp
>structure. Why isnt GDB showing me thses?
>
>Regards,
>Sylvia T.
>



^ permalink raw reply	[flat|nested] 6+ messages in thread
* RE: Strange GDB behavior
@ 2004-07-26 12:09 Atul Talesara
  0 siblings, 0 replies; 6+ messages in thread
From: Atul Talesara @ 2004-07-26 12:09 UTC (permalink / raw)
  To: gdb

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
----------------------------------------------------------


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-07-26 13:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-26 11:34 Strange GDB behavior True Sylvia
2004-07-26 11:48 ` Monika Chaddha
2004-07-26 13:15 ` Daniel Jacobowitz
2004-07-26 11:58 Arun Vishwanathan
2004-07-26 13:00 ` Monika Chaddha
2004-07-26 12:09 Atul Talesara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox