From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1105 invoked by alias); 7 Nov 2003 23:20:41 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 1062 invoked from network); 7 Nov 2003 23:20:39 -0000 Received: from unknown (HELO mx01.netapp.com) (198.95.226.53) by sources.redhat.com with SMTP; 7 Nov 2003 23:20:39 -0000 Received: from frejya.corp.netapp.com (frejya [10.10.20.91]) by mx01.netapp.com (8.12.10/8.12.10/NTAP-1.4) with ESMTP id hA7NKcRG024588 for ; Fri, 7 Nov 2003 15:20:38 -0800 (PST) Received: from bughouse.hq.netapp.com (bughouse.hq.netapp.com [10.34.24.48]) by frejya.corp.netapp.com (8.12.9/8.12.9/NTAP-1.5) with ESMTP id hA7NKbvj018109 for ; Fri, 7 Nov 2003 15:20:38 -0800 (PST) Received: from bughouse.hq.netapp.com (localhost.localdomain [127.0.0.1]) by bughouse.hq.netapp.com (8.12.8/8.12.8) with ESMTP id hA7NKbkr005741 for ; Fri, 7 Nov 2003 15:20:37 -0800 Received: (from nomura@localhost) by bughouse.hq.netapp.com (8.12.8/8.12.7/Submit) id hA7NKbPk005739 for gdb@sources.redhat.com; Fri, 7 Nov 2003 15:20:37 -0800 Date: Fri, 07 Nov 2003 23:20:00 -0000 From: Kevin Nomura To: gdb@sources.redhat.com Subject: problem printing enums as integers with dwarf2 Message-ID: <20031107232037.GK4286@bughouse.netapp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i X-SW-Source: 2003-11/txt/msg00074.txt.bz2 Before filing a bug I'd like to check if I'm missing something obvious. A C enum is defined with elements x0, x1, ..., x999 starting at 0 and incrementing naturally with no "=" reassignments. It is compiled on Linux redhat 8 (for example) which uses dwarf2 by default: gcc -g enum.c x129 is printed as an integer: (gdb) p/d x129 $2 = -127 I expected 129. Compile with stabs explicitly and get the expected behaviour: [siml4]$ gcc -gstabs enum.c [siml4]$ gdb a.out GNU gdb Red Hat Linux (5.2.1-4) Copyright 2002 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"... (gdb) p x129 $1 = x129 (gdb) p/d x129 $2 = 129 (gdb) Here is a testcase generator in perl to declare the 1000 element enum. #!/usr/bin/perl -w use strict print "enum e {\n"; for ($i=0; $i<1000; $i++) { printf "\tx%d,\n", $i } print <