瀏覽代碼

* Dwarf: write enum symbol constants with the size of the enum, as proposed in #41021

florian 3 月之前
父節點
當前提交
eba0624535
共有 1 個文件被更改,包括 15 次插入1 次删除
  1. 15 1
      compiler/dbgdwarf.pas

+ 15 - 1
compiler/dbgdwarf.pas

@@ -1504,6 +1504,7 @@ implementation
       var
         hp : tenumsym;
         i  : integer;
+        entryform : Tdwarf_form;
       begin
         if assigned(def.typesym) then
           append_entry(DW_TAG_enumeration_type,true,[
@@ -1518,6 +1519,19 @@ implementation
           append_labelentry_ref(DW_AT_type,def_dwarf_lab(def.basedef));
         finish_entry;
 
+        case def.size of
+          1:
+             entryform:=DW_FORM_data1;
+          2:
+             entryform:=DW_FORM_data2;
+          4:
+             entryform:=DW_FORM_data4;
+          8:
+             entryform:=DW_FORM_data8;
+        else
+          Internalerror(2025041601);
+        end;
+
         { write enum symbols }
         for i := 0 to def.symtable.SymList.Count - 1 do
           begin
@@ -1529,7 +1543,7 @@ implementation
               break;
             append_entry(DW_TAG_enumerator,false,[
               DW_AT_name,DW_FORM_string,symname(hp, false)+#0,
-              DW_AT_const_value,DW_FORM_data4,hp.value
+              DW_AT_const_value,entryform,hp.value
             ]);
             finish_entry;
           end;