Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] Fix to handle enums with values above LONG_MAX
@ 2001-05-08 10:05 John R. Moore
  2001-05-10  9:28 ` John R. Moore
  2001-06-12 10:47 ` Elena Zannoni
  0 siblings, 2 replies; 5+ messages in thread
From: John R. Moore @ 2001-05-08 10:05 UTC (permalink / raw)
  To: gdb-patches

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  <jmoore@redhat.com>

	* 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))
     {



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA] Fix to handle enums with values above LONG_MAX
  2001-05-08 10:05 [RFA] Fix to handle enums with values above LONG_MAX John R. Moore
@ 2001-05-10  9:28 ` John R. Moore
  2001-05-10 10:04   ` Elena Zannoni
  2001-06-12 10:47 ` Elena Zannoni
  1 sibling, 1 reply; 5+ messages in thread
From: John R. Moore @ 2001-05-10  9:28 UTC (permalink / raw)
  To: gdb-patches

Ok, this went on deaf ears... to illustrate, do the following:

------------------------- example.c ---------------------------
#include <stdio.h>

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  <jmoore@redhat.com>
>
> 	* 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))
>      {
>
>
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA] Fix to handle enums with values above LONG_MAX
  2001-05-10  9:28 ` John R. Moore
@ 2001-05-10 10:04   ` Elena Zannoni
  2001-05-11 13:08     ` Daniel Berlin
  0 siblings, 1 reply; 5+ messages in thread
From: Elena Zannoni @ 2001-05-10 10:04 UTC (permalink / raw)
  To: John R. Moore; +Cc: gdb-patches

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 <stdio.h>
 > 
 > 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  <jmoore@redhat.com>
 > >
 > > 	* 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))
 > >      {
 > >
 > >
 > >
 > 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA] Fix to handle enums with values above LONG_MAX
  2001-05-10 10:04   ` Elena Zannoni
@ 2001-05-11 13:08     ` Daniel Berlin
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Berlin @ 2001-05-11 13:08 UTC (permalink / raw)
  To: Elena Zannoni; +Cc: John R. Moore, gdb-patches

Elena Zannoni <ezannoni@cygnus.com> writes:

> 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?
It should occur everywhere.

> 
> Elena
> 
> 
>  > ------------------------- example.c ---------------------------
>  > #include <stdio.h>
>  > 
>  > 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  <jmoore@redhat.com>
>  > >
>  > > 	* 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))
>  > >      {
>  > >
>  > >
>  > >
>  > 

-- 
"I went into a clothes store the other day and a salesman walked
up to me and said, "Can I help you?"  and I said "Yeah, do you
got anything I like?"  He said, "What do you mean do we have
anything you like?"  I said, "You started this."
"-Steven Wright


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA] Fix to handle enums with values above LONG_MAX
  2001-05-08 10:05 [RFA] Fix to handle enums with values above LONG_MAX John R. Moore
  2001-05-10  9:28 ` John R. Moore
@ 2001-06-12 10:47 ` Elena Zannoni
  1 sibling, 0 replies; 5+ messages in thread
From: Elena Zannoni @ 2001-06-12 10:47 UTC (permalink / raw)
  To: John R. Moore; +Cc: gdb-patches

John R. Moore writes:
 > 
 > This fix has been tested on linux 2.4.4 kernel using gcc RedHat-2.97.
 > Without this fix, gdb simply core-dumps.
 > 

This seems Ok to me, but Jim is the last one to have touched this
function.  Jim?

Also,read_huge_number is called in several places, what input was
actually creating the problem? Maybe we can add a simple test to the
testsuite (gdb.stabs).

Elena


 > 
 > 2001-05-08  John Moore  <jmoore@redhat.com>
 > 
 > 	* 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))
 >      {
 > 
 > 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-06-12 10:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-08 10:05 [RFA] Fix to handle enums with values above LONG_MAX John R. Moore
2001-05-10  9:28 ` John R. Moore
2001-05-10 10:04   ` Elena Zannoni
2001-05-11 13:08     ` Daniel Berlin
2001-06-12 10:47 ` Elena Zannoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox