Browse Source

* fix writing procedure local type defs
* write type names once for types defined in the current compiled unit

git-svn-id: trunk@10541 -

peter 17 years ago
parent
commit
741b5a1df7
2 changed files with 19 additions and 23 deletions
  1. 6 0
      compiler/dbgbase.pas
  2. 13 23
      compiler/dbgstabs.pas

+ 6 - 0
compiler/dbgbase.pas

@@ -257,6 +257,12 @@ implementation
             appenddef_object(list,tobjectdef(def));
             appenddef_object(list,tobjectdef(def));
           undefineddef :
           undefineddef :
             appenddef_undefined(list,tundefineddef(def));
             appenddef_undefined(list,tundefineddef(def));
+          procdef :
+            begin
+              { procdefs are already written in a separate step. procdef
+                support in appenddef is only needed for beforeappenddef to
+                write all local type defs }
+            end;
         else
         else
           internalerror(200601281);
           internalerror(200601281);
         end;
         end;

+ 13 - 23
compiler/dbgstabs.pas

@@ -466,31 +466,11 @@ implementation
           appenddef(TAsmList(arg),tfieldvarsym(p).vardef);
           appenddef(TAsmList(arg),tfieldvarsym(p).vardef);
       end;
       end;
 
 
-{
-    procedure TDebugInfoStabs.method_write_defs(p:TObject;arg:pointer);
-      var
-        i  : longint;
-        pd : tprocdef;
-      begin
-        if tsym(p).typ<>procsym then
-          exit;
-        for i:=0 to tprocsym(p).ProcdefList.Count-1 do
-          begin
-            pd:=tprocdef(tprocsym(p).ProcdefList[i]);
-            insertdef(TAsmList(arg),pd.returndef);
-            if (po_virtualmethod in pd.procoptions) then
-              insertdef(TAsmList(arg),pd._class);
-            if assigned(pd.parast) then
-              write_symtable_defs(TAsmList(arg),pd.parast);
-            if assigned(pd.localst) then
-              write_symtable_defs(TAsmList(arg),pd.localst);
-          end;
-      end;
-}
 
 
     procedure TDebugInfoStabs.write_def_stabstr(list:TAsmList;def:tdef;const ss:ansistring);
     procedure TDebugInfoStabs.write_def_stabstr(list:TAsmList;def:tdef;const ss:ansistring);
       var
       var
         stabchar : string[2];
         stabchar : string[2];
+        symname  : string[20];
         st    : ansistring;
         st    : ansistring;
         p     : pchar;
         p     : pchar;
       begin
       begin
@@ -499,12 +479,19 @@ implementation
           stabchar := 'Tt'
           stabchar := 'Tt'
         else
         else
           stabchar := 't';
           stabchar := 't';
+        { Type names for types defined in the current unit are already written in
+          the typesym }
+        if (def.owner.symtabletype=globalsymtable) and
+           not(def.owner.iscurrentunit) then
+          symname:='${sym_name}'
+        else
+          symname:='';
         { Here we maybe generate a type, so we have to use numberstring }
         { Here we maybe generate a type, so we have to use numberstring }
         if is_class(def) and
         if is_class(def) and
            tobjectdef(def).writing_class_record_dbginfo then
            tobjectdef(def).writing_class_record_dbginfo then
-          st:=def_stabstr_evaluate(def,'"${sym_name}:$1$2=',[stabchar,def_stab_classnumber(tobjectdef(def))])
+          st:=def_stabstr_evaluate(def,'"'+symname+':$1$2=',[stabchar,def_stab_classnumber(tobjectdef(def))])
         else
         else
-          st:=def_stabstr_evaluate(def,'"${sym_name}:$1$2=',[stabchar,def_stab_number(def)]);
+          st:=def_stabstr_evaluate(def,'"'+symname+':$1$2=',[stabchar,def_stab_number(def)]);
         st:=st+ss;
         st:=st+ss;
         { line info is set to 0 for all defs, because the def can be in an other
         { line info is set to 0 for all defs, because the def can be in an other
           unit and then the linenumber is invalid in the current sourcefile }
           unit and then the linenumber is invalid in the current sourcefile }
@@ -957,6 +944,9 @@ implementation
         if not assigned(def.procstarttai) then
         if not assigned(def.procstarttai) then
           exit;
           exit;
 
 
+        { mark as used so the local type defs also be written }
+        def.dbg_state:=dbg_state_used;
+
         templist:=TAsmList.create;
         templist:=TAsmList.create;
 
 
         { end of procedure }
         { end of procedure }