This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug ada/37245] New: GDB reports "No definition of "var1" in current context." for an existing variable
- From: "ludovic at ludovic-brenta dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Aug 2008 17:41:35 -0000
- Subject: [Bug ada/37245] New: GDB reports "No definition of "var1" in current context." for an existing variable
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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