+ wasm internal object reader: record section indices for debug sections. Check for duplicated debug sections.

This commit is contained in:
Nikolay Nikolov 2024-01-06 19:07:28 +02:00
parent f510e6f59b
commit dfdc4a4d78

View File

@ -2374,6 +2374,7 @@ implementation
CodeSectionIndex: Integer = -1;
DataSectionIndex: Integer = -1;
DebugSectionIndex: array [TWasmCustomDebugSectionType] of Integer = (-1,-1,-1,-1,-1,-1,-1);
FuncTypes: array of record
IsImport: Boolean;
@ -2895,6 +2896,13 @@ implementation
var
ObjSec: TObjSection;
begin
Result:=False;
if DebugSectionIndex[SectionType]<>-1 then
begin
InputError('Duplicated debug section: ' + SectionName);
exit;
end;
DebugSectionIndex[SectionType]:=SectionIndex;
ObjSec:=ObjData.createsection(SectionName,1,[oso_Data,oso_debug],false);
ObjSec.DataPos:=AReader.Pos;
ObjSec.Size:=SectionStart+SectionSize-AReader.Pos;