diff options
author | Tom Tromey <tromey@adacore.com> | 2021-02-09 12:15:39 -0700 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2021-02-09 12:15:39 -0700 |
commit | f73e424f7bb51d4a5164320107f386b8fec34f4b (patch) | |
tree | 5736b4a9d9e67326ad32eeafd4780a11f9704422 /gdb/ChangeLog | |
parent | a4f0544b1ba516db0ab9715e4cccc78bc098ebc9 (diff) | |
download | gdb-f73e424f7bb51d4a5164320107f386b8fec34f4b.zip gdb-f73e424f7bb51d4a5164320107f386b8fec34f4b.tar.gz gdb-f73e424f7bb51d4a5164320107f386b8fec34f4b.tar.bz2 |
Avoid crash from coerce_unspec_val_to_type
With a certain Ada program, ada-lang.c:coerce_unspec_val_to_type can
cause a crash. This function may copy a value, and in the particular
case in the crash, the new value's type is smaller than the original
type. This causes coerce_unspec_val_to_type to create a lazy value --
but the original value is also not_lval, so later, when the value is
un-lazied, gdb asserts.
As with the previous patch, we believe there is a compiler bug here,
but it is difficult to reproduce, so we're not completely certain.
In the particular case we saw, the original value has record type, and
the record holds some variable-length arrays. This leads to the
type's length being 0. At the same time, the value is optimized out.
This patch changes coerce_unspec_val_to_type to handle an
optimized-out value correctly.
It also slightly restructures this code to avoid a crash should a
not_lval value wind up here. This is a purely defensive change.
This change also made it clear that value_contents_copy_raw can now be
made static, so that is also done.
gdb/ChangeLog
2021-02-09 Tom Tromey <tromey@adacore.com>
* ada-lang.c (coerce_unspec_val_to_type): Avoid making lazy
not_lval value.
* value.c (value_contents_copy_raw): Now static.
* value.h (value_contents_copy_raw): Don't declare.
Diffstat (limited to 'gdb/ChangeLog')
-rw-r--r-- | gdb/ChangeLog | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6470c99..5c66f99 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,12 @@ 2021-02-09 Tom Tromey <tromey@adacore.com> + * ada-lang.c (coerce_unspec_val_to_type): Avoid making lazy + not_lval value. + * value.c (value_contents_copy_raw): Now static. + * value.h (value_contents_copy_raw): Don't declare. + +2021-02-09 Tom Tromey <tromey@adacore.com> + * gdbtypes.c (resolve_dynamic_struct): Handle structure with no fields. |