* [commit/Ada] Use our builtin type when evaluating conditional expressions
@ 2009-03-13 1:35 Joel Brobecker
2009-03-17 20:12 ` Tom Tromey
0 siblings, 1 reply; 3+ messages in thread
From: Joel Brobecker @ 2009-03-13 1:35 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 1345 bytes --]
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
[-- Attachment #2: 06-builtin-boolean.diff --]
[-- Type: text/x-diff, Size: 424 bytes --]
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;
}
\f
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [commit/Ada] Use our builtin type when evaluating conditional expressions
2009-03-13 1:35 [commit/Ada] Use our builtin type when evaluating conditional expressions Joel Brobecker
@ 2009-03-17 20:12 ` Tom Tromey
2009-03-17 20:13 ` Joel Brobecker
0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2009-03-17 20:12 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:
Joel> (gdb) p null /= null
Jerome> The problem comes from the fact that GDB casts "null /= null"
Jerome> into the language boolean type (i.e. "standard.boolean"). And
Jerome> it lookups the boolean type into the debug info of the
Jerome> application. As type boolean is defined in every compilation
Jerome> unit, every psymtabs matchs; as a consequence, all the
Jerome> corresponding symtabs are built. This roughly means that the
Jerome> debugger loads every symbols when evaluating a conditional
Jerome> expression.
I'm curious whether this will be a problem for any language defining
bool_type_symbol. If so, perhaps a language-neutral fix could be
found. If not, what is it that makes this specific to Ada?
Tom
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [commit/Ada] Use our builtin type when evaluating conditional expressions
2009-03-17 20:12 ` Tom Tromey
@ 2009-03-17 20:13 ` Joel Brobecker
0 siblings, 0 replies; 3+ messages in thread
From: Joel Brobecker @ 2009-03-17 20:13 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
> I'm curious whether this will be a problem for any language defining
> bool_type_symbol. If so, perhaps a language-neutral fix could be
> found. If not, what is it that makes this specific to Ada?
In most language, the lookup stops at the first match. In Ada,
we have to continue the lookup over all units, in case we have
homonyms. This is why we have treated this as an Ada-specific issue.
--
Joel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-03-17 20:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-13 1:35 [commit/Ada] Use our builtin type when evaluating conditional expressions Joel Brobecker
2009-03-17 20:12 ` Tom Tromey
2009-03-17 20:13 ` Joel Brobecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox