Do not auto-dereference null pointers in Ada MI varobj
The Ada varobj code automatically dereferences access types. This is
often handy, but it also does so for null pointers -- showing children
with empty values.
These children are weird, but even weirder when a variant type is
involved, because only the non-varying parts of the type are
displayed. This behavior conflicts a bit with my ongoing quest to
move the Ada code to use DWARF rather than gnat encodings, in that
reproducing this behavior with the DWARF code seems rather hacky.
So, this patch instead changes the Ada varobj code so that it does not
automatically dereference null pointers.
As this patch only affects Ada, and it was already reviewed internally
by Joel, I am checking it in.
2020-09-02 Tom Tromey <tromey@adacore.com>
* ada-varobj.c (ada_varobj_get_ptr_number_of_children): Return 0
for null pointers.
(ada_varobj_adjust_for_child_access): Special-case null pointers.
gdb/testsuite/ChangeLog
2020-09-02 Tom Tromey <tromey@adacore.com>
* gdb.ada/mi_var_access.exp: Test children of access variable.
* gdb.ada/mi_var_access/mi_access.adb: Add new stop markers.
* gdb.ada/mi_var_array.exp: Update.