Bug 11827 - const and volatile enum variables regression
Summary: const and volatile enum variables regression
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: symtab (show other bugs)
Version: unknown
: P2 normal
Target Milestone: 7.2
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-21 16:24 UTC by Pedro Alves
Modified: 2010-07-21 18:10 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pedro Alves 2010-07-21 16:24:06 UTC
From <http://sourceware.org/ml/gdb-patches/2010-06/msg00365.html>:

On Friday 21 May 2010 21:35:37, Pierre Muller wrote:

> > Pierre> 2010-05-21  Pierre Muller  <muller@ics.u-strasbg.fr>
> > Pierre> 	* dwarf2read.c (process_die): Also allow DW_TAG_const_type
> > Pierre> 	and DW_TAG_volatile_type.
> > Pierre> 	(new_symbol): Likewise.

caused

 @@ -7385,16 +7385,16 @@ PASS: gdb.base/sigaltstack.exp: handle S
  PASS: gdb.base/sigaltstack.exp: handle SIGVTALRM print pass nostop
  PASS: gdb.base/sigaltstack.exp: handle SIGPROF print pass nostop
  PASS: gdb.base/sigaltstack.exp: break catcher if level == INNER
 -PASS: gdb.base/sigaltstack.exp: continue to catch
 +FAIL: gdb.base/sigaltstack.exp: continue to catch (the program exited)
  PASS: gdb.base/sigaltstack.exp: next
 -PASS: gdb.base/sigaltstack.exp: backtrace
 -PASS: gdb.base/sigaltstack.exp: finish from catch LEAF
 -PASS: gdb.base/sigaltstack.exp: finish to throw INNER
 -PASS: gdb.base/sigaltstack.exp: finish to catch INNER
 -PASS: gdb.base/sigaltstack.exp: finish from catch INNER
 -PASS: gdb.base/sigaltstack.exp: finish to OUTER
 -PASS: gdb.base/sigaltstack.exp: finish to catch MAIN
 -PASS: gdb.base/sigaltstack.exp: finish to MAIN
 +FAIL: gdb.base/sigaltstack.exp: backtrace (pattern 1)
 +FAIL: gdb.base/sigaltstack.exp: finish from catch LEAF (the program is no
longer running)
 +FAIL: gdb.base/sigaltstack.exp: finish to throw INNER (the program is no
longer running)
 +FAIL: gdb.base/sigaltstack.exp: finish to catch INNER (the program is no
longer running)
 +FAIL: gdb.base/sigaltstack.exp: finish from catch INNER (the program is no
longer running)
 +FAIL: gdb.base/sigaltstack.exp: finish to OUTER (the program is no longer running)
 +FAIL: gdb.base/sigaltstack.exp: finish to catch MAIN (the program is no longer
running)
 +FAIL: gdb.base/sigaltstack.exp: finish to MAIN (the program is no longer running)


The problem is in the `level' variable in the test.


 (gdb) break catcher if level == INNER
 A syntax error in expression, near `== INNER'.
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 (gdb) PASS: gdb.base/sigaltstack.exp: break catcher if level == INNER
 continue
 Continuing.

 Program received signal SIGALRM, Alarm clock.

 Program received signal SIGVTALRM, Virtual timer expired.

 Program exited with code 03.
 (gdb) FAIL: gdb.base/sigaltstack.exp: continue to catch (the program exited)
 ...

Note that the variable has the same name as the enum:

 enum level { MAIN, OUTER, INNER, LEAF, NR_LEVELS };

 /* Levels completed flag.  */
 volatile enum level level = NR_LEVELS;


It boils down to this --- before the patch, running sigaltstack
under gdb (run to main):

 (gdb) p level
 $1 = NR_LEVELS
 (gdb) ptype level
 type = volatile enum level {MAIN, OUTER, INNER, LEAF, NR_LEVELS}

and after the patch:

 (gdb) p level
 Attempt to use a type name as an expression
 (gdb) ptype level
 type = volatile enum level {MAIN, OUTER, INNER, LEAF, NR_LEVELS}
Comment 1 Sourceware Commits 2010-07-21 18:01:47 UTC
Subject: Bug 11827

CVSROOT:	/cvs/src
Module name:	src
Branch: 	gdb_7_2-branch
Changes by:	palves@sourceware.org	2010-07-21 18:01:22

Modified files:
	gdb            : ChangeLog dwarf2read.c 
	gdb/testsuite  : ChangeLog 
	gdb/testsuite/gdb.base: printcmds.exp printcmds.c 

Log message:
	gdb/
	2010-07-21  Pedro Alves  <pedro@codesourcery.com>
	
	PR symtab/11827
	
	Revert:
	2010-05-21  Pierre Muller  <muller@ics.u-strasbg.fr>
	* dwarf2read.c (process_die): Also allow DW_TAG_const_type
	and DW_TAG_volatile_type.
	(new_symbol): Likewise.
	
	gdb/testsuite/
	2010-07-21  Pedro Alves  <pedro@codesourcery.com>
	
	PR symtab/11827
	
	* gdb.base/printcmds.c (enum some_volatile_enum): New enum.
	(some_volatile_enum): New variable.
	* gdb.base/printcmds.exp (test_print_enums): New.
	<top level>: Call it.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&only_with_tag=gdb_7_2-branch&r1=1.11973.2.12&r2=1.11973.2.13
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/dwarf2read.c.diff?cvsroot=src&only_with_tag=gdb_7_2-branch&r1=1.409.2.2&r2=1.409.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&only_with_tag=gdb_7_2-branch&r1=1.2376.2.4&r2=1.2376.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/printcmds.exp.diff?cvsroot=src&only_with_tag=gdb_7_2-branch&r1=1.34&r2=1.34.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/printcmds.c.diff?cvsroot=src&only_with_tag=gdb_7_2-branch&r1=1.3&r2=1.3.144.1

Comment 2 Sourceware Commits 2010-07-21 18:08:45 UTC
Subject: Bug 11827

CVSROOT:	/cvs/src
Module name:	src
Changes by:	palves@sourceware.org	2010-07-21 18:08:28

Modified files:
	gdb            : ChangeLog dwarf2read.c 
	gdb/testsuite  : ChangeLog 
	gdb/testsuite/gdb.base: printcmds.exp printcmds.c 

Log message:
	gdb/
	2010-07-21  Pedro Alves  <pedro@codesourcery.com>
	
	PR symtab/11827
	
	Revert:
	2010-05-21  Pierre Muller  <muller@ics.u-strasbg.fr>
	* dwarf2read.c (process_die): Also allow DW_TAG_const_type
	and DW_TAG_volatile_type.
	(new_symbol): Likewise.
	
	gdb/testsuite/
	2010-07-21  Pedro Alves  <pedro@codesourcery.com>
	
	PR symtab/11827
	
	* gdb.base/printcmds.c (enum some_volatile_enum): New enum.
	(some_volatile_enum): New variable.
	* gdb.base/printcmds.exp (test_print_enums): New.
	<top level>: Call it.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.12005&r2=1.12006
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/dwarf2read.c.diff?cvsroot=src&r1=1.420&r2=1.421
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.2385&r2=1.2386
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/printcmds.exp.diff?cvsroot=src&r1=1.34&r2=1.35
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/printcmds.c.diff?cvsroot=src&r1=1.3&r2=1.4

Comment 3 Pedro Alves 2010-07-21 18:10:45 UTC
Fixed on but 7.2 branch and mainline, by reverting original patch, and adding a
new explicit test for the regression.