diff options
author | Tom Tromey <tromey@adacore.com> | 2023-12-21 08:24:18 -0700 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2024-02-05 07:13:37 -0700 |
commit | a8b1650962b074fb8025399199f50abc65090670 (patch) | |
tree | 8044b7d9173494fd688d50e0c2a78f62848dcab1 /gdb/c-varobj.c | |
parent | bae2a57f4c07f46093e7bf00fec2554868e77189 (diff) | |
download | fsf-binutils-gdb-a8b1650962b074fb8025399199f50abc65090670.zip fsf-binutils-gdb-a8b1650962b074fb8025399199f50abc65090670.tar.gz fsf-binutils-gdb-a8b1650962b074fb8025399199f50abc65090670.tar.bz2 |
Handling of arrays with optimized-out bounds
In Ada, sometimes the compiler must emit array bounds by referencing
an artificial variable that's created for this purpose. However, with
optimization enabled, these variables can be optimized away.
Currently this can result in displays like:
(gdb) print mumble
$1 = (warning: unable to get bounds of array, assuming null array
)
This patch changes this to report that the array is optimized-out,
instead, which is closer to the truth, and more generally useful. For
example, Python pretty-printers can now recognize this situation.
In order to accomplish this, I introduced a new PROP_OPTIMIZED_OUT
enumerator and changed one place to use it. Reusing the "unknown"
state wouldn't work properly, because in C it is normal for array
bounds to be unknown.
Diffstat (limited to 'gdb/c-varobj.c')
-rw-r--r-- | gdb/c-varobj.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/c-varobj.c b/gdb/c-varobj.c index ac840c6..4a74764 100644 --- a/gdb/c-varobj.c +++ b/gdb/c-varobj.c @@ -192,7 +192,7 @@ c_number_of_children (const struct varobj *var) { case TYPE_CODE_ARRAY: if (type->length () > 0 && target->length () > 0 - && (type->bounds ()->high.kind () != PROP_UNDEFINED)) + && type->bounds ()->high.is_available ()) children = type->length () / target->length (); else /* If we don't know how many elements there are, don't display |