[gdb/exp] Improve <error reading variable> message
When printing a variable x in a subroutine foo:
subroutine foo (x)
integer(4) :: x (*)
x(3) = 1
end subroutine foo
where x is an array with unknown bounds, we get:
$ gdb -q -batch outputs/gdb.fortran/array-no-bounds/array-no-bounds \
-ex "break foo" \
-ex run \
-ex "print x"
Breakpoint 1 at 0x4005cf: file array-no-bounds.f90, line 18.
Breakpoint 1, foo (x=...) at array-no-bounds.f90:18
18 x(3) = 1
$1 = <error reading variable>
Improve the error message by printing the details of the error, such that we
$1 = <error reading variable: failed to get range bounds>
This is a change in gdb/valprint.c, and grepping through the sources reveals
that this is a common pattern.
Tested on x86_64-linux.
3 files changed