This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit/Ada] Use our builtin type when evaluating conditional expressions
- From: Joel Brobecker <brobecker at adacore dot com>
- To: gdb-patches at sourceware dot org
- Date: Thu, 12 Mar 2009 18:21:34 -0700
- Subject: [commit/Ada] Use our builtin type when evaluating conditional expressions
This is a problem reported by a customer who was debugging a gigantic
application. I think it was on pa-hpux, but it might have been on
x86-linux, and the target is actually not relevant. We reproduced
the problem with the following command:
(gdb) p null /= null
It first hangs for a while, and then we get:
utils.c:1020: internal-error: virtual memory exhausted: can't allocate 4072 bytes.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Jerome Guitton did the investigation and said:
The problem comes from the fact that GDB casts "null /= null" into the
language boolean type (i.e. "standard.boolean"). And it lookups the
boolean type into the debug info of the application. As type boolean
is defined in every compilation unit, every psymtabs matchs; as a
consequence, all the corresponding symtabs are built. This roughly
means that the debugger loads every symbols when evaluating a
conditional expression. As the application is really huge, we run
out of memory before completing the operation.
This problem is avoided by making sure that we use our boolean
builtin type rather than trying to look it up...
2009-03-12 Jerome Guitton <guitton@adacore.com>
* language.c (lang_bool_type): Set lai->bool_type_symbol to NULL.
Tested on amd64-linux. Checked in.
--
Joel
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 0724804..0ec724f 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -11013,7 +11013,7 @@ ada_language_arch_info (struct gdbarch *gdbarch,
TYPE_NAME (lai->primitive_type_vector [ada_primitive_type_system_address])
= "system__address";
- lai->bool_type_symbol = "boolean";
+ lai->bool_type_symbol = NULL;
lai->bool_type_default = builtin->builtin_bool;
}