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

475228
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
475228
From: Fedora GDB patches <invalid@email.com>
475228
Date: Fri, 27 Oct 2017 21:07:50 +0200
475228
Subject: gdb-bz568248-oom-is-error.patch
475228
475228
;; Out of memory is just an error, not fatal (uninitialized VLS vars, BZ 568248).
475228
;;=push+jan: Inferior objects should be read in parts, then this patch gets obsoleted.
475228
475228
http://sourceware.org/ml/gdb-patches/2010-06/msg00005.html
475228
475228
Hi,
475228
475228
unfortunately I see this problem reproducible only with the
475228
archer-jankratochvil-vla branch (VLA = Variable Length Arrays - char[var]).
475228
OTOH this branch I hopefully submit in some form for FSF GDB later.
475228
475228
In this case (a general problem but tested for example on Fedora 13 i686):
475228
475228
int
475228
main (int argc, char **argv)
475228
{
475228
  char a[argc];
475228
  return a[0];
475228
}
475228
475228
(gdb) start
475228
(gdb) print a
475228
../../gdb/utils.c:1251: internal-error: virtual memory exhausted: can't allocate 4294951689 bytes.
475228
475228
It is apparently because boundary for the variable `a' is not initialized
475228
there.  Users notice it due to Eclipse-CDT trying to automatically display all
475228
the local variables on each step.
475228
475228
Apparentl no regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu.
475228
But is anone aware of the reasons to use internal_error there?
475228
I find simple error as a perfectly reasonable there.
475228
(history only tracks it since the initial import)
475228
475228
IIRC this idea has been discussed with Tom Tromey, not sure of its origin.
475228
475228
I understand it may be offtopic for FSF GDB but from some GDB crashes I am not
475228
sure if it can happen only due to the VLA variables.
475228
475228
Thanks,
475228
Jan
475228
475228
gdb/
475228
2010-06-01  Jan Kratochvil  <jan.kratochvil@redhat.com>
475228
	    Tom Tromey  <tromey@redhat.com>
475228
475228
	* utils.c (nomem): Change internal_error to error.
475228
475228
diff --git a/gdb/utils.c b/gdb/utils.c
475228
--- a/gdb/utils.c
475228
+++ b/gdb/utils.c
475228
@@ -721,13 +721,11 @@ malloc_failure (long size)
475228
 {
475228
   if (size > 0)
475228
     {
475228
-      internal_error (__FILE__, __LINE__,
475228
-		      _("virtual memory exhausted: can't allocate %ld bytes."),
475228
-		      size);
475228
+      error (_("virtual memory exhausted: can't allocate %ld bytes."), size);
475228
     }
475228
   else
475228
     {
475228
-      internal_error (__FILE__, __LINE__, _("virtual memory exhausted."));
475228
+      error (_("virtual memory exhausted."));
475228
     }
475228
 }
475228