keiths / rpms / gdb

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