From mboxrd@z Thu Jan 1 00:00:00 1970 From: Elena Zannoni To: "John R. Moore" Cc: gdb-patches Subject: Re: [RFA] Fix to handle enums with values above LONG_MAX Date: Thu, 10 May 2001 10:04:00 -0000 Message-id: <15098.51763.455288.577568@kwikemart.cygnus.com> References: X-SW-Source: 2001-05/msg00160.html John R. Moore writes: > > Ok, this went on deaf ears... to illustrate, do the following: > It's in my queue. Do you get this error on other platforms besides Linux? Elena > ------------------------- example.c --------------------------- > #include > > enum AAA > { > a = 0x1, > b = 0xFFFFFFFF, /* If this is > LONG_MAX we core dump */ > }; > > int > main () > { > unsigned int x = a; > printf ("x = 0x%x\n", x); > } > ----------------------- end example.c ------------------------- > > % gcc -g example.c -o example > % gdb -nw example > (gdb) print a > Segmentation fault (core dumped) > % > > John Moore > > On Tue, 8 May 2001, John R. Moore wrote: > > > > > This fix has been tested on linux 2.4.4 kernel using gcc RedHat-2.97. > > Without this fix, gdb simply core-dumps. > > > > > > 2001-05-08 John Moore > > > > * stabsread.c (read_huge_number): Fix to allow gdb to handle > > enums with unsigned long values above LONG_MAX. > > > > Index: gdb/stabsread.c > > =================================================================== > > RCS file: /cvs/cvsfiles/devo/gdb/stabsread.c,v > > retrieving revision 2.178 > > diff -p -u -r2.178 stabsread.c > > --- gdb/stabsread.c 2001/03/26 19:54:39 2.178 > > +++ gdb/stabsread.c 2001/05/07 22:45:47 > > @@ -4433,10 +4433,7 @@ read_huge_number (char **pp, int end, in > > p++; > > } > > > > - if (os9k_stabs) > > - upper_limit = ULONG_MAX / radix; > > - else > > - upper_limit = LONG_MAX / radix; > > + upper_limit = ULONG_MAX / radix; > > > > while ((c = *p++) >= '0' && c < ('0' + radix)) > > { > > > > > > >