Browse Source

* more stabs fixes
* special mode -gv for valgrind compatible stabs

peter 21 years ago
parent
commit
37f3f95b59
5 changed files with 86 additions and 71 deletions
  1. 6 2
      compiler/globtype.pas
  2. 12 1
      compiler/options.pas
  3. 8 1
      compiler/pmodules.pas
  4. 50 65
      compiler/symdef.pas
  5. 10 2
      compiler/symsym.pas

+ 6 - 2
compiler/globtype.pas

@@ -74,7 +74,7 @@ interface
          cs_browser_log,
          { debugger }
          cs_gdb_dbx,cs_gdb_gsym,cs_gdb_heaptrc,cs_gdb_lineinfo,
-         cs_checkpointer,
+         cs_checkpointer,cs_gdb_valgrind,
          { assembling }
          cs_asm_leave,cs_asm_extern,cs_asm_pipe,cs_asm_source,
          cs_asm_regalloc,cs_asm_tempalloc,cs_asm_nodes,
@@ -235,7 +235,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.49  2004-02-15 16:34:18  marco
+  Revision 1.50  2004-03-10 22:52:57  peter
+    * more stabs fixes
+    * special mode -gv for valgrind compatible stabs
+
+  Revision 1.49  2004/02/15 16:34:18  marco
    * pthread on -CURRENT related fixes.
 
   Revision 1.48  2003/12/23 23:22:35  peter

+ 12 - 1
compiler/options.pas

@@ -768,6 +768,13 @@ begin
                             else
                               include(initglobalswitches,cs_checkpointer);
                           end;
+                        'v' :
+                          begin
+                            if UnsetBool(More, j) then
+                              exclude(initglobalswitches,cs_gdb_valgrind)
+                            else
+                              include(initglobalswitches,cs_gdb_valgrind);
+                          end;
                         else
                           IllegalPara(opt);
                       end;
@@ -1999,7 +2006,11 @@ finalization
 end.
 {
   $Log$
-  Revision 1.126  2004-03-02 17:32:12  florian
+  Revision 1.127  2004-03-10 22:52:57  peter
+    * more stabs fixes
+    * special mode -gv for valgrind compatible stabs
+
+  Revision 1.126  2004/03/02 17:32:12  florian
     * make cycle fixed
     + pic support for darwin
     + support of importing vars from shared libs on darwin implemented

+ 8 - 1
compiler/pmodules.pas

@@ -461,6 +461,9 @@ implementation
            { Lineinfo unit }
            if (cs_gdb_lineinfo in aktglobalswitches) then
              AddUnit('LineInfo');
+           { Lineinfo unit }
+           if (cs_gdb_valgrind in aktglobalswitches) then
+             AddUnit('CMem');
          end;
         { save default symtablestack }
         defaultsymtablestack:=symtablestack;
@@ -1444,7 +1447,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.144  2004-03-09 20:45:04  peter
+  Revision 1.145  2004-03-10 22:52:57  peter
+    * more stabs fixes
+    * special mode -gv for valgrind compatible stabs
+
+  Revision 1.144  2004/03/09 20:45:04  peter
     * more stabs updates
 
   Revision 1.143  2004/03/08 22:07:47  peter

+ 50 - 65
compiler/symdef.pas

@@ -216,7 +216,7 @@ interface
           stabsize,staballoc,recoffset:integer;
        end;
 
-       tabstractrecorddef = class(tstoreddef)
+       tabstractrecorddef= class(tstoreddef)
        private
           Count         : integer;
           FRTTIType     : trttitype;
@@ -417,7 +417,6 @@ interface
           { debug }
 {$ifdef GDB}
           function  stabstring : pchar;override;
-          procedure concatstabto(asmlist:taasmoutput);override;
 {$endif GDB}
           { rtti }
           procedure write_rtti_data(rt:trttitype);override;
@@ -1856,66 +1855,48 @@ implementation
 {$ifdef GDB}
     function torddef.stabstring : pchar;
       begin
-        case typ of
-          uvoid :
-            stabstring := strpnew(numberstring+';');
-         {GDB 4.12 for go32 doesn't like boolean as range for 0 to 1 !!!}
-{$ifdef Use_integer_types_for_boolean}
-          bool8bit,
-          bool16bit,
-          bool32bit :
-            stabstring := stabstr_evaluate('r${numberstring};0;255;',[]);
-{$else : not Use_integer_types_for_boolean}
-          uchar :
-            stabstring := strpnew('-20;');
-          uwidechar :
-            stabstring := strpnew('-30;');
-          bool8bit :
-            stabstring := strpnew('-21;');
-          bool16bit :
-            stabstring := strpnew('-22;');
-          bool32bit :
-            stabstring := strpnew('-23;');
-          u64bit :
-            stabstring := strpnew('-32;');
-          s64bit :
-            stabstring := strpnew('-31;');
-{$endif not Use_integer_types_for_boolean}
-          {u32bit : stabstring := tstoreddef(s32inttype.def).numberstring+';0;-1;'); }
-          else
-            stabstring:=stabstr_evaluate('r$1;$2;$3;',[Tstoreddef(s32inttype.def).numberstring,tostr(longint(low)),tostr(longint(high))]);
-        end;
-      end;
-
-
-    procedure torddef.concatstabto(asmlist:taasmoutput);
-      begin
-        if (stab_state in [stab_state_writing,stab_state_written]) then
-          exit;
-        if not(typ in [uvoid,
-{$ifdef Use_integer_types_for_boolean}
-             bool8bit,
-             bool16bit,
-             bool32bit
-{$else : not Use_integer_types_for_boolean}
-             uchar,
-             uwidechar,
-             bool8bit,
-             bool16bit,
-             bool32bit,
-             u64bit,
-             s64bit
-{$endif not Use_integer_types_for_boolean}
-             ]) then
+        if cs_gdb_valgrind in aktglobalswitches then
           begin
-            { prevent circular calls when bootstrapping s32inttype }
-            if (self<>s32inttype.def) and
-               (Tstoreddef(s32inttype.def).stab_state<>stab_state_written) then
-              Tstoreddef(s32inttype.def).concatstabto(asmlist);
-          end;
-        inherited concatstabto(asmlist);
+            case typ of
+              uvoid :
+                stabstring := strpnew(numberstring);
+              bool8bit,
+              bool16bit,
+              bool32bit :
+                stabstring := stabstr_evaluate('r${numberstring};0;255;',[]);
+              u32bit,
+              s64bit,
+              u64bit :
+                stabstring:=stabstr_evaluate('r${numberstring};0;-1;',[]);
+              else
+                stabstring:=stabstr_evaluate('r${numberstring};$1;$2;',[tostr(longint(low)),tostr(longint(high))]);
+            end;
+          end
+        else
+          begin
+            case typ of
+              uvoid :
+                stabstring := strpnew(numberstring);
+              uchar :
+                stabstring := strpnew('-20;');
+              uwidechar :
+                stabstring := strpnew('-30;');
+              bool8bit :
+                stabstring := strpnew('-21;');
+              bool16bit :
+                stabstring := strpnew('-22;');
+              bool32bit :
+                stabstring := strpnew('-23;');
+              u64bit :
+                stabstring := strpnew('-32;');
+              s64bit :
+                stabstring := strpnew('-31;');
+              {u32bit : stabstring := tstoreddef(s32inttype.def).numberstring+';0;-1;'); }
+              else
+                stabstring:=stabstr_evaluate('r${numberstring};$1;$2;',[tostr(longint(low)),tostr(longint(high))]);
+            end;
+         end;
       end;
-
 {$endif GDB}
 
 
@@ -2245,8 +2226,8 @@ implementation
       { the buffer part is still missing !! (PM) }
       { but the string could become too long !! }
       stabstring:=stabstr_evaluate('s${savesize}HANDLE:$1,0,32;MODE:$1,32,32;RECSIZE:$1,64,32;'+
-                                   '_PRIVATE:ar$2;1;32;$3,96,256;USERDATA:ar$2;1;16+$3,352,128;'+
-                                   'NAME:ar$2;0;255;$4,480,2048',[tstoreddef(u32inttype.def).numberstring,
+                                   '_PRIVATE:ar$2;1;32;$3,96,256;USERDATA:ar$2;1;16;$3,352,128;'+
+                                   'NAME:ar$2;0;255;$4,480,2048;;',[tstoreddef(u32inttype.def).numberstring,
                                    tstoreddef(u16inttype.def).numberstring,tstoreddef(u8inttype.def).numberstring,
                                    tstoreddef(cchartype.def).numberstring]);
    {$EndIf}
@@ -2533,7 +2514,7 @@ implementation
 {$ifdef GDB}
     function tclassrefdef.stabstring : pchar;
       begin
-         stabstring:=strpnew(tstoreddef(pvmttype.def).numberstring+';');
+         stabstring:=strpnew(tstoreddef(pvmttype.def).numberstring);
       end;
 {$endif GDB}
 
@@ -4487,7 +4468,7 @@ implementation
         getmem(nss,1024);
         { it is not a function but a function pointer !! (PM) }
 
-        strpcopy(nss,'*f'+tstoreddef(rettype.def).numberstring{+','+tostr(i)}+';');
+        strpcopy(nss,'*f'+tstoreddef(rettype.def).numberstring{+','+tostr(i)});
         { this confuses gdb !!
           we should use 'F' instead of 'f' but
           as we use c++ language mode
@@ -6089,7 +6070,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.228  2004-03-09 22:18:22  peter
+  Revision 1.229  2004-03-10 22:52:57  peter
+    * more stabs fixes
+    * special mode -gv for valgrind compatible stabs
+
+  Revision 1.228  2004/03/09 22:18:22  peter
     * first write parent classes
 
   Revision 1.227  2004/03/09 20:45:04  peter

+ 10 - 2
compiler/symsym.pas

@@ -1963,7 +1963,11 @@ implementation
           { sets are not recognized by GDB}
           {***}
       end;
-      stabstring:=stabstr_evaluate('"${name}:c=$1;",${N_FUNCTION},0,${line},0',[st]);
+      { valgrind does not support constants }
+      if cs_gdb_valgrind in aktglobalswitches then
+        stabstring:=nil
+      else
+        stabstring:=stabstr_evaluate('"${name}:c=$1;",${N_FUNCTION},0,${line},0',[st]);
     end;
 {$endif GDB}
 
@@ -2239,7 +2243,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.166  2004-03-09 20:45:04  peter
+  Revision 1.167  2004-03-10 22:52:57  peter
+    * more stabs fixes
+    * special mode -gv for valgrind compatible stabs
+
+  Revision 1.166  2004/03/09 20:45:04  peter
     * more stabs updates
 
   Revision 1.165  2004/03/08 22:07:47  peter