|
|
861f93 |
http://sourceware.org/ml/gdb-patches/2010-06/msg00005.html
|
|
|
861f93 |
Subject: [rfc patch] nomem: internal_error -> error
|
|
|
861f93 |
|
|
|
861f93 |
Hi,
|
|
|
861f93 |
|
|
|
861f93 |
unfortunately I see this problem reproducible only with the
|
|
|
861f93 |
archer-jankratochvil-vla branch (VLA = Variable Length Arrays - char[var]).
|
|
|
861f93 |
OTOH this branch I hopefully submit in some form for FSF GDB later.
|
|
|
861f93 |
|
|
|
861f93 |
In this case (a general problem but tested for example on Fedora 13 i686):
|
|
|
861f93 |
|
|
|
861f93 |
int
|
|
|
861f93 |
main (int argc, char **argv)
|
|
|
861f93 |
{
|
|
|
861f93 |
char a[argc];
|
|
|
861f93 |
return a[0];
|
|
|
861f93 |
}
|
|
|
861f93 |
|
|
|
861f93 |
(gdb) start
|
|
|
861f93 |
(gdb) print a
|
|
|
861f93 |
../../gdb/utils.c:1251: internal-error: virtual memory exhausted: can't allocate 4294951689 bytes.
|
|
|
861f93 |
|
|
|
861f93 |
It is apparently because boundary for the variable `a' is not initialized
|
|
|
861f93 |
there. Users notice it due to Eclipse-CDT trying to automatically display all
|
|
|
861f93 |
the local variables on each step.
|
|
|
861f93 |
|
|
|
861f93 |
|
|
|
861f93 |
Apparentl no regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu.
|
|
|
861f93 |
But is anone aware of the reasons to use internal_error there?
|
|
|
861f93 |
I find simple error as a perfectly reasonable there.
|
|
|
861f93 |
(history only tracks it since the initial import)
|
|
|
861f93 |
|
|
|
861f93 |
IIRC this idea has been discussed with Tom Tromey, not sure of its origin.
|
|
|
861f93 |
|
|
|
861f93 |
I understand it may be offtopic for FSF GDB but from some GDB crashes I am not
|
|
|
861f93 |
sure if it can happen only due to the VLA variables.
|
|
|
861f93 |
|
|
|
861f93 |
|
|
|
861f93 |
Thanks,
|
|
|
861f93 |
Jan
|
|
|
861f93 |
|
|
|
861f93 |
|
|
|
861f93 |
gdb/
|
|
|
861f93 |
2010-06-01 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
861f93 |
Tom Tromey <tromey@redhat.com>
|
|
|
861f93 |
|
|
|
861f93 |
* utils.c (nomem): Change internal_error to error.
|
|
|
861f93 |
|
|
|
861f93 |
Index: gdb-7.3.50.20110722/gdb/utils.c
|
|
|
861f93 |
===================================================================
|
|
|
861f93 |
--- gdb-7.3.50.20110722.orig/gdb/utils.c 2011-07-22 19:28:58.000000000 +0200
|
|
|
861f93 |
+++ gdb-7.3.50.20110722/gdb/utils.c 2011-07-22 19:34:25.000000000 +0200
|
|
|
861f93 |
@@ -1219,13 +1219,11 @@ malloc_failure (long size)
|
|
|
861f93 |
{
|
|
|
861f93 |
if (size > 0)
|
|
|
861f93 |
{
|
|
|
861f93 |
- internal_error (__FILE__, __LINE__,
|
|
|
861f93 |
- _("virtual memory exhausted: can't allocate %ld bytes."),
|
|
|
861f93 |
- size);
|
|
|
861f93 |
+ error (_("virtual memory exhausted: can't allocate %ld bytes."), size);
|
|
|
861f93 |
}
|
|
|
861f93 |
else
|
|
|
861f93 |
{
|
|
|
861f93 |
- internal_error (__FILE__, __LINE__, _("virtual memory exhausted."));
|
|
|
861f93 |
+ error (_("virtual memory exhausted."));
|
|
|
861f93 |
}
|
|
|
861f93 |
}
|
|
|
861f93 |
|