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

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