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

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