Explorar o código

* add DEBUGINFO symbol to reference the .o file that includes the
stabs info for types and global/static variables
* debuginfo flag added to ppu to indicate whether debuginfo is
generated or not

peter %!s(int64=21) %!d(string=hai) anos
pai
achega
c553f6b320
Modificáronse 3 ficheiros con 49 adicións e 4 borrados
  1. 25 2
      compiler/ncgutil.pas
  2. 16 1
      compiler/pmodules.pas
  3. 8 1
      compiler/ppu.pas

+ 25 - 2
compiler/ncgutil.pas

@@ -123,7 +123,7 @@ implementation
 {$endif}
     cutils,cclasses,
     globals,systems,verbose,
-    defutil,
+    ppu,defutil,
     procinfo,paramgr,fmodule,
     regvars,
 {$ifdef GDB}
@@ -1261,6 +1261,7 @@ implementation
         href : treference;
         paraloc1,
         paraloc2 : tparalocation;
+        hp   : tused_unit;
       begin
         { the actual profile code can clobber some registers,
           therefore if the context must be saved, do it before
@@ -1304,6 +1305,22 @@ implementation
            cg.allocexplicitregisters(list,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
            cg.a_call_name(list,'FPC_INITIALIZEUNITS');
            cg.deallocexplicitregisters(list,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
+
+{$ifdef GDB}
+           if (cs_debuginfo in aktmoduleswitches) then
+             begin
+               { include reference to all debuginfo sections of used units }
+               hp:=tused_unit(usedunits.first);
+               while assigned(hp) do
+                 begin
+                   If (hp.u.flags and uf_has_debuginfo)=uf_has_debuginfo then
+                     current_procinfo.aktlocaldata.concat(Tai_const_symbol.Createname(make_mangledname('DEBUGINFO',hp.u.globalsymtable,''),AT_DATA,0));
+                   hp:=tused_unit(hp.next);
+                 end;
+               { include reference to debuginfo for this program }
+               current_procinfo.aktlocaldata.concat(Tai_const_symbol.Createname(make_mangledname('DEBUGINFO',current_module.localsymtable,''),AT_DATA,0));
+             end;
+{$endif GDB}
          end;
 
 {$ifdef GDB}
@@ -2122,7 +2139,13 @@ implementation
 end.
 {
   $Log$
-  Revision 1.198  2004-05-02 17:26:19  peter
+  Revision 1.199  2004-05-19 21:16:12  peter
+    * add DEBUGINFO symbol to reference the .o file that includes the
+      stabs info for types and global/static variables
+    * debuginfo flag added to ppu to indicate whether debuginfo is
+      generated or not
+
+  Revision 1.198  2004/05/02 17:26:19  peter
     * fix stabs for globals
 
   Revision 1.197  2004/03/29 14:43:47  peter

+ 16 - 1
compiler/pmodules.pas

@@ -647,6 +647,15 @@ implementation
       begin
         if not (cs_debuginfo in aktmoduleswitches) then
          exit;
+        { include symbol that will be referenced from the program to be sure to
+          include this debuginfo .o file }
+        if current_module.is_unit then
+          begin
+            current_module.flags:=current_module.flags or uf_has_debuginfo;
+            debugList.concat(tai_symbol.Createname_global(make_mangledname('DEBUGINFO',current_module.globalsymtable,''),AT_DATA,0));
+          end
+        else
+          debugList.concat(tai_symbol.Createname_global(make_mangledname('DEBUGINFO',current_module.localsymtable,''),AT_DATA,0));
         { first write all global/local symbols to a temp list. This will flag
           all required tdefs. Afterwards this list will be added }
         vardebuglist:=taasmoutput.create;
@@ -1480,7 +1489,13 @@ implementation
 end.
 {
   $Log$
-  Revision 1.152  2004-05-16 13:29:21  peter
+  Revision 1.153  2004-05-19 21:16:13  peter
+    * add DEBUGINFO symbol to reference the .o file that includes the
+      stabs info for types and global/static variables
+    * debuginfo flag added to ppu to indicate whether debuginfo is
+      generated or not
+
+  Revision 1.152  2004/05/16 13:29:21  peter
     * fix checking for forwards in static symtable
 
   Revision 1.151  2004/05/11 18:22:16  olle

+ 8 - 1
compiler/ppu.pas

@@ -146,6 +146,7 @@ const
   uf_release       = $2000;   { unit was compiled with -Ur option }
   uf_threadvars    = $4000;   { unit has threadvars }
   uf_fpu_emulation = $8000;   { this unit was compiled with fpu emulation on }
+  uf_has_debuginfo = $10000;  { this unit has debuginfo generated }
 
 type
   ppureal=extended;
@@ -1052,7 +1053,13 @@ end;
 end.
 {
   $Log$
-  Revision 1.48  2004-04-29 19:56:37  daniel
+  Revision 1.49  2004-05-19 21:16:13  peter
+    * add DEBUGINFO symbol to reference the .o file that includes the
+      stabs info for types and global/static variables
+    * debuginfo flag added to ppu to indicate whether debuginfo is
+      generated or not
+
+  Revision 1.48  2004/04/29 19:56:37  daniel
     * Prepare compiler infrastructure for multiple ansistring types
 
   Revision 1.47  2004/03/23 22:34:49  peter