This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [Patch] gdb can't print array element for fortran
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Vinay Sridhar <vinay at linux dot vnet dot ibm dot com>
- Cc: gdb-patches at sourceware dot org, luisgpm at linux dot vnet dot ibm dot com
- Date: Mon, 12 Jan 2009 20:23:39 +0100
- Subject: Re: [Patch] gdb can't print array element for fortran
- References: <200901121022.07237.vinay@linux.vnet.ibm.com>
On Mon, 12 Jan 2009 05:52:06 +0100, Vinay Sridhar wrote:
> real x(3)
...
> diff -Nuarp gdb_orig/gdb/gdbtypes.c gdb/gdb/gdbtypes.c
> --- gdb_orig/gdb/gdbtypes.c 2009-01-03 11:27:51.000000000 +0530
> +++ gdb/gdb/gdbtypes.c 2009-01-09 16:46:56.000000000 +0530
> @@ -824,8 +824,14 @@ create_array_type (struct type *result_t
> /* Be careful when setting the array length. Ada arrays can be
> empty arrays with the high_bound being smaller than the low_bound.
> In such cases, the array length should be zero. */
> - if (high_bound < low_bound)
> - TYPE_LENGTH (result_type) = 0;
> + if (high_bound < low_bound) {
> + /* First check if we're dealing with a variable size array. If so,
> + set length to -1 so we can deal with it later. */
> + if (high_bound == -1)
> + TYPE_LENGTH (result_type) = -1;
In fact there is already in FSF GDB the flag
TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED for this purpose.
Also the array is not generally unbound in this case but just its length is
described by a DWARF block which gives the exact value:
<ef> DW_AT_upper_bound : 3 byte block: 91 68 6 (DW_OP_fbreg: -24; DW_OP_deref)
The full patch for dynamic DWARF bounds is at:
http://sourceware.org/gdb/wiki/ArcherBranchManagement
archer-jankratochvil-vla
Preparing its parts these days to be submitted here for FSF GDB.
Regards,
Jan