This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] gdb can't print array element for fortran


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]