This is the mail archive of the gdb-prs@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

exp/1882: printing enum on amd64 gets "No symbol in current context"


>Number:         1882
>Category:       exp
>Synopsis:       printing enum on amd64 gets "No symbol in current context"
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 28 18:58:01 UTC 2005
>Closed-Date:
>Last-Modified:
>Originator:     nomura@netapp.com
>Release:        6.3 configured as x86_64-redhat-linux-gnu
>Organization:
>Environment:
Red Hat Enterprise Linux AS release 3 (Taroon Update 3)
on amd64
>Description:
Testcase:

[scm8]$ cat en.c
enum enumtype { ENUM_VALUE_ONE = 0x00000001 };

main () {
        printf ("%d\n", ENUM_VALUE_ONE );
}

==========================================================

Problem:

[scm8]$ gcc -gdwarf-2 en.c    # same result as gcc -g
[scm8]$ gdb -q a.out
Using host libthread_db library "/lib64/tls/libthread_db.so.1".
(gdb) p ENUM_VALUE_ONE
No symbol "ENUM_VALUE_ONE" in current context.

And with my own gdb 6.3:

[scm8]$ ~/dl/gdb-6.3_amd64/gdb/gdb a.out
GNU gdb 6.3
This GDB was configured as "x86_64-unknown-linux-gnu"...Using host
libthread_db library "/lib64/tls/libthread_db.so.1".

(gdb) p ENUM_VALUE_ONE
No symbol "ENUM_VALUE_ONE" in current context.
(gdb) q


however

[scm8]$ gcc -gstabs en.c
[scm8]$ gdb -q a.out
Using host libthread_db library "/lib64/tls/libthread_db.so.1".
(gdb) p ENUM_VALUE_ONE
$1 = ENUM_VALUE_ONE
(gdb) p (int)ENUM_VALUE_ONE
$2 = 1

==========================================================

Configuration:

[scm8]$ cat /etc/issue
Red Hat Enterprise Linux AS release 3 (Taroon Update 3)

[scm8]$ gcc -v
Reading specs from /usr/lib/gcc-lib/x86_64-redhat-linux/3.2.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
--host=x86_64-redhat-linux
Thread model: posix
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-42)

[scm8]$ gdb --version
GNU gdb Red Hat Linux (6.1post-1.20040607.17rh)
This GDB was configured as "x86_64-redhat-linux-gnu".

[scm8]$ rpm -qa | grep (gcc|gdb)
gdb-6.1post-1.20040607.17
gcc-3.2.3-42


This problem was originally seen with gcc = gcc 3.4.2 cross
compiling to amd64 from Linux (so it's not obviously due to
a back-level compiler).
>How-To-Repeat:
Compile the testcase in the Description with dwarf2 debug info (i.e. gcc default).  Run under gdb and try to print ENUM_VALUE_ONE.  gdb reports No symbol in current context.  

Then compile with -gstabs and run under gdb.  gdb is able to display the value.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]