aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-varobj.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/ada-varobj.c')
-rw-r--r--gdb/ada-varobj.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gdb/ada-varobj.c b/gdb/ada-varobj.c
index 25b1a38..690ee49 100644
--- a/gdb/ada-varobj.c
+++ b/gdb/ada-varobj.c
@@ -240,6 +240,18 @@ ada_varobj_get_array_number_of_children (struct value *parent_value,
{
LONGEST lo, hi;
+ if (parent_value == NULL
+ && is_dynamic_type (TYPE_INDEX_TYPE (parent_type)))
+ {
+ /* This happens when listing the children of an object
+ which does not exist in memory (Eg: when requesting
+ the children of a null pointer, which is allowed by
+ varobj). The array index type being dynamic, we cannot
+ determine how many elements this array has. Just assume
+ it has none. */
+ return 0;
+ }
+
if (!get_array_bounds (parent_type, &lo, &hi))
{
/* Could not get the array bounds. Pretend this is an empty array. */