Hi Lazarus devs
I'm getting a couple of crashes under arm-linux, which I think are
mostly related to unaligned access. There's a lot of code related to
typinfo that does pointer arithmetic that will definitely break on ARM
processors. I think some of the code probably pre-dates some of the
helper functions in typinfo, but the functions in typinfo are written
with aligned access in mind. I've fixed a particular crash as shown in
the attached patch. Is this acceptable? If so, I can try and fix more
of this code.
Thanks
Henry
Index: ide/project.pp
===================================================================
--- ide/project.pp (revision 32559)
+++ ide/project.pp (working copy)
@@ -4641,10 +4641,9 @@
procedure Search(AnUnitInfo: TUnitInfo; AComponent: TComponent);
// search the published properties of AComponent for references to other units
var
- TypeInfo: PTypeInfo;
- TypeData: PTypeData;
+ PropList: PPropList;
PropInfo: PPropInfo;
- CurCount: Word;
+ i: Integer;
ReferenceComponent: TComponent;
OwnerComponent: TComponent;
ReferenceUnit: TUnitInfo;
@@ -4666,56 +4665,43 @@
end;
// read all properties and remove doubles
- TypeInfo:=PTypeInfo(AComponent.ClassInfo);
- repeat
- // read all property infos of current class
- TypeData:=GetTypeData(TypeInfo);
- // skip unitname
- PropInfo:=PPropInfo(PByte(@TypeData^.UnitName)+Length(TypeData^.UnitName)+1);
- // read property count
- CurCount:=PWord(PropInfo)^;
- inc(PtrUInt(PropInfo),SizeOf(Word));
-
- // read properties
- while CurCount>0 do begin
- // point PropInfo to next propinfo record.
- // Located at Name[Length(Name)+1] !
- if (PropInfo^.PropType^.Kind=tkClass) then begin
- // property of kind TObject
- ReferenceComponent:=TComponent(GetObjectProp(AComponent,PropInfo));
- //debugln('TProject.UpdateUnitComponentDependencies Property ',dbgsName(AComponent),' Name=',PropInfo^.Name,' Type=',PropInfo^.PropType^.Name,' Value=',dbgsName(ReferenceComponent),' TypeInfo=',TypeInfo^.Name);
- if ReferenceComponent is TComponent then begin
- // reference is a TComponent
- OwnerComponent:=ReferenceComponent;
- while OwnerComponent.Owner<>nil do
- OwnerComponent:=OwnerComponent.Owner;
- if OwnerComponent<>AnUnitInfo.Component then begin
- // property references a component that is not owned
- // by the current unit
- ReferenceUnit:=UnitWithComponent(OwnerComponent);
- if ReferenceUnit<>nil then begin
- // property references another unit
- {$IFDEF VerboseIDEMultiForm}
- DebugLn(['TProject.UpdateUnitComponentDependencies multi form reference found: ',AnUnitInfo.Filename,' -> ',ReferenceUnit.Filename]);
- {$ENDIF}
- AnUnitInfo.AddRequiresComponentDependency(
- ReferenceUnit,[ucdtProperty]);
- if FRevertLockCount>0 then begin
- Dependency:=AnUnitInfo.AddRequiresComponentDependency(
- ReferenceUnit,[ucdtOldProperty]);
- Dependency.SetUsedByPropPath(
- Dependency.CreatePropPath(AComponent,PropInfo^.Name),
- Dependency.CreatePropPath(ReferenceComponent));
- end;
+ // read properties
+ for i := 0 to GetPropList(AComponent, PropList) - 1 do begin
+ PropInfo := PropList^[i];
+ if (PropInfo^.PropType^.Kind=tkClass) then begin
+ // property of kind TObject
+ ReferenceComponent:=TComponent(GetObjectProp(AComponent,PropInfo));
+ //debugln('TProject.UpdateUnitComponentDependencies Property ',dbgsName(AComponent),' Name=',PropInfo^.Name,' Type=',PropInfo^.PropType^.Name,' Value=',dbgsName(ReferenceComponent),' TypeInfo=',TypeInfo^.Name);
+ if ReferenceComponent is TComponent then begin
+ // reference is a TComponent
+ OwnerComponent:=ReferenceComponent;
+ while OwnerComponent.Owner<>nil do
+ OwnerComponent:=OwnerComponent.Owner;
+ if OwnerComponent<>AnUnitInfo.Component then begin
+ // property references a component that is not owned
+ // by the current unit
+ ReferenceUnit:=UnitWithComponent(OwnerComponent);
+ if ReferenceUnit<>nil then begin
+ // property references another unit
+ {$IFDEF VerboseIDEMultiForm}
+ DebugLn(['TProject.UpdateUnitComponentDependencies multi form reference found: ',AnUnitInfo.Filename,' -> ',ReferenceUnit.Filename]);
+ {$ENDIF}
+ AnUnitInfo.AddRequiresComponentDependency(
+ ReferenceUnit,[ucdtProperty]);
+ if FRevertLockCount>0 then begin
+ Dependency:=AnUnitInfo.AddRequiresComponentDependency(
+ ReferenceUnit,[ucdtOldProperty]);
+ Dependency.SetUsedByPropPath(
+ Dependency.CreatePropPath(AComponent,PropInfo^.Name),
+ Dependency.CreatePropPath(ReferenceComponent));
end;
end;
end;
end;
- PropInfo:=PPropInfo(pointer(@PropInfo^.Name)+PByte(@PropInfo^.Name)^+1);
- dec(CurCount);
end;
- TypeInfo:=TypeData^.ParentInfo;
- until TypeInfo=nil;
+ end;
+ if (PropList <> nil) then
+ Freemem(PropList);
end;
procedure DFSRequiredDesigner(AnUnitInfo, IgnoreUnitInfo: TUnitInfo);
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus