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

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