[Lazarus] GDB - cannot perform pointer math on incomplete types
David Emerson
dle3ab at angelbase.com
Tue Dec 4 04:48:27 CET 2012
> Still if you can get me the log + unit source ?
>
> because the IDE in many cases tries to work those out. So I wonder what
> happens behind the curtains...
I just constructed this program, which allows me to reproduce the issue. I
put a breakpoint on the writeln.
Watch List items:
tsrl_ag_cp(cf.f_ag).f_curve.f_cps.f_list[0] -- gives GDB error
^tsrl_ag_cp(tsrl_ag_cp(cf.f_ag).f_curve.f_cps.f_list)[0] -- succeeds
I'll see how much of this I can cut out and still reproduce :)
program dumdum;
{$mode objfpc}
uses classes;
type
ptr_array = array of pointer;
tsrl_ag = class (tobject);
t_list_frame = class (tobject)
f_list : ptr_array;
end;
t_unsorted_pointer_list = class (t_list_frame)
procedure add (p : pointer);
end;
generic gt_unsorted_pointer_list <_class> = class
(t_unsorted_pointer_list)
end;
t_ordered_ag_list = specialize gt_unsorted_pointer_list <tsrl_ag>;
tsrl_ag_cp_list = class (t_ordered_ag_list);
tsrl_shape = class
f_ag : tsrl_ag;
end;
tsrl_crowsfoot_icon = tsrl_shape;
tsrl_curve = class (tsrl_shape)
f_cps : tsrl_ag_cp_list;
end;
tsrl_ag_cp = class (tsrl_ag)
f_curve : tsrl_curve;
end;
procedure t_unsorted_pointer_list.add (p : pointer);
var l : longint;
begin
l := length(f_list);
setlength (f_list, l+1);
f_list[l] := p;
end;
var
cf : tsrl_crowsfoot_icon;
cf_ag, other_cp : tsrl_ag_cp;
curve : tsrl_curve;
begin
cf_ag := tsrl_ag_cp.create;
other_cp := tsrl_ag_cp.create;
curve := tsrl_curve.create;
curve.f_cps := tsrl_ag_cp_list.create;
curve.f_cps.add(other_cp);
curve.f_cps.add(cf_ag);
cf_ag.f_curve := curve;
cf := tsrl_crowsfoot_icon.create;
cf.f_ag := cf_ag;
writeln ('hi');
end.
More information about the Lazarus
mailing list