X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fada-varobj.c;h=83d07073a298da8dc45b53a29bfe631281169102;hb=b08b78e7d4bb56f395d3212eed6184ede236c760;hp=b9f83be6ad78e5d4d422812a5938328c25f50f41;hpb=4d072ce478ebb605b2f0ca326c7c3168d4ee5989;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/ada-varobj.c b/gdb/ada-varobj.c index b9f83be6ad..83d07073a2 100644 --- a/gdb/ada-varobj.c +++ b/gdb/ada-varobj.c @@ -1,6 +1,6 @@ /* varobj support for Ada. - Copyright (C) 2012-2014 Free Software Foundation, Inc. + Copyright (C) 2012-2015 Free Software Foundation, Inc. This file is part of GDB. @@ -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. */ @@ -894,28 +906,28 @@ ada_varobj_get_value_of_variable (struct value *value, /* Ada specific callbacks for VAROBJs. */ static int -ada_number_of_children (struct varobj *var) +ada_number_of_children (const struct varobj *var) { return ada_varobj_get_number_of_children (var->value, var->type); } static char * -ada_name_of_variable (struct varobj *parent) +ada_name_of_variable (const struct varobj *parent) { return c_varobj_ops.name_of_variable (parent); } static char * -ada_name_of_child (struct varobj *parent, int index) +ada_name_of_child (const struct varobj *parent, int index) { return ada_varobj_get_name_of_child (parent->value, parent->type, parent->name, index); } static char* -ada_path_expr_of_child (struct varobj *child) +ada_path_expr_of_child (const struct varobj *child) { - struct varobj *parent = child->parent; + const struct varobj *parent = child->parent; const char *parent_path_expr = varobj_get_path_expr (parent); return ada_varobj_get_path_expr_of_child (parent->value, @@ -926,21 +938,22 @@ ada_path_expr_of_child (struct varobj *child) } static struct value * -ada_value_of_child (struct varobj *parent, int index) +ada_value_of_child (const struct varobj *parent, int index) { return ada_varobj_get_value_of_child (parent->value, parent->type, parent->name, index); } static struct type * -ada_type_of_child (struct varobj *parent, int index) +ada_type_of_child (const struct varobj *parent, int index) { return ada_varobj_get_type_of_child (parent->value, parent->type, index); } static char * -ada_value_of_variable (struct varobj *var, enum varobj_display_formats format) +ada_value_of_variable (const struct varobj *var, + enum varobj_display_formats format) { struct value_print_options opts; @@ -952,7 +965,7 @@ ada_value_of_variable (struct varobj *var, enum varobj_display_formats format) /* Implement the "value_is_changeable_p" routine for Ada. */ static int -ada_value_is_changeable_p (struct varobj *var) +ada_value_is_changeable_p (const struct varobj *var) { struct type *type = var->value ? value_type (var->value) : var->type; @@ -978,7 +991,7 @@ ada_value_is_changeable_p (struct varobj *var) /* Implement the "value_has_mutated" routine for Ada. */ static int -ada_value_has_mutated (struct varobj *var, struct value *new_val, +ada_value_has_mutated (const struct varobj *var, struct value *new_val, struct type *new_type) { int i; @@ -1026,5 +1039,6 @@ const struct lang_varobj_ops ada_varobj_ops = ada_type_of_child, ada_value_of_variable, ada_value_is_changeable_p, - ada_value_has_mutated + ada_value_has_mutated, + varobj_default_is_path_expr_parent };