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

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