Blame SOURCES/gdb-bz568248-oom-is-error.patch

7a6771
http://sourceware.org/ml/gdb-patches/2010-06/msg00005.html
7a6771
Subject: [rfc patch] nomem: internal_error -> error
7a6771
7a6771
Hi,
7a6771
7a6771
unfortunately I see this problem reproducible only with the
7a6771
archer-jankratochvil-vla branch (VLA = Variable Length Arrays - char[var]).
7a6771
OTOH this branch I hopefully submit in some form for FSF GDB later.
7a6771
7a6771
In this case (a general problem but tested for example on Fedora 13 i686):
7a6771
7a6771
int
7a6771
main (int argc, char **argv)
7a6771
{
7a6771
  char a[argc];
7a6771
  return a[0];
7a6771
}
7a6771
7a6771
(gdb) start
7a6771
(gdb) print a
7a6771
../../gdb/utils.c:1251: internal-error: virtual memory exhausted: can't allocate 4294951689 bytes.
7a6771
7a6771
It is apparently because boundary for the variable `a' is not initialized
7a6771
there.  Users notice it due to Eclipse-CDT trying to automatically display all
7a6771
the local variables on each step.
7a6771
7a6771
7a6771
Apparentl no regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu.
7a6771
But is anone aware of the reasons to use internal_error there?
7a6771
I find simple error as a perfectly reasonable there.
7a6771
(history only tracks it since the initial import)
7a6771
7a6771
IIRC this idea has been discussed with Tom Tromey, not sure of its origin.
7a6771
7a6771
I understand it may be offtopic for FSF GDB but from some GDB crashes I am not
7a6771
sure if it can happen only due to the VLA variables.
7a6771
7a6771
7a6771
Thanks,
7a6771
Jan
7a6771
7a6771
7a6771
gdb/
7a6771
2010-06-01  Jan Kratochvil  <jan.kratochvil@redhat.com>
7a6771
	    Tom Tromey  <tromey@redhat.com>
7a6771
7a6771
	* utils.c (nomem): Change internal_error to error.
7a6771
7a6771
Index: gdb-7.3.50.20110722/gdb/utils.c
7a6771
===================================================================
7a6771
--- gdb-7.3.50.20110722.orig/gdb/utils.c	2011-07-22 19:28:58.000000000 +0200
7a6771
+++ gdb-7.3.50.20110722/gdb/utils.c	2011-07-22 19:34:25.000000000 +0200
7a6771
@@ -1219,13 +1219,11 @@ malloc_failure (long size)
7a6771
 {
7a6771
   if (size > 0)
7a6771
     {
7a6771
-      internal_error (__FILE__, __LINE__,
7a6771
-		      _("virtual memory exhausted: can't allocate %ld bytes."),
7a6771
-		      size);
7a6771
+      error (_("virtual memory exhausted: can't allocate %ld bytes."), size);
7a6771
     }
7a6771
   else
7a6771
     {
7a6771
-      internal_error (__FILE__, __LINE__, _("virtual memory exhausted."));
7a6771
+      error (_("virtual memory exhausted."));
7a6771
     }
7a6771
 }
7a6771