This is the mail archive of the gdb-patches@sourceware.cygnus.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]

Re: gdb patch for 64-bit enum values on 64-bit hosts (ia64-linux)


Michael Snyder writes:
 > Elena Zannoni wrote:
 > > 
 > > Jim Wilson writes:
 > > 
 > > Jim, any chance you could turn the tests into a gdb testfile? 
 > 
 > Elena, 
 > 
 > I thought I would take a stab at it.  Seemed like it might
 > belong in exprs.exp.  I noticed that exprs.exp seems kind of
 > unfinished -- it sets up as if to do some enum tests, but 
 > doesn't actually do them!  So I added some, including some
 > for long enums.  See below.  You approve?

If they pass, yes :-)

 > 
 > Unfortunately I don't have Jim's compiler patch, so I can't
 > test my tests.  Jim, can you test them for me?
 > 

Anybody tried?

Elena


 > 2000-06-14  Michael Snyder  <msnyder@seadog.cygnus.com>
 > 
 >         * gdb.base/exprs.exp: Add tests for enum expressions.
 >         * gdb.base/exprs.c: Ditto.
 > Index: exprs.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/testsuite/gdb.base/exprs.c,v
 > retrieving revision 1.1.1.2
 > diff -p -r1.1.1.2 exprs.c
 > *** exprs.c	1999/06/28 16:03:11	1.1.1.2
 > --- exprs.c	2000/06/15 00:52:29
 > *************** union tu_link {
 > *** 183,189 ****
 > --- 183,202 ----
 >   
 >   enum colors {red, green, blue} color;
 >   enum cars {chevy, ford, porsche} clunker;
 > + enum neg_colors {cyan = -3, magenta = -2, yellow = -1, black = 0} pigment;
 >   
 > + enum long_colors {
 > +   mauve = 0x1000000000000000L,
 > +   puce  = 0x1000000000000001L,
 > +   teal  = 0x1000000000000002L
 > + } shade;
 > + 
 > + enum neg_long_colors {
 > +   orange = -3L,
 > +   purple = -2L,
 > +   brown  = -1L,
 > +   white  = 0L
 > + } hue;
 >   
 >   void dummy()
 >   {
 > *************** void dummy()
 > *** 246,251 ****
 > --- 259,267 ----
 >   
 >     color = red;
 >     clunker = porsche;
 > +   pigment = magenta;
 > +   shade = puce;
 > +   hue = purple;
 >   
 >     u_link.next = s_link;
 >   
 > Index: exprs.exp
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/testsuite/gdb.base/exprs.exp,v
 > retrieving revision 1.1.1.2
 > diff -p -r1.1.1.2 exprs.exp
 > *** exprs.exp	1999/06/28 16:03:12	1.1.1.2
 > --- exprs.exp	2000/06/15 00:52:29
 > *************** proc test_expr { args } {
 > *** 60,65 ****
 > --- 60,66 ----
 >       }
 >       set last_ent [expr [llength $args] - 1];
 >       set testname [lindex $args $last_ent];
 > +     # FIXME: this test does NOT detect failure of the assignment (setup).
 >       if [gdb_test [lindex $args 0] "" "$testname (setup)"] {
 >   	gdb_suppress_tests;
 >       }
 > *************** test_expr "set variable v_unsigned_long=
 > *** 215,217 ****
 > --- 216,386 ----
 >   test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long != 0" "\\$\[0-9\]* = $true"  "print v_unsigned_long != (unsigned long)~0" "\\$\[0-9\]* = $false"  "print unsigned long != (~0)"
 >   test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long < 0" "\\$\[0-9\]* = $false"  "print v_unsigned_long < 0x7FFF" "\\$\[0-9\]* = $false"  "print unsigned long < (~0)"
 >   test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long > 0" "\\$\[0-9\]* = $true"  "print v_unsigned_long > 0x7FFF" "\\$\[0-9\]* = $true"  "print unsigned long > (~0)"
 > + #
 > + # test expressions with "enum color" types
 > + #
 > + test_expr "set variable color=green" \
 > + 	"print color == red"   "\\$\[0-9\]* = $false" \
 > + 	"print color == green" "\\$\[0-9\]* = $true" \
 > + 	"print color == blue"  "\\$\[0-9\]* = $false" \
 > + 	"print color == enum"
 > + test_expr "set variable color=1" \
 > + 	"print color == 0" "\\$\[0-9\]* = $false" \
 > + 	"print color == 1" "\\$\[0-9\]* = $true" \
 > + 	"print color == 2" "\\$\[0-9\]* = $false" \
 > + 	"print color == int"
 > + test_expr "set variable color=green" \
 > + 	"print color != red"   "\\$\[0-9\]* = $true" \
 > + 	"print color != green" "\\$\[0-9\]* = $false" \
 > + 	"print color != blue"  "\\$\[0-9\]* = $true" \
 > + 	"print color != enum"
 > + test_expr "set variable color=1" \
 > + 	"print color != 0" "\\$\[0-9\]* = $true" \
 > + 	"print color != 1" "\\$\[0-9\]* = $false" \
 > + 	"print color != 2" "\\$\[0-9\]* = $true" \
 > + 	"print color != int"
 > + test_expr "set variable color=green" \
 > + 	"print color > red"   "\\$\[0-9\]* = $true" \
 > + 	"print color > green" "\\$\[0-9\]* = $false" \
 > + 	"print color > blue"  "\\$\[0-9\]* = $false" \
 > + 	"print color > enum"
 > + test_expr "set variable color=1" \
 > + 	"print color > 0" "\\$\[0-9\]* = $true" \
 > + 	"print color > 1" "\\$\[0-9\]* = $false" \
 > + 	"print color > 2" "\\$\[0-9\]* = $false" \
 > + 	"print color > int"
 > + test_expr "set variable color=green" \
 > + 	"print color < red"   "\\$\[0-9\]* = $false" \
 > + 	"print color < green" "\\$\[0-9\]* = $false" \
 > + 	"print color < blue"  "\\$\[0-9\]* = $true" \
 > + 	"print color < enum"
 > + test_expr "set variable color=1" \
 > + 	"print color < 0" "\\$\[0-9\]* = $false" \
 > + 	"print color < 1" "\\$\[0-9\]* = $false" \
 > + 	"print color < 2" "\\$\[0-9\]* = $true" \
 > + 	"print color < int"
 > + # make enum a minus
 > + test_expr "set variable pigment=magenta" \
 > + 	"print pigment == cyan"    "\\$\[0-9\]* = $false" \
 > + 	"print pigment == magenta" "\\$\[0-9\]* = $true" \
 > + 	"print pigment == black"   "\\$\[0-9\]* = $false" \
 > + 	"print pigment == enum"
 > + test_expr "set variable pigment=-2" \
 > + 	"print pigment == -3" "\\$\[0-9\]* = $false" \
 > + 	"print pigment == -2" "\\$\[0-9\]* = $true" \
 > + 	"print pigment == 0"  "\\$\[0-9\]* = $false" \
 > + 	"print pigment == int"
 > + test_expr "set variable pigment=magenta" \
 > + 	"print pigment != cyan"    "\\$\[0-9\]* = $true" \
 > + 	"print pigment != magenta" "\\$\[0-9\]* = $false" \
 > + 	"print pigment != black"   "\\$\[0-9\]* = $true" \
 > + 	"print pigment != enum"
 > + test_expr "set variable pigment=-2" \
 > + 	"print pigment != -3" "\\$\[0-9\]* = $true" \
 > + 	"print pigment != -2" "\\$\[0-9\]* = $false" \
 > + 	"print pigment != 0"  "\\$\[0-9\]* = $true" \
 > + 	"print pigment != int"
 > + test_expr "set variable pigment=magenta" \
 > + 	"print pigment > cyan"    "\\$\[0-9\]* = $true" \
 > + 	"print pigment > magenta" "\\$\[0-9\]* = $false" \
 > + 	"print pigment > black"   "\\$\[0-9\]* = $false" \
 > + 	"print pigment > enum"
 > + test_expr "set variable pigment=-2" \
 > + 	"print pigment > -3" "\\$\[0-9\]* = $true" \
 > + 	"print pigment > -2" "\\$\[0-9\]* = $false" \
 > + 	"print pigment > 0"  "\\$\[0-9\]* = $false" \
 > + 	"print pigment > int"
 > + test_expr "set variable pigment=magenta" \
 > + 	"print pigment < cyan"    "\\$\[0-9\]* = $false" \
 > + 	"print pigment < magenta" "\\$\[0-9\]* = $false" \
 > + 	"print pigment < black"   "\\$\[0-9\]* = $true" \
 > + 	"print pigment < enum"
 > + test_expr "set variable pigment=-2" \
 > + 	"print pigment < -3" "\\$\[0-9\]* = $false" \
 > + 	"print pigment < -2" "\\$\[0-9\]* = $false" \
 > + 	"print pigment < 0"  "\\$\[0-9\]* = $true" \
 > + 	"print pigment < int"
 > + #
 > + # test expressions with "long enum" types
 > + #
 > + test_expr "set variable shade=puce" \
 > + 	"print shade == mauve" "\\$\[0-9\]* = $false" \
 > + 	"print shade == puce"  "\\$\[0-9\]* = $true" \
 > + 	"print shade == teal"  "\\$\[0-9\]* = $false" \
 > + 	"print shade == enum"
 > + test_expr "set variable shade=0x1000000000000001L" \
 > + 	"print shade == 0x1000000000000000L" "\\$\[0-9\]* = $false" \
 > + 	"print shade == 0x1000000000000001L" "\\$\[0-9\]* = $true" \
 > + 	"print shade == 0x1000000000000002L" "\\$\[0-9\]* = $false" \
 > + 	"print shade == int"
 > + test_expr "set variable shade=puce" \
 > + 	"print shade != mauve" "\\$\[0-9\]* = $true" \
 > + 	"print shade != puce"  "\\$\[0-9\]* = $false" \
 > + 	"print shade != teal"  "\\$\[0-9\]* = $true" \
 > + 	"print shade != enum"
 > + test_expr "set variable shade=0x1000000000000001L" \
 > + 	"print shade != 0x1000000000000000L" "\\$\[0-9\]* = $true" \
 > + 	"print shade != 0x1000000000000001L" "\\$\[0-9\]* = $false" \
 > + 	"print shade != 0x1000000000000002L" "\\$\[0-9\]* = $true" \
 > + 	"print shade != int"
 > + test_expr "set variable shade=puce" \
 > + 	"print shade > mauve" "\\$\[0-9\]* = $true" \
 > + 	"print shade > puce"  "\\$\[0-9\]* = $false" \
 > + 	"print shade > teal"  "\\$\[0-9\]* = $false" \
 > + 	"print shade > enum"
 > + test_expr "set variable shade=0x1000000000000001L" \
 > + 	"print shade > 0x1000000000000000L" "\\$\[0-9\]* = $true" \
 > + 	"print shade > 0x1000000000000001L" "\\$\[0-9\]* = $false" \
 > + 	"print shade > 0x1000000000000002L" "\\$\[0-9\]* = $false" \
 > + 	"print shade > int"
 > + test_expr "set variable shade=puce" \
 > + 	"print shade < mauve" "\\$\[0-9\]* = $false" \
 > + 	"print shade < puce"  "\\$\[0-9\]* = $false" \
 > + 	"print shade < teal"  "\\$\[0-9\]* = $true" \
 > + 	"print shade < enum"
 > + test_expr "set variable shade=0x1000000000000001L" \
 > + 	"print shade < 0x1000000000000000L" "\\$\[0-9\]* = $false" \
 > + 	"print shade < 0x1000000000000001L" "\\$\[0-9\]* = $false" \
 > + 	"print shade < 0x1000000000000002L" "\\$\[0-9\]* = $true" \
 > + 	"print shade < int"
 > + # make enum a minus
 > + test_expr "set variable hue=purple" \
 > + 	"print hue == orange" "\\$\[0-9\]* = $false" \
 > + 	"print hue == purple" "\\$\[0-9\]* = $true" \
 > + 	"print hue == white"  "\\$\[0-9\]* = $false" \
 > + 	"print hue == enum"
 > + test_expr "set variable hue=-2L" \
 > + 	"print hue == -3" "\\$\[0-9\]* = $false" \
 > + 	"print hue == -2" "\\$\[0-9\]* = $true" \
 > + 	"print hue == 0"  "\\$\[0-9\]* = $false" \
 > + 	"print hue == int"
 > + test_expr "set variable hue=purple" \
 > + 	"print hue != orange" "\\$\[0-9\]* = $true" \
 > + 	"print hue != purple" "\\$\[0-9\]* = $false" \
 > + 	"print hue != white"  "\\$\[0-9\]* = $true" \
 > + 	"print hue != enum"
 > + test_expr "set variable hue=-2L" \
 > + 	"print hue != -3L" "\\$\[0-9\]* = $true" \
 > + 	"print hue != -2L" "\\$\[0-9\]* = $false" \
 > + 	"print hue != 0L"  "\\$\[0-9\]* = $true" \
 > + 	"print hue != int"
 > + test_expr "set variable hue=purple" \
 > + 	"print hue > orange" "\\$\[0-9\]* = $true" \
 > + 	"print hue > purple" "\\$\[0-9\]* = $false" \
 > + 	"print hue > white"  "\\$\[0-9\]* = $false" \
 > + 	"print hue > enum"
 > + test_expr "set variable hue=-2L" \
 > + 	"print hue > -3L" "\\$\[0-9\]* = $true" \
 > + 	"print hue > -2L" "\\$\[0-9\]* = $false" \
 > + 	"print hue > 0L"  "\\$\[0-9\]* = $false" \
 > + 	"print hue > int"
 > + test_expr "set variable hue=purple" \
 > + 	"print hue < orange" "\\$\[0-9\]* = $false" \
 > + 	"print hue < purple" "\\$\[0-9\]* = $false" \
 > + 	"print hue < white"  "\\$\[0-9\]* = $true" \
 > + 	"print hue < enum"
 > + test_expr "set variable hue=-2L" \
 > + 	"print hue < -3L" "\\$\[0-9\]* = $false" \
 > + 	"print hue < -2L" "\\$\[0-9\]* = $false" \
 > + 	"print hue < 0L"  "\\$\[0-9\]* = $true" \
 > + 	"print hue < int"

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