public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/37245] New: GDB reports "No definition of "var1" in current context." for an existing variable
@ 2008-08-26 17:42 ludovic at ludovic-brenta dot org
2008-08-26 17:44 ` [Bug ada/37245] " ludovic at ludovic-brenta dot org
2008-08-26 17:50 ` ludovic at ludovic-brenta dot org
0 siblings, 2 replies; 8+ messages in thread
From: ludovic at ludovic-brenta dot org @ 2008-08-26 17:42 UTC (permalink / raw)
To: gcc-bugs
Initially reported as a GDB bug:
http://sourceware.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gdb&pr=2512
but changing the compiler to GCC 4.2 eliminates the problem, so this is a GCC
bug. Bug description reproduced here for convenience:
Steps to reproduce:
1) Save the attached file "gdb_bug_2.adb"
2) gnatmake -ggdb3 -O0 gdb_bug_2
3) gdb ./gdb_bug_2
4) break breakpoint
5) run
6) print var1
7) print var2
Expected results:
6) gdb prints 42 as the value of var1
7) gdb prints 43 as the value of var2
Actual results
6) gdb prints "No definition of "var1" in current context."
7) gdb prints 43 as the value of var2
More info:
1) Fun2 is not called at all. However, if I remove fun2 from the program gdb is
able to print the value of var1 correctly.
2) Fitg5 does not use its arguments. However, if I change the type of argument
from real_vector to natural gdb is again able to print the value of var1
correctly.
3) Versions of relevant debian packages are
ii gcc-4.3 4.3.1-9 The GNU
C compiler
ii gdb 6.8-3 The GNU
Debugger
ii gnat-4.3 4.3.1-2 The GNU
Ada compiler
4) Please let me know if you can't reproduce the problem, I am happy to provide
more info!
From: Rod Kay <rodkay@dodo.com.au>
To: gdb-gnats@sources.redhat.com
Cc:
Subject: Re: ada/2512: can not find definition of an ada variable with gdb
Date: Tue, 26 Aug 2008 14:02:42 +1000
Results on Ubuntu 'Hardy' (up-to-date):
- Linux orth 2.6.24-19-generic #1 SMP Fri Jul 11 23:41:49 UTC 2008 i686
GNU/Linux
- gcc version 4.1.3 20080522 for GNAT GPL 2008 (20080521)
- GNU gdb 6.6 for GNAT GPL 2008 (20080521) [rev:131253]
(gdb) print var1
$1 = 42
(gdb) print var2
$2 = 43
Hope this helps ...
cheers,
Charlie.
From: Timo Juhani Lindfors <timo.lindfors@iki.fi>
To: gdb-gnats@sources.redhat.com
Cc:
Subject: Re: ada/2512: can not find definition of an ada variable with gdb
Date: Tue, 26 Aug 2008 09:42:25 +0300
ubuntu hardy
ii gcc-4.2 4.2.3-2ubuntu7
The GNU C compiler
ii gdb 6.8-1ubuntu2
The GNU Debugger
ii gnat 4.2.3-1ubuntu6
The GNU Ada compiler
=> "$1 = 42"
ubuntu hardy
ii gcc-4.1 4.1.2-21ubuntu1
The GNU C compiler
ii gdb 6.8-1ubuntu2
The GNU Debugger
ii gnat-4.1 4.1.2-16ubuntu3
The GNU Ada compiler
=> "$1 = 1"
debian unstable
ii gcc-4.1 4.1.2-23
The GNU C compiler
ii gdb 6.8-3
The GNU Debugger
ii gnat-4.1 4.1.2-20
The GNU Ada compiler
=> "$1 = 1"
debian unstable
ii gcc-snapshot 20080802-1
A SNAPSHOT of the GNU Compiler Collection
=> "No definition of "var1" in current context."
--
Summary: GDB reports "No definition of "var1" in current
context." for an existing variable
Product: gcc
Version: 4.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37245
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <bug-37245-4@http.gcc.gnu.org/bugzilla/>]
* [Bug ada/37245] GDB reports "No definition of "var1" in current context." for an existing variable
[not found] <bug-37245-4@http.gcc.gnu.org/bugzilla/>
@ 2011-09-01 0:00 ` nicolas.boulenguez at free dot fr
2011-09-01 0:32 ` timo.lindfors at iki dot fi
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: nicolas.boulenguez at free dot fr @ 2011-09-01 0:00 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37245
nicolas.boulenguez at free dot fr changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |nicolas.boulenguez at free
| |dot fr
--- Comment #3 from nicolas.boulenguez at free dot fr 2011-08-31 23:59:48 UTC ---
Linux 3.0.0-1-amd64 x86_64 gcc 4.6.1 (-5 in debian) and gdb 7.2 (-debian)
gdb reports the correct answer $1 = 42
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug ada/37245] GDB reports "No definition of "var1" in current context." for an existing variable
[not found] <bug-37245-4@http.gcc.gnu.org/bugzilla/>
2011-09-01 0:00 ` nicolas.boulenguez at free dot fr
@ 2011-09-01 0:32 ` timo.lindfors at iki dot fi
2011-09-01 1:16 ` nicolas.boulenguez at free dot fr
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: timo.lindfors at iki dot fi @ 2011-09-01 0:32 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37245
--- Comment #4 from Timo Lindfors <timo.lindfors at iki dot fi> 2011-09-01 00:31:16 UTC ---
The bug still occurs for me on debian testing:
lindi2:~/tmp$ gnatmake -ggdb3 -O0 gdb_bug_2
gcc-4.4 -c -ggdb3 -O0 gdb_bug_2.adb
gdb_bug_2.adb:25:07: warning: variable "gs" is read but never assigned
gnatbind -x gdb_bug_2.ali
gnatlink gdb_bug_2.ali -ggdb3
lindi2:~/tmp$ gdb ./gdb_bug_2
GNU gdb (GDB) 7.2-debian
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/lindi/tmp/gdb_bug_2...done.
(gdb) break breakpoint
Breakpoint 1 at 0x401322: file gdb_bug_2.adb, line 16.
(gdb) run
Starting program: /home/lindi/tmp/gdb_bug_2
Breakpoint 1, gdb_bug_2.fitg5.breakpoint () at gdb_bug_2.adb:16
16 end Breakpoint;
(gdb) print var1
No definition of "var1" in current context.
(gdb) print var2
$1 = 43
(gdb) quit
A debugging session is active.
Inferior 1 [process 11766] will be killed.
Quit anyway? (y or n) y
lindi2:~/tmp$ dpkg-query -W gdb
gdb 7.2-1
lindi2:~/tmp$ dpkg-query -W gcc
gcc 4:4.6.1-2
lindi2:~/tmp$ cat /proc/version
Linux version 3.0.0-1-amd64 (Debian 3.0.0-1) (ben@decadent.org.uk) (gcc version
4.5.3 (Debian 4.5.3-4) ) #1 SMP Sun Jul 24 02:24:44 UTC 2011
lindi2:~/tmp$ md5sum gdb_bug_2.adb
58638c361f25465b7a6288d0a69c7964 gdb_bug_2.adb
and unstable:
(sid)lindi1:~/tmp$ gnatmake -ggdb3 -O0 gdb_bug_2
gcc-4.4 -c -ggdb3 -O0 gdb_bug_2.adb
gdb_bug_2.adb:25:07: warning: variable "gs" is read but never assigned
gnatbind -x gdb_bug_2.ali
gnatlink gdb_bug_2.ali -ggdb3
(sid)lindi1:~/tmp$ gdb ./gdb_bug_2
GNU gdb (GDB) 7.3-debian
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/lindi/tmp/gdb_bug_2...done.
(gdb) break breakpoint
Breakpoint 1 at 0x401322: file gdb_bug_2.adb, line 16.
(gdb) run
Starting program: /home/lindi/tmp/gdb_bug_2
Breakpoint 1, gdb_bug_2.fitg5.breakpoint () at gdb_bug_2.adb:16
16 end Breakpoint;
(gdb) print var1
No definition of "var1" in current context.
(gdb) print var2
$1 = 43
(gdb) quit
A debugging session is active.
Inferior 1 [process 16208] will be killed.
Quit anyway? (y or n) y
(sid)lindi1:~/tmp$ dpkg-query -W gdb
gdb 7.3-1
(sid)lindi1:~/tmp$ dpkg-query -W gcc
gcc 4:4.6.1-2
(sid)lindi1:~/tmp$ cat /proc/version
Linux version 2.6.32-5-amd64 (Debian 2.6.32-35) (dannf@debian.org) (gcc version
4.3.5 (Debian 4.3.5-4) ) #1 SMP Tue Jun 14 09:42:28 UTC 2011
(the unstable one is in a chroot so it is running older kernel in case you
wonder.)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug ada/37245] GDB reports "No definition of "var1" in current context." for an existing variable
[not found] <bug-37245-4@http.gcc.gnu.org/bugzilla/>
2011-09-01 0:00 ` nicolas.boulenguez at free dot fr
2011-09-01 0:32 ` timo.lindfors at iki dot fi
@ 2011-09-01 1:16 ` nicolas.boulenguez at free dot fr
2011-09-01 6:34 ` charlet at gcc dot gnu.org
2011-09-08 9:16 ` timo.lindfors at iki dot fi
4 siblings, 0 replies; 8+ messages in thread
From: nicolas.boulenguez at free dot fr @ 2011-09-01 1:16 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37245
--- Comment #5 from nicolas.boulenguez at free dot fr 2011-09-01 01:15:04 UTC ---
During the Debian transition, the default gnat (4.4.6) uses its own gcc instead
of the default gcc (4.6.1), as you can see in line 2 of your log.
Summary of our results so far:
4.1.2 reports 1
4.1.3 ok
4.2.3 ok
4.3.1 no definition
4.4.6 no definition
4.6.1 ok
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug ada/37245] GDB reports "No definition of "var1" in current context." for an existing variable
[not found] <bug-37245-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2011-09-01 1:16 ` nicolas.boulenguez at free dot fr
@ 2011-09-01 6:34 ` charlet at gcc dot gnu.org
2011-09-08 9:16 ` timo.lindfors at iki dot fi
4 siblings, 0 replies; 8+ messages in thread
From: charlet at gcc dot gnu.org @ 2011-09-01 6:34 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37245
Arnaud Charlet <charlet at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |charlet at gcc dot gnu.org
Resolution| |FIXED
Target Milestone|--- |4.6.1
Known to fail| |
--- Comment #6 from Arnaud Charlet <charlet at gcc dot gnu.org> 2011-09-01 06:33:31 UTC ---
Closing then, thanks for checking
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug ada/37245] GDB reports "No definition of "var1" in current context." for an existing variable
[not found] <bug-37245-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2011-09-01 6:34 ` charlet at gcc dot gnu.org
@ 2011-09-08 9:16 ` timo.lindfors at iki dot fi
4 siblings, 0 replies; 8+ messages in thread
From: timo.lindfors at iki dot fi @ 2011-09-08 9:16 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37245
--- Comment #7 from Timo Lindfors <timo.lindfors at iki dot fi> 2011-09-08 08:06:42 UTC ---
Great news! I can verify that this indeed was fixed in debian (amd64 unstable)
too:
$ gnatmake -ggdb3 -O0 gdb_bug_2
gcc-4.6 -c -ggdb3 -O0 gdb_bug_2.adb
gdb_bug_2.adb:25:07: warning: variable "gs" is read but never assigned
gnatbind -x gdb_bug_2.ali
gnatlink gdb_bug_2.ali -ggdb3 -O0
(sid)lindi1:~/tmp$ gdb ./gdb_bug_2
GNU gdb (GDB) 7.3-debian
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/lindi/tmp/gdb_bug_2...done.
(gdb) break breakpoint
Breakpoint 1 at 0x401295: file gdb_bug_2.adb, line 15.
(gdb) run
Starting program: /home/lindi/tmp/gdb_bug_2
Breakpoint 1, gdb_bug_2.fitg5.breakpoint () at gdb_bug_2.adb:15
15 null;
(gdb) print var1
$1 = 42
(gdb) print var2
$2 = 43
(gdb) quit
A debugging session is active.
Inferior 1 [process 12502] will be killed.
Quit anyway? (y or n) y
(sid)lindi1:~/tmp$ dpkg-query -W gnat-4.6
gnat-4.6 4.6.1-5
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2011-09-08 8:07 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-26 17:42 [Bug ada/37245] New: GDB reports "No definition of "var1" in current context." for an existing variable ludovic at ludovic-brenta dot org
2008-08-26 17:44 ` [Bug ada/37245] " ludovic at ludovic-brenta dot org
2008-08-26 17:50 ` ludovic at ludovic-brenta dot org
[not found] <bug-37245-4@http.gcc.gnu.org/bugzilla/>
2011-09-01 0:00 ` nicolas.boulenguez at free dot fr
2011-09-01 0:32 ` timo.lindfors at iki dot fi
2011-09-01 1:16 ` nicolas.boulenguez at free dot fr
2011-09-01 6:34 ` charlet at gcc dot gnu.org
2011-09-08 9:16 ` timo.lindfors at iki dot fi
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).