Bläddra i källkod

* fixed writing debug info for string constants that are exactly 255 chars
* fixed debug info for floating point constants whose size is <
sizeof(bestreal)

git-svn-id: trunk@15411 -

Jonas Maebe 15 år sedan
förälder
incheckning
39adedb12a
1 ändrade filer med 15 tillägg och 8 borttagningar
  1. 15 8
      compiler/dbgdwarf.pas

+ 15 - 8
compiler/dbgdwarf.pas

@@ -383,7 +383,7 @@ implementation
     uses
     uses
       sysutils,cutils,cfileutl,constexp,
       sysutils,cutils,cfileutl,constexp,
       version,globals,verbose,systems,
       version,globals,verbose,systems,
-      cpubase,cgbase,paramgr,
+      cpubase,cpuinfo,cgbase,paramgr,
       fmodule,
       fmodule,
       defutil,symtable,ppu
       defutil,symtable,ppu
       ;
       ;
@@ -2473,8 +2473,11 @@ implementation
           conststring:
           conststring:
             begin
             begin
               { if DW_FORM_string is used below one day, this usedef should
               { if DW_FORM_string is used below one day, this usedef should
-                probably become 0 }
-              if (sym.value.len<=255) then
+                probably become nil }
+              { note: < 255 instead of <= 255 because we have to store the
+                entire length of the string as well, and 256 does not fit in
+                a byte }
+              if (sym.value.len<255) then
                 usedef:=cshortstringtype
                 usedef:=cshortstringtype
               else
               else
                 usedef:=clongstringtype;
                 usedef:=clongstringtype;
@@ -2493,7 +2496,7 @@ implementation
             begin
             begin
               { DW_FORM_string isn't supported yet by the Pascal value printer
               { DW_FORM_string isn't supported yet by the Pascal value printer
                 -> create a string using raw bytes }
                 -> create a string using raw bytes }
-              if (sym.value.len<=255) then
+              if (sym.value.len<255) then
                 begin
                 begin
                   AddConstToAbbrev(ord(DW_FORM_block1));
                   AddConstToAbbrev(ord(DW_FORM_block1));
                   current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(sym.value.len+1));
                   current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(sym.value.len+1));
@@ -2574,14 +2577,18 @@ implementation
                 s32real:
                 s32real:
                   begin
                   begin
                     current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(4));
                     current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(4));
-                    current_asmdata.asmlists[al_dwarf_info].concat(tai_real_32bit.create(psingle(sym.value.valueptr)^));
+                    current_asmdata.asmlists[al_dwarf_info].concat(tai_real_32bit.create(pbestreal(sym.value.valueptr)^));
                   end;
                   end;
-                s64comp,
-                s64currency,
                 s64real:
                 s64real:
                   begin
                   begin
                     current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(8));
                     current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(8));
-                    current_asmdata.asmlists[al_dwarf_info].concat(tai_real_64bit.create(pdouble(sym.value.valueptr)^));
+                    current_asmdata.asmlists[al_dwarf_info].concat(tai_real_64bit.create(pbestreal(sym.value.valueptr)^));
+                  end;
+                s64comp,
+                s64currency:
+                  begin
+                    current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(8));
+                    current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_64bit(trunc(pbestreal(sym.value.valueptr)^)));
                   end;
                   end;
                 s80real,
                 s80real,
                 sc80real:
                 sc80real: