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

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