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

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