[Lazarus] GDB - cannot perform pointer math on incomplete types
David Emerson
dle3ab at angelbase.com
Tue Dec 4 03:31:57 CET 2012
-------- Original Message --------
> From: "Martin" <lazarus at mfriebe.de>
>
> On 04/12/2012 01:54, David Emerson wrote:
> > This error message has often befuddled me when debugging.
> > I've got a dynamic array, usually a type that I've created, e.g.
> > type longint_arr = array of longint
> > I'm using the Watch List and want to inspect one of the elements of
such an
> > array, e.g. f_list[0]. But I get this error, which I guess comes from
GDB.
> > Is there any way I can coerce it into giving me f_list[0], or even
> > f_list[1]?
> >
>
> I would need a complete example....
> Also Laz/fpc version...
>
> Sometimes this message appears, if you declare an array without a type
name.
> So instead of
> type TMyArray = array of integer; var Foo: TMyArray;
> you do:
> var Foo: array of integer;
>
> If the type of the element is named, then do
> ^integer(Foo)[1]
> Nested Array
> ^^integer(Foo)[1][2]
>
> If it is a static array "array[3..5]" then the pointer type cast still
> starts at index 0 (so you must subtract the low bound from all indices)
>
> It may also happen with nested arrays, and (unnamed (inline in "var"
> declared) records)
> var Foo: array of record ... end;
>
> You may also try switching between stabs and dwarf (project options /
> /linking)
>
Thanks much!! The first suggestion ^integer(foo)[1] works great!
More information about the Lazarus
mailing list