Re: Variable array size declaration and the debugger
Re: Variable array size declaration and the debugger
- Subject: Re: Variable array size declaration and the debugger
- From: Jonas Maebe <email@hidden>
- Date: Thu, 1 Nov 2007 14:09:47 +0100
On 26 Oct 2007, at 20:43, Jim Ingham wrote:
I filed a bug with gcc to support variable arrays, but it got
pushed out of Leopard. I must admit that Fortran 90 is pretty
impenetrable to me, so I'm not entirely sure what the example you
cited means, but the ADA one below it is more what I had in mind.
There you make up a synthetic type for this particular array, where
the DW_AT_upper_bound for the array is a pointer to the variable
that sets this.
However, both these examples assume that there are no more
assignments to the variable that defines the size. To do the
complete job you would also have to specify WHERE the array
variable is allocated, so that the debugger could silently break
there and capture the correct size before it gets altered. Then on
entry into a function, the debugger would have to scan the
variables defined in the function, and set these breakpoints for
all the ones it finds.
There are, as far as I see it, indeed at least two main cases:
1) the case you describe above: the array length is defined by a
variable whose value should be determined at the time the array
instance enters into scope, so the length should be evaluated once at
that point
2) the Fortran dynamic array type, which is (as I understand it)
quite similar to the (somewhat simpler) Object Pascal dynamic array
type. In these case, a variable or dynamic array is basically a
pointer to a struct which contains (a.o.) the length of the array and
a pointer to the array data. The length and pointer to the array data
can change during the lifetime of the array, and should be re-
evaluated every time the contents of the array are printed (so in
this case you don't need any breakpoints at all).
The DW_OP_push_object_address and friends basically enable a compiler
to generate "Data Formatters"-like expressions in the Dwarf
description, in order to intelligently display built-in composite
(but opaque) data types in debuggers (without the debuggers needing
specific support for these language- or compiler-specific constructs).
Jonas
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden