* use WasmCustomSectionName to obtain the debug section names in MaybeWriteDebugSection and MaybeAddDebugSectionToSymbolTable

This commit is contained in:
Nikolay Nikolov 2022-08-03 23:11:44 +03:00
parent efd92fba01
commit dd13b46088

View File

@ -1382,11 +1382,11 @@ implementation
var var
section_nr: Integer; section_nr: Integer;
procedure MaybeAddDebugSectionToSymbolTable(const sn: string; st: TWasmCustomDebugSectionType; var debug_section_nr: Integer); procedure MaybeAddDebugSectionToSymbolTable(st: TWasmCustomDebugSectionType; var debug_section_nr: Integer);
var var
objsec: TWasmObjSection; objsec: TWasmObjSection;
begin begin
objsec:=TWasmObjSection(Data.ObjSectionList.Find(sn)); objsec:=TWasmObjSection(Data.ObjSectionList.Find(WasmCustomSectionName[st]));
if Assigned(objsec) then if Assigned(objsec) then
begin begin
debug_section_nr:=section_nr; debug_section_nr:=section_nr;
@ -1399,11 +1399,11 @@ implementation
end; end;
end; end;
procedure MaybeWriteDebugSection(const sn: string; st: TWasmCustomDebugSectionType); procedure MaybeWriteDebugSection(st: TWasmCustomDebugSectionType);
var var
objsec: TWasmObjSection; objsec: TWasmObjSection;
begin begin
objsec:=TWasmObjSection(Data.ObjSectionList.Find(sn)); objsec:=TWasmObjSection(Data.ObjSectionList.Find(WasmCustomSectionName[st]));
if Assigned(objsec) then if Assigned(objsec) then
begin begin
if oso_Data in objsec.SecOptions then if oso_Data in objsec.SecOptions then
@ -1903,13 +1903,13 @@ implementation
Inc(section_nr); Inc(section_nr);
end; end;
{ the debug sections } { the debug sections }
MaybeAddDebugSectionToSymbolTable('.debug_abbrev',wcstDebugAbbrev,debug_abbrev_section_nr); MaybeAddDebugSectionToSymbolTable(wcstDebugAbbrev,debug_abbrev_section_nr);
MaybeAddDebugSectionToSymbolTable('.debug_info',wcstDebugInfo,debug_info_section_nr); MaybeAddDebugSectionToSymbolTable(wcstDebugInfo,debug_info_section_nr);
MaybeAddDebugSectionToSymbolTable('.debug_str',wcstDebugStr,debug_str_section_nr); MaybeAddDebugSectionToSymbolTable(wcstDebugStr,debug_str_section_nr);
MaybeAddDebugSectionToSymbolTable('.debug_line',wcstDebugLine,debug_line_section_nr); MaybeAddDebugSectionToSymbolTable(wcstDebugLine,debug_line_section_nr);
MaybeAddDebugSectionToSymbolTable('.debug_frame',wcstDebugFrame,debug_frame_section_nr); MaybeAddDebugSectionToSymbolTable(wcstDebugFrame,debug_frame_section_nr);
MaybeAddDebugSectionToSymbolTable('.debug_aranges',wcstDebugAranges,debug_aranges_section_nr); MaybeAddDebugSectionToSymbolTable(wcstDebugAranges,debug_aranges_section_nr);
MaybeAddDebugSectionToSymbolTable('.debug_ranges',wcstDebugRanges,debug_ranges_section_nr); MaybeAddDebugSectionToSymbolTable(wcstDebugRanges,debug_ranges_section_nr);
DoRelocations; DoRelocations;
@ -1964,13 +1964,13 @@ implementation
if segment_count>0 then if segment_count>0 then
WriteWasmSection(wsiData); WriteWasmSection(wsiData);
MaybeWriteDebugSection('.debug_abbrev',wcstDebugAbbrev); MaybeWriteDebugSection(wcstDebugAbbrev);
MaybeWriteDebugSection('.debug_info',wcstDebugInfo); MaybeWriteDebugSection(wcstDebugInfo);
MaybeWriteDebugSection('.debug_str',wcstDebugStr); MaybeWriteDebugSection(wcstDebugStr);
MaybeWriteDebugSection('.debug_line',wcstDebugLine); MaybeWriteDebugSection(wcstDebugLine);
MaybeWriteDebugSection('.debug_frame',wcstDebugFrame); MaybeWriteDebugSection(wcstDebugFrame);
MaybeWriteDebugSection('.debug_aranges',wcstDebugAranges); MaybeWriteDebugSection(wcstDebugAranges);
MaybeWriteDebugSection('.debug_ranges',wcstDebugRanges); MaybeWriteDebugSection(wcstDebugRanges);
WriteRelocations; WriteRelocations;