Joel Brobecker
c1b5a1a6e7
Internal error trying to print uninitialized string.
...
Trying to print the value of a string whose size is not known at
compile-time before it gets assigned a value can lead to the following
internal error:
(gdb) p my_str
$1 =
/[...]/utils.c:1089: internal-error: virtual memory exhausted.
What happens is that my_str is described as a reference to an array
type whose bounds are dynamic. During the read of that variable's
value (in default_read_var_value), we end up resolving dynamic types
which, for reference types, makes us also resolve the target of that
reference type. This means we resolve our variable to a reference
to an array whose bounds are undefined, and unfortunately very far
appart.
So, when we pass that value to ada-valprint, and in particular to
da_val_print_ref, we eventually try to allocate too large of a buffer
corresponding to the (bogus) size of our array, hence the internal
error.
This patch fixes the problem by adding a size_check before trying
to print the dereferenced value. To perform this check, a function
that was previously specific to ada-lang.c (check_size) gets
exported, and renamed to something less prone to name collisions
(ada_ensure_varsize_limit).
gdb/ChangeLog:
* ada-lang.h (ada_ensure_varsize_limit): Declare.
* ada-lang.c (check_size): Remove advance declaration.
(ada_ensure_varsize_limit): Renames check_size.
Replace calls to check_size by calls to ada_ensure_varsize_limit
throughout.
* ada-valprint.c (ada_val_print_ref): Add call to
ada_ensure_varsize_limit. Add comment explaining why.
gdb/testsuite/ChangeLog:
* gdb.ada/str_uninit: New testcase.
2014-12-13 11:00:24 -05:00
..
2014-10-14 14:05:11 -07:00
2014-01-01 07:54:24 +04:00
2014-11-19 12:48:07 +04:00
2014-01-01 07:54:24 +04:00
2014-01-27 08:27:21 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-11-13 10:20:44 +01:00
2014-01-01 07:54:24 +04:00
2014-04-28 15:48:11 -04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-03-28 06:22:24 -07:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-07 08:29:04 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-11-21 07:07:07 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-03-17 08:45:55 -07:00
2014-11-19 12:06:19 +04:00
2014-01-07 08:17:40 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-12-13 11:00:24 -05:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-03-10 14:40:35 +01:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-02-10 13:15:43 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-10-14 14:05:11 -07:00
2014-01-01 07:54:24 +04:00
2014-11-19 12:48:07 +04:00
2014-01-01 07:54:24 +04:00
2014-01-27 08:27:21 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-03-26 21:11:08 +08:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-04-28 15:48:11 -04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2012-05-17 19:03:59 +00:00
2014-01-01 07:54:24 +04:00
2014-03-28 06:22:24 -07:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-07 08:29:04 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-11-21 07:07:07 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-03-17 08:45:55 -07:00
2014-11-19 12:06:19 +04:00
2014-01-10 07:57:11 +04:00
2014-01-07 08:17:40 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-11-28 11:36:52 -05:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-12-13 11:00:24 -05:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-03-10 14:40:35 +01:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-02-26 14:22:33 +00:00
2014-01-01 07:54:24 +04:00
2014-02-10 13:15:43 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00
2014-01-01 07:54:24 +04:00