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

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