public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* info locals gives error
@ 2006-03-31  6:57 Nick Roberts
  2006-03-31 13:53 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Roberts @ 2006-03-31  6:57 UTC (permalink / raw)
  To: gdb


I've just upgraded to Fedora Core 5 (kernel 2.6.15-1.2054_FC5) and with the
program below I get errors which didn't occur before (Fedora Core 3).  This
error might relate to Vladimir Prus's earlier report
(http://sources.redhat.com/ml/gdb-patches/2006-03/msg00225.html) and
value_print.


/* -*- compile-command: "cc -g -o simple simple.c"; -*- */

main(int argc, char **argv) {
  int i;
  i = 1;
}

Fedora's GDB:

  nickrob/160 gdb simple
  GNU gdb Red Hat Linux (6.3.0.0-1.122rh)
  Copyright 2004 Free Software Foundation, Inc.
  GDB is free software, covered by the GNU General Public License, and you are
  welcome to change it and/or 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.
  This GDB was configured as "i386-redhat-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1".

  (gdb) b main
  Breakpoint 1 at 0x8048354: file simple.c, line 3.
  (gdb) r
  Starting program: /home/nickrob/simple
  Reading symbols from shared object read from target memory...done.
  Loaded system supplied DSO at 0x80e000
  
  Breakpoint 1, main () at simple.c:3
  3       main(int argc, char **argv) {
  (gdb) info locals
  argc = Cannot access memory at address 0x0
  (gdb) The program is running.  Exit anyway? (y or n) y


With current GDB:

  nickrob/161 ~/src/gdb/gdb simple
  GNU gdb 6.4.50.20060327-cvs
  Copyright (C) 2006 Free Software Foundation, Inc.
  GDB is free software, covered by the GNU General Public License, and you are
  welcome to change it and/or 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.
  This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1".
  
  (gdb) b main
  Breakpoint 1 at 0x8048365: file simple.c, line 5.
  (gdb) r
  Starting program: /home/nickrob/simple
  
  Breakpoint 1, main () at simple.c:5
  5         i = 1;
  (gdb) info locals
  argc = Cannot access memory at address 0x0
  (gdb)


gcc --version gives "gcc (GCC) 4.1.0 20060304 (Red Hat 4.1.0-3)".

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

* Re: info locals gives error
  2006-03-31  6:57 info locals gives error Nick Roberts
@ 2006-03-31 13:53 ` Eli Zaretskii
  2006-04-02  6:59   ` Nick Roberts
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2006-03-31 13:53 UTC (permalink / raw)
  To: Nick Roberts; +Cc: gdb

> From: Nick Roberts <nickrob@snap.net.nz>
> Date: Fri, 31 Mar 2006 18:38:03 +1200
> 
> I've just upgraded to Fedora Core 5 (kernel 2.6.15-1.2054_FC5) and with the
> program below I get errors which didn't occur before (Fedora Core 3).  This
> error might relate to Vladimir Prus's earlier report
> (http://sources.redhat.com/ml/gdb-patches/2006-03/msg00225.html) and
> value_print.
> 
> 
> /* -*- compile-command: "cc -g -o simple simple.c"; -*- */
> 
> main(int argc, char **argv) {
>   int i;
>   i = 1;
> }
> [...]
>   (gdb) b main
>   Breakpoint 1 at 0x8048354: file simple.c, line 3.
>   (gdb) r
>   Starting program: /home/nickrob/simple
>   Reading symbols from shared object read from target memory...done.
>   Loaded system supplied DSO at 0x80e000
>   
>   Breakpoint 1, main () at simple.c:3
>   3       main(int argc, char **argv) {
>   (gdb) info locals
>   argc = Cannot access memory at address 0x0

I cannot reproduce this with GDB 6.4 and GCC versions 3.3.5 and 4.0.0
on a Debian box.  I also tried GCC 3.4.2 and GDB 6.3 on a Windows box.
What I get in all of those cases is some arbitrary garbage, not
"cannot access".

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

* Re: info locals gives error
  2006-03-31 13:53 ` Eli Zaretskii
@ 2006-04-02  6:59   ` Nick Roberts
  0 siblings, 0 replies; 3+ messages in thread
From: Nick Roberts @ 2006-04-02  6:59 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb

 > > /* -*- compile-command: "cc -g -o simple simple.c"; -*- */
 > > 
 > > main(int argc, char **argv) {
 > >   int i;
 > >   i = 1;
 > > }
 > > [...]
 > >   (gdb) b main
 > >   Breakpoint 1 at 0x8048354: file simple.c, line 3.
 > >   (gdb) r
 > >   Starting program: /home/nickrob/simple
 > >   Reading symbols from shared object read from target memory...done.
 > >   Loaded system supplied DSO at 0x80e000
 > >   
 > >   Breakpoint 1, main () at simple.c:3
 > >   3       main(int argc, char **argv) {
 > >   (gdb) info locals
 > >   argc = Cannot access memory at address 0x0
 > 
 > I cannot reproduce this with GDB 6.4 and GCC versions 3.3.5 and 4.0.0
 > on a Debian box.  I also tried GCC 3.4.2 and GDB 6.3 on a Windows box.
 > What I get in all of those cases is some arbitrary garbage, not
 > "cannot access".

With gcc --version
gcc (GCC) 3.2 (Mandrake Linux 9.0 3.2-1mdk)

  (gdb) info args
  argc = 1
  argv = (char **) 0xbffff7a4

With gcc --version
gcc (GCC) 4.1.0 20060304 (Red Hat 4.1.0-3)

  (gdb) info args
  No arguments.


readelf -wi simple (for GCC 3.2) gives (about 1200 lines of output):

 ...
 <2><c6d>: Abbrev Number: 3 (DW_TAG_formal_parameter)
   DW_AT_name        : (indirect string, offset: 0x98e): argc 
     DW_AT_decl_file   : 1      
     DW_AT_decl_line   : 3      
     DW_AT_type        : <c96>  
     DW_AT_location    : 2 byte block: 91 8     (DW_OP_fbreg: 8; )
 <2><c7b>: Abbrev Number: 3 (DW_TAG_formal_parameter)
     DW_AT_name        : (indirect string, offset: 0x993): argv 
     DW_AT_decl_file   : 1      
     DW_AT_decl_line   : 3      
     DW_AT_type        : <c9d>  
     DW_AT_location    : 2 byte block: 91 c     (DW_OP_fbreg: 12; )
 <2><c89>: Abbrev Number: 4 (DW_TAG_variable)
     DW_AT_name        : i      
     DW_AT_decl_file   : 1      
     DW_AT_decl_line   : 4      
     DW_AT_type        : <c96>  
     DW_AT_location    : 2 byte block: 91 7c    (DW_OP_fbreg: -4; )
     ...

readelf -wi simple (for GCC 4.1.0) gives (about 60 lines of output):

 ...
 <2><75>: Abbrev Number: 3 (DW_TAG_formal_parameter)
     DW_AT_name        : argc	
     DW_AT_decl_file   : 1	
     DW_AT_decl_line   : 3	
     DW_AT_type        : <9a>	
 <2><81>: Abbrev Number: 3 (DW_TAG_formal_parameter)
     DW_AT_name        : argv	
     DW_AT_decl_file   : 1	
     DW_AT_decl_line   : 3	
     DW_AT_type        : <a1>	
 <2><8d>: Abbrev Number: 4 (DW_TAG_variable)
     DW_AT_name        : i	
     DW_AT_decl_file   : 1	
     DW_AT_decl_line   : 4	
     DW_AT_type        : <9a>	
     DW_AT_location    : 2 byte block: 91 70 	(DW_OP_fbreg: -16)
     ...

I presume something is up with GCC 4.1.0 (which apparently is a part of a
separate series to 4.0).

Nick

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

end of thread, other threads:[~2006-04-02  6:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-31  6:57 info locals gives error Nick Roberts
2006-03-31 13:53 ` Eli Zaretskii
2006-04-02  6:59   ` Nick Roberts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).