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

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