浏览代码

* aktoutputformat removed, add new paraXX vars for target
assembler and debuginfo and use these vars to override
the defaults for the target after the parameters are read
* remove not-maintained and tested gdb code

git-svn-id: trunk@1201 -

peter 20 年之前
父节点
当前提交
ec4d287fd8

+ 1 - 4
compiler/assemble.pas

@@ -247,7 +247,7 @@ Implementation
       begin
         DoPipe:=(cs_asm_pipe in aktglobalswitches) and
                 not(cs_asm_leave in aktglobalswitches)
-                and ((aktoutputformat in [as_gas,as_darwin]));
+                and ((target_asm.id in [as_gas,as_darwin]));
       end;
 
 
@@ -1474,9 +1474,6 @@ Implementation
 
     procedure InitAssembler;
       begin
-        { target_asm is already set by readarguments }
-        initoutputformat:=target_asm.id;
-        aktoutputformat:=target_asm.id;
       end;
 
 

+ 0 - 4
compiler/fppu.pas

@@ -993,10 +993,6 @@ uses
          Message1(unit_u_ppu_write,realmodulename^);
 
          { create unit flags }
-{$ifdef GDB}
-         if cs_gdb_dbx in aktglobalswitches then
-          flags:=flags or uf_has_dbx;
-{$endif GDB}
          if cs_browser in aktmoduleswitches then
           flags:=flags or uf_has_browser;
          if cs_local_browser in aktmoduleswitches then

+ 0 - 5
compiler/gdb.pas

@@ -48,11 +48,6 @@ Const
     N_EINCL = $A2;
     N_EXCL  = $C2;
 
-    const
-       DBX_counter : plongint = nil;
-       do_count_dbx : boolean = false;
-
-
   implementation
 
 uses fmodule;

+ 6 - 3
compiler/globals.pas

@@ -136,6 +136,9 @@ interface
        outputunitdir     : dirstr;
 
        { things specified with parameters }
+       paratarget        : tsystem;
+       paratargetdbg     : tdbg;
+       paratargetasm     : tasm;
        paralinkoptions,
        paradynamiclinker : string;
        paraprintnodetree : byte;
@@ -216,7 +219,6 @@ interface
        initfputype        : tfputype;
        initasmmode        : tasmmode;
        initinterfacetype  : tinterfacetypes;
-       initoutputformat   : tasm;
        initdefproccall    : tproccalloption;
        initsourcecodepage : tcodepagestring;
 
@@ -242,7 +244,6 @@ interface
        aktfputype        : tfputype;
        aktasmmode         : tasmmode;
        aktinterfacetype   : tinterfacetypes;
-       aktoutputformat    : tasm;
        aktdefproccall     : tproccalloption;
        aktsourcecodepage : tcodepagestring;
 
@@ -2184,6 +2185,9 @@ end;
         resolving_forward:=false;
         make_ref:=false;
         LinkTypeSetExplicitly:=false;
+        paratarget:=system_none;
+        paratargetasm:=as_none;
+        paratargetdbg:=dbg_none;
 
       { Output }
         OutputFile:='';
@@ -2229,7 +2233,6 @@ end;
         initmoduleswitches:=[cs_extsyntax,cs_implicit_exceptions];
         initsourcecodepage:='8859-1';
         initglobalswitches:=[cs_check_unit_name,cs_link_static{$ifdef INTERNALLINKER},cs_link_internal,cs_link_map{$endif}];
-        initoutputformat:=target_asm.id;
         fillchar(initalignment,sizeof(talignmentinfo),0);
         { might be overridden later }
         initasmmode:=asmmode_standard;

+ 3 - 3
compiler/globtype.pas

@@ -119,9 +119,9 @@ than 255 characters. That's why using Ansi Strings}
          cs_optimize,cs_fastoptimize,cs_slowoptimize,cs_align,cs_loopunroll,
          { browser }
          cs_browser_log,
-         { debugger }
-         cs_gdb_dbx,cs_gdb_gsym,cs_gdb_heaptrc,cs_gdb_lineinfo,
-         cs_gdb_valgrind,cs_gdb_dwarf,
+         { debuginfo }
+         cs_gdb_heaptrc,cs_gdb_lineinfo,
+         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,

+ 0 - 2
compiler/ncgutil.pas

@@ -1645,8 +1645,6 @@ implementation
 {$ifdef GDB}
         if (cs_debuginfo in aktmoduleswitches) then
           begin
-            if (po_global in current_procinfo.procdef.procoptions) then
-              Tprocsym(current_procinfo.procdef.procsym).is_global:=true;
             current_procinfo.procdef.concatstabto(list);
             Tprocsym(current_procinfo.procdef.procsym).isstabwritten:=true;
           end;

+ 0 - 1
compiler/nobj.pas

@@ -1283,7 +1283,6 @@ implementation
 {$ifdef GDB}
         if (cs_debuginfo in aktmoduleswitches) then
          begin
-           do_count_dbx:=true;
            if assigned(_class.owner) and assigned(_class.owner.name) then
              asmlist[al_globals].concat(Tai_stab.create(stab_stabs,strpnew('"vmt_'+_class.owner.name^+_class.name+':S'+
                tstoreddef(vmttype.def).numberstring+'",'+tostr(N_STSYM)+',0,0,'+_class.vmt_mangledname)));

+ 24 - 50
compiler/options.pas

@@ -90,9 +90,7 @@ const
 var
   option     : toption;
   read_configfile,        { read config file, set when a cfgfile is found }
-  disable_configfile,
-  target_is_set : boolean;  { do not allow contradictory target settings }
-  asm_is_set  : boolean; { -T also change initoutputformat if not set idrectly }
+  disable_configfile : boolean;
   fpcdir,
   ppccfg,
   ppcaltcfg,
@@ -279,9 +277,7 @@ begin
      if show then
       begin
         case s[2] of
-{$ifdef GDB}
          'g',
-{$endif}
 {$ifdef Unix}
          'L',
 {$endif}
@@ -388,7 +384,6 @@ var
   d    : DirStr;
   e    : ExtStr;
   s    : string;
-  forceasm : tasm;
 begin
   if opt='' then
    exit;
@@ -453,10 +448,9 @@ begin
 
            'A' :
              begin
-               if set_target_asm_by_string(More) then
-                asm_is_set:=true
-               else
-                IllegalPara(opt);
+               paratargetasm:=find_asm_by_string(More);
+               if paratargetasm=as_none then
+                 IllegalPara(opt);
              end;
 
            'b' :
@@ -749,41 +743,30 @@ begin
                if UnsetBool(More, 0) then
                 begin
                   exclude(initmoduleswitches,cs_debuginfo);
-                  exclude(initglobalswitches,cs_gdb_dbx);
-                  exclude(initglobalswitches,cs_gdb_gsym);
                   exclude(initglobalswitches,cs_gdb_heaptrc);
                   exclude(initglobalswitches,cs_gdb_lineinfo);
                   exclude(initlocalswitches,cs_checkpointer);
                 end
                else
                 begin
-{$ifdef GDB}
                   include(initmoduleswitches,cs_debuginfo);
-{$else GDB}
-                  Message(option_no_debug_support);
-                  Message(option_no_debug_support_recompile_fpc);
-{$endif GDB}
                 end;
-{$ifdef GDB}
                if not RelocSectionSetExplicitly then
                  RelocSection:=false;
                j:=1;
                while j<=length(more) do
                  begin
                    case more[j] of
-                     'd' :
+                     'c' :
                        begin
                          if UnsetBool(More, j) then
-                           exclude(initglobalswitches,cs_gdb_dbx)
+                           exclude(initlocalswitches,cs_checkpointer)
                          else
-                           include(initglobalswitches,cs_gdb_dbx);
+                           include(initlocalswitches,cs_checkpointer);
                        end;
-                    'g' :
+                     'd' :
                        begin
-                         if UnsetBool(More, j) then
-                           exclude(initglobalswitches,cs_gdb_gsym)
-                         else
-                           include(initglobalswitches,cs_gdb_gsym);
+                         paratargetdbg:=dbg_dwarf;
                        end;
                      'h' :
                        begin
@@ -799,12 +782,9 @@ begin
                          else
                            include(initglobalswitches,cs_gdb_lineinfo);
                        end;
-                     'c' :
+                     's' :
                        begin
-                         if UnsetBool(More, j) then
-                           exclude(initlocalswitches,cs_checkpointer)
-                         else
-                           include(initlocalswitches,cs_checkpointer);
+                         paratargetdbg:=dbg_stabs;
                        end;
                      'v' :
                        begin
@@ -813,19 +793,11 @@ begin
                          else
                            include(initglobalswitches,cs_gdb_valgrind);
                        end;
-                     'w' :
-                       begin
-                         if UnsetBool(More, j) then
-                           exclude(initglobalswitches,cs_gdb_dwarf)
-                         else
-                           include(initglobalswitches,cs_gdb_dwarf);
-                       end;
                      else
                        IllegalPara(opt);
                    end;
                    inc(j);
                  end;
-{$endif GDB}
              end;
 
            'h' :
@@ -1028,22 +1000,18 @@ begin
            'T' :
              begin
                more:=Upper(More);
-               if not target_is_set then
+               if paratarget=system_none then
                 begin
                   { remove old target define }
                   TargetDefines(false);
-                  { Save assembler if set }
-                  if asm_is_set then
-                   forceasm:=target_asm.id;
                   { load new target }
-                  if not(set_target_by_string(More)) then
+                  paratarget:=find_system_by_string(More);
+                  if paratarget<>system_none then
+                    set_target(paratarget)
+                  else
                     IllegalPara(opt);
-                  { also initialize assembler if not explicitly set }
-                  if asm_is_set then
-                   set_target_asm(forceasm);
                   { set new define }
                   TargetDefines(true);
-                  target_is_set:=true;
                 end
                else
                 if More<>upper(target_info.shortname) then
@@ -1935,8 +1903,6 @@ begin
     read_configfile := false;
 
 { Read commandline and configfile }
-  target_is_set:=false;
-  asm_is_set:=false;
   param_file:='';
 
   { read configfile }
@@ -2099,6 +2065,14 @@ begin
   objectsearchpath.AddList(unitsearchpath,false);
   librarysearchpath.AddList(unitsearchpath,false);
 
+  { maybe override debug info format }
+  if (paratargetdbg<>dbg_none) then
+    set_target_dbg(paratargetdbg);
+
+  { maybe override assembler }
+  if (paratargetasm<>as_none) then
+    set_target_asm(paratargetasm);
+
   { switch assembler if it's binary and we got -a on the cmdline }
   if (cs_asm_leave in initglobalswitches) and
      (af_outputbinary in target_asm.flags) then

+ 0 - 16
compiler/parser.pas

@@ -329,7 +329,6 @@ implementation
           oldaktpackenum       : shortint;
           oldaktmaxfpuregisters : longint;
           oldaktalignment  : talignmentinfo;
-          oldaktoutputformat : tasm;
           oldaktspecificoptprocessor,
           oldaktoptprocessor : tprocessors;
           oldaktfputype      : tfputype;
@@ -340,9 +339,6 @@ implementation
           oldcurrent_procinfo : tprocinfo;
           oldaktdefproccall : tproccalloption;
           oldsourcecodepage : tcodepagestring;
-{$ifdef GDB}
-          store_dbx : plongint;
-{$endif GDB}
         end;
 
       var
@@ -395,17 +391,12 @@ implementation
             oldaktpackrecords:=aktpackrecords;
             oldaktfputype:=aktfputype;
             oldaktmaxfpuregisters:=aktmaxfpuregisters;
-            oldaktoutputformat:=aktoutputformat;
             oldaktoptprocessor:=aktoptprocessor;
             oldaktspecificoptprocessor:=aktspecificoptprocessor;
             oldaktasmmode:=aktasmmode;
             oldaktinterfacetype:=aktinterfacetype;
             oldaktfilepos:=aktfilepos;
             oldaktmodeswitches:=aktmodeswitches;
-{$ifdef GDB}
-            store_dbx:=dbx_counter;
-            dbx_counter:=nil;
-{$endif GDB}
           end;
        { show info }
          Message1(parser_i_compiling,filename);
@@ -453,8 +444,6 @@ implementation
          aktfputype:=initfputype;
          aktpackenum:=initpackenum;
          aktpackrecords:=0;
-         aktoutputformat:=initoutputformat;
-         set_target_asm(aktoutputformat);
          aktoptprocessor:=initoptprocessor;
          aktspecificoptprocessor:=initspecificoptprocessor;
          aktasmmode:=initasmmode;
@@ -567,8 +556,6 @@ implementation
                    aktpackenum:=oldaktpackenum;
                    aktpackrecords:=oldaktpackrecords;
                    aktmaxfpuregisters:=oldaktmaxfpuregisters;
-                   aktoutputformat:=oldaktoutputformat;
-                   set_target_asm(aktoutputformat);
                    aktoptprocessor:=oldaktoptprocessor;
                    aktspecificoptprocessor:=oldaktspecificoptprocessor;
                    aktfputype:=oldaktfputype;
@@ -578,9 +565,6 @@ implementation
                    aktmodeswitches:=oldaktmodeswitches;
                    aktexceptblock:=0;
                    exceptblockcounter:=0;
-  {$ifdef GDB}
-                   dbx_counter:=store_dbx;
-  {$endif GDB}
                  end;
              end
            else

+ 0 - 13
compiler/pmodules.pas

@@ -776,19 +776,6 @@ implementation
           tglobalsymtable(current_module.globalsymtable).concattypestabto(asmlist[al_debugtypes]);
         if assigned(current_module.localsymtable) then
           tstaticsymtable(current_module.localsymtable).concattypestabto(asmlist[al_debugtypes]);
-        { include files }
-        if (cs_gdb_dbx in aktglobalswitches) then
-          begin
-            asmlist[al_debugtypes].concat(tai_comment.Create(strpnew('EINCL of global '+
-              tglobalsymtable(current_module.globalsymtable).name^+' has index '+
-              tostr(tglobalsymtable(current_module.globalsymtable).moduleid))));
-            asmlist[al_debugtypes].concat(Tai_stab.create(stab_stabs,strpnew('"'+
-              tglobalsymtable(current_module.globalsymtable).name^+'",'+
-              tostr(N_EINCL)+',0,0,0')));
-            tglobalsymtable(current_module.globalsymtable).dbx_count_ok:={true}false;
-            dbx_counter:=tglobalsymtable(current_module.globalsymtable).prev_dbx_counter;
-            do_count_dbx:=false;
-          end;
         aktfilepos:=storefilepos;
       end;
 {$EndIf GDB}

+ 2 - 2
compiler/powerpc/agppcmpw.pas

@@ -1207,7 +1207,7 @@ interface
       DoAssemble:=Inherited DoAssemble;
       (*
       { masm does not seem to recognize specific extensions and uses .obj allways PM }
-      if (aktoutputformat = as_i386_masm) then
+      if (target_asm.id = as_i386_masm) then
         begin
           if not(cs_asm_extern in aktglobalswitches) then
             begin
@@ -1230,7 +1230,7 @@ interface
       (*
       AsmWriteLn(#9'.386p');
       { masm 6.11 does not seem to like LOCALS PM }
-      if (aktoutputformat = as_i386_tasm) then
+      if (target_asm.id = as_i386_tasm) then
         begin
           AsmWriteLn(#9'LOCALS '+target_asm.labelprefix);
         end;

+ 0 - 4
compiler/powerpc/nppccal.pas

@@ -41,10 +41,6 @@ implementation
       globtype,systems,
       cutils,verbose,globals,
       symconst,symbase,symsym,symtable,defutil,paramgr,parabase,
-{$ifdef GDB}
-      strings,
-      gdb,
-{$endif GDB}
       cgbase,pass_2,
       cpuinfo,cpubase,aasmbase,aasmtai,aasmcpu,
       nmem,nld,ncnv,

+ 0 - 4
compiler/powerpc64/nppccal.pas

@@ -38,10 +38,6 @@ uses
   globtype, systems,
   cutils, verbose, globals,
   symconst, symbase, symsym, symtable, defutil, paramgr, parabase,
-{$IFDEF GDB}
-  strings,
-  gdb,
-{$ENDIF GDB}
   cgbase, pass_2,
   cpuinfo, cpubase, aasmbase, aasmtai, aasmcpu,
   nmem, nld, ncnv,

+ 2 - 4
compiler/ppu.pas

@@ -73,7 +73,6 @@ const
   iblinkotherofiles      = 8;
   iblinkotherstaticlibs  = 9;
   iblinkothersharedlibs  = 10;
-  ibdbxcount             = 11;
   ibsymref               = 12;
   ibdefref               = 13;
   ibendsymtablebrowser   = 14;
@@ -134,7 +133,6 @@ const
   uf_init          = $1;
   uf_finalize      = $2;
   uf_big_endian    = $4;
-  uf_has_dbx       = $8;
   uf_has_browser   = $10;
   uf_in_library    = $20;     { is the file in another file than <ppufile>.* ? }
   uf_smart_linked  = $40;     { the ppu can be smartlinked }
@@ -152,8 +150,8 @@ const
   uf_local_symtable = $20000; { this unit has a local symtable stored }
   uf_uses_variants  = $40000; { this unit uses variants }
   uf_has_resourcefiles = $80000; { this unit has external resources (using $R directive)}
-  
-  
+
+
 type
   ppureal=extended;
 

+ 0 - 15
compiler/scandir.pas

@@ -671,20 +671,6 @@ implementation
         do_delphiswitch('P');
       end;
 
-    procedure dir_output_format;
-      begin
-        if not current_module.in_global then
-         Message(scan_w_switch_is_global)
-        else
-          begin
-            current_scanner.skipspace;
-            if set_target_asm_by_string(current_scanner.readid) then
-             aktoutputformat:=target_asm.id
-            else
-             Message1(scan_w_illegal_switch,pattern);
-          end;
-      end;
-
     procedure dir_overflowchecks;
       begin
         do_delphiswitch('Q');
@@ -1145,7 +1131,6 @@ implementation
         AddDirective('OBJECTCHECKS',directive_all, @dir_objectchecks);
         AddDirective('OBJECTPATH',directive_all, @dir_objectpath);
         AddDirective('OPENSTRINGS',directive_all, @dir_openstrings);
-        AddDirective('OUTPUT_FORMAT',directive_all, @dir_output_format);
         AddDirective('OVERFLOWCHECKS',directive_all, @dir_overflowchecks);
         AddDirective('PACKENUM',directive_all, @dir_packenum);
         AddDirective('PACKRECORDS',directive_all, @dir_packrecords);

+ 7 - 40
compiler/symdef.pas

@@ -1075,13 +1075,7 @@ implementation
          ppufile.putderef(inittablesymderef);
 {$ifdef GDB}
         if globalnb=0 then
-          begin
-            if (cs_gdb_dbx in aktglobalswitches) and
-               assigned(owner) then
-              globalnb := owner.getnewtypecount
-            else
-              set_globalnb;
-          end;
+          set_globalnb;
 {$endif GDB}
       end;
 
@@ -1182,20 +1176,8 @@ implementation
           stab_state:=stab_state_used;
         { Need a new number? }
         if globalnb=0 then
-          begin
-            if (cs_gdb_dbx in aktglobalswitches) and
-               assigned(owner) then
-              globalnb := owner.getnewtypecount
-            else
-              set_globalnb;
-          end;
-        if (cs_gdb_dbx in aktglobalswitches) and
-           assigned(typesym) and
-           (ttypesym(typesym).owner.symtabletype in [staticsymtable,globalsymtable]) and
-           (ttypesym(typesym).owner.iscurrentunit) then
-          result:='('+tostr(tabstractunitsymtable(ttypesym(typesym).owner).moduleid)+','+tostr(tstoreddef(ttypesym(typesym).restype.def).globalnb)+')'
-        else
-          result:=tostr(globalnb);
+          set_globalnb;
+        result:=tostr(globalnb);
       end;
 
 
@@ -1228,21 +1210,6 @@ implementation
       begin
         if (stab_state in [stab_state_writing,stab_state_written]) then
           exit;
-        If cs_gdb_dbx in aktglobalswitches then
-          begin
-            { otherwise you get two of each def }
-            If assigned(typesym) then
-              begin
-                if (ttypesym(typesym).owner = nil) or
-                   ((ttypesym(typesym).owner.symtabletype = globalsymtable) and
-                    tglobalsymtable(ttypesym(typesym).owner).dbx_count_ok)  then
-                  begin
-                    {with DBX we get the definition from the other objects }
-                    stab_state := stab_state_written;
-                    exit;
-                  end;
-              end;
-          end;
         { to avoid infinite loops }
         stab_state := stab_state_writing;
         stab_str := allstabstring;
@@ -4353,7 +4320,7 @@ implementation
       begin
         obj := procsym.name;
         info := '';
-        if tprocsym(procsym).is_global then
+        if (po_global in procoptions) then
           RType := 'F'
         else
           RType := 'f';
@@ -5218,9 +5185,9 @@ implementation
       begin
 {$warning TODO Remove getparentdef hack}
         { With 2 forward declared classes with the child class before the
-	  parent class the child class is written earlier to the ppu. Leaving it
-	  possible to have a reference to the parent class for property overriding,
-	  but the parent class still has the childof not resolved yet (PFV) }
+          parent class the child class is written earlier to the ppu. Leaving it
+          possible to have a reference to the parent class for property overriding,
+          but the parent class still has the childof not resolved yet (PFV) }
         if childof=nil then
           childof:=tobjectdef(childofderef.resolve);
         result:=childof;

+ 3 - 21
compiler/symsym.pas

@@ -95,9 +95,6 @@ interface
           function getprocdef(nr:cardinal):Tprocdef;
        public
           procdef_count : byte;
-{$ifdef GDB}
-          is_global : boolean;
-{$endif GDB}
           overloadchecked : boolean;
           property procdef[nr:cardinal]:Tprocdef read getprocdef;
           constructor create(const n : string);
@@ -604,9 +601,6 @@ implementation
          pdlistfirst:=nil;
          pdlistlast:=nil;
          owner:=nil;
-{$ifdef GDB}
-         is_global:=false;
-{$endif GDB}
          { the tprocdef have their own symoptions, make the procsym
            always visible }
          symoptions:=[sp_public];
@@ -631,9 +625,6 @@ implementation
             ppufile.getderef(pdderef);
             addprocdef_deref(pdderef);
           end;
-{$ifdef GDB}
-         is_global:=false;
-{$endif GDB}
          overloadchecked:=false;
       end;
 
@@ -1510,10 +1501,7 @@ implementation
             if (sp_static in symoptions) then
               begin
                 st:=tstoreddef(vartype.def).numberstring;
-                if (cs_gdb_gsym in aktglobalswitches) then
-                  st:='G'+st
-                else
-                  st:='S'+st;
+                st:='S'+st;
                 stabstring:=stabstr_evaluate('"${ownername}__${name}:$1",${N_LCSYM},0,${line},${mangledname}',[st]);
               end;
           end;
@@ -1683,10 +1671,7 @@ implementation
               because with G GDB doesn't look at the address field
               but searches the same name or with a leading underscore
               but these names don't exist in pascal !}
-            if (cs_gdb_gsym in aktglobalswitches) then
-              st:='G'+st
-            else
-              st:='S'+st;
+            st:='S'+st;
             stabstring:=stabstr_evaluate('"${name}:$1",${N_LCSYM},0,${line},${mangledname}$2',[st,threadvaroffset]);
           end;
       end;
@@ -2101,10 +2086,7 @@ implementation
     var st:char;
 
     begin
-      if (cs_gdb_gsym in aktglobalswitches) and (owner.symtabletype=globalsymtable) then
-        st:='G'
-      else
-        st:='S';
+      st:='S';
       stabstring:=stabstr_evaluate('"${name}:$1$2",${N_STSYM},0,${line},${mangledname}',
                   [st,Tstoreddef(typedconsttype.def).numberstring]);
     end;

+ 1 - 121
compiler/symtable.pas

@@ -132,11 +132,6 @@ interface
 
        tabstractunitsymtable = class(tstoredsymtable)
        public
-{$ifdef GDB}
-          dbx_count : longint;
-          prev_dbx_counter : plongint;
-          dbx_count_ok : boolean;
-{$endif GDB}
           constructor create(const n : string;id:word);
 {$ifdef GDB}
           procedure concattypestabto(asmlist : taasmoutput);
@@ -1347,12 +1342,6 @@ implementation
         inherited create(n);
         moduleid:=id;
         symsearch.usehash;
-{$ifdef GDB}
-         { reset GDB things }
-         prev_dbx_counter := dbx_counter;
-         dbx_counter := nil;
-         dbx_count := -1;
-{$endif GDB}
       end;
 
 
@@ -1395,51 +1384,14 @@ implementation
 
         var
           old_writing_def_stabs : boolean;
-          prev_dbx_count : plongint;
         begin
            if not assigned(name) then
              name := stringdup('Main_program');
            asmList.concat(tai_comment.Create(strpnew('Begin unit '+name^+' has index '+tostr(moduleid))));
-           if cs_gdb_dbx in aktglobalswitches then
-             begin
-                if dbx_count_ok then
-                  begin
-                     asmList.concat(tai_comment.Create(strpnew('"repeated" unit '+name^
-                              +' has index '+tostr(moduleid)+' dbx count = '+tostr(dbx_count))));
-                     asmList.concat(Tai_stab.create(stab_stabs,strpnew('"'+name^+'",'
-                       +tostr(N_EXCL)+',0,0,'+tostr(dbx_count))));
-                     exit;
-                  end
-                else if not iscurrentunit then
-                  begin
-                    prev_dbx_count := dbx_counter;
-                    dbx_counter := nil;
-                    do_count_dbx:=false;
-                    if (symtabletype = globalsymtable) then
-                      asmList.concat(Tai_stab.create(stab_stabs,strpnew('"'+name^+'",'+tostr(N_BINCL)+',0,0,0')));
-                    dbx_counter := @dbx_count;
-                    dbx_count:=0;
-                    do_count_dbx:=assigned(dbx_counter);
-                  end;
-             end;
-
            old_writing_def_stabs:=writing_def_stabs;
            writing_def_stabs:=true;
            dowritestabs(asmlist,self);
            writing_def_stabs:=old_writing_def_stabs;
-
-           if cs_gdb_dbx in aktglobalswitches then
-             begin
-                if not iscurrentunit then
-                  begin
-                    dbx_counter := prev_dbx_count;
-                    do_count_dbx:=false;
-                    asmList.concat(Tai_stab.create(stab_stabs,strpnew('"'+name^+'",'
-                      +tostr(N_EINCL)+',0,0,0')));
-                    do_count_dbx:=assigned(dbx_counter);
-                    dbx_count_ok := {true}false;
-                  end;
-             end;
            asmList.concat(tai_comment.Create(strpnew('End unit '+name^+' has index '+tostr(moduleid))));
         end;
 {$endif GDB}
@@ -1526,40 +1478,11 @@ implementation
          inherited create(n,id);
          symtabletype:=globalsymtable;
          symtablelevel:=main_program_level;
-{$ifdef GDB}
-         if cs_gdb_dbx in aktglobalswitches then
-           begin
-             dbx_count := 0;
-             unittypecount:=1;
-             pglobaltypecount := @unittypecount;
-             {moduleid:=current_module.unitcount;}
-             {al_debugtypes.concat(tai_comment.Create(strpnew('Global '+name^+' has index '+tostr(moduleid))));
-             al_debugtypes.concat(Tai_stab.create(stab_stabs,strpnew('"'+name^+'",'+tostr(N_BINCL)+',0,0,0')));}
-             {inc(current_module.unitcount);}
-             { we can't use dbx_vcount, because we don't know
-               if the object file will be loaded before or afeter PM }
-             dbx_count_ok:=false;
-             dbx_counter:=@dbx_count;
-             do_count_dbx:=true;
-           end;
-{$endif GDB}
       end;
 
 
     procedure tglobalsymtable.ppuload(ppufile:tcompilerppufile);
-{$ifdef GDB}
-      var
-        b : byte;
-{$endif GDB}
       begin
-{$ifdef GDB}
-         if cs_gdb_dbx in aktglobalswitches then
-           begin
-              UnitTypeCount:=1;
-              PglobalTypeCount:=@UnitTypeCount;
-           end;
-{$endif GDB}
-
          next:=symtablestack;
          symtablestack:=self;
 
@@ -1570,29 +1493,6 @@ implementation
 
          { restore symtablestack }
          symtablestack:=next;
-
-         { read dbx count }
-{$ifdef GDB}
-        if (current_module.flags and uf_has_dbx)<>0 then
-         begin
-           b:=ppufile.readentry;
-           if b<>ibdbxcount then
-             Message(unit_f_ppu_dbx_count_problem)
-           else
-             dbx_count:=ppufile.getlongint;
-{$IfDef EXTDEBUG}
-           writeln('Read dbx_count ',dbx_count,' in unit ',name^,'.ppu');
-{$ENDIF EXTDEBUG}
-           { we can't use dbx_vcount, because we don't know
-             if the object file will be loaded before or afeter PM }
-           dbx_count_ok := {true}false;
-         end
-        else
-         begin
-           dbx_count:=-1;
-           dbx_count_ok:=false;
-         end;
-{$endif GDB}
       end;
 
 
@@ -1600,20 +1500,6 @@ implementation
       begin
         { write the symtable entries }
         inherited ppuwrite(ppufile);
-
-        { write dbx count }
-{$ifdef GDB}
-        if cs_gdb_dbx in aktglobalswitches then
-         begin
-{$IfDef EXTDEBUG}
-           writeln('Writing dbx_count ',dbx_count,' in unit ',name^,'.ppu');
-{$ENDIF EXTDEBUG}
-           ppufile.do_crc:=false;
-           ppufile.putlongint(dbx_count);
-           ppufile.writeentry(ibdbxcount);
-           ppufile.do_crc:=true;
-         end;
-{$endif GDB}
       end;
 
 
@@ -1653,13 +1539,7 @@ implementation
 {$ifdef GDB}
    function tglobalsymtable.getnewtypecount : word;
       begin
-         if not (cs_gdb_dbx in aktglobalswitches) then
-           getnewtypecount:=inherited getnewtypecount
-         else
-           begin
-              getnewtypecount:=unittypecount;
-              inc(unittypecount);
-           end;
+        getnewtypecount:=inherited getnewtypecount
       end;
 {$endif}
 

+ 12 - 12
compiler/systems.pas

@@ -352,9 +352,9 @@ interface
     function set_target_res(t:tres):boolean;
     function set_target_dbg(t:tdbg):boolean;
 
-    function set_target_by_string(const s : string) : boolean;
-    function set_target_asm_by_string(const s : string) : boolean;
-    function set_target_dbg_by_string(const s : string) : boolean;
+    function find_system_by_string(const s : string) : tsystem;
+    function find_asm_by_string(const s : string) : tasm;
+    function find_dbg_by_string(const s : string) : tdbg;
 
     procedure set_source_info(const ti : tsysteminfo);
 
@@ -497,52 +497,52 @@ begin
 end;
 
 
-function set_target_by_string(const s : string) : boolean;
+function find_system_by_string(const s : string) : tsystem;
 var
   hs : string;
   t  : tsystem;
 begin
-  result:=false;
+  result:=system_none;
   hs:=upper(s);
   for t:=low(tsystem) to high(tsystem) do
    if assigned(targetinfos[t]) and
       (upper(targetinfos[t]^.shortname)=hs) then
     begin
-      result:=set_target(t);
+      result:=t;
       exit;
     end;
 end;
 
 
-function set_target_asm_by_string(const s : string) : boolean;
+function find_asm_by_string(const s : string) : tasm;
 var
   hs : string;
   t  : tasm;
 begin
-  result:=false;
+  result:=as_none;
   hs:=upper(s);
   for t:=low(tasm) to high(tasm) do
    if assigned(asminfos[t]) and
       (asminfos[t]^.idtxt=hs) then
     begin
-      result:=set_target_asm(t);
+      result:=t;
       exit;
     end;
 end;
 
 
-function set_target_dbg_by_string(const s : string) : boolean;
+function find_dbg_by_string(const s : string) : tdbg;
 var
   hs : string;
   t  : tdbg;
 begin
-  result:=false;
+  result:=dbg_none;
   hs:=upper(s);
   for t:=low(tdbg) to high(tdbg) do
    if assigned(dbginfos[t]) and
       (dbginfos[t]^.idtxt=hs) then
     begin
-      result:=set_target_dbg(t);
+      result:=t;
       exit;
     end;
 end;

+ 0 - 3
compiler/systems/t_bsd.pas

@@ -31,9 +31,6 @@ interface
 implementation
 
   uses
-{$ifdef gdb}
-    gdb,
-{$endif gdb}
     cutils,cclasses,
     verbose,systems,globtype,globals,
     symconst,script,

+ 3 - 3
compiler/systems/t_win.pas

@@ -263,7 +263,7 @@ implementation
          lidata4,lidata5 : tasmlabel;
          href : treference;
       begin
-         if (aktoutputformat in [as_i386_masm,as_i386_tasm,as_i386_nasmwin32]) then
+         if (target_asm.id in [as_i386_masm,as_i386_tasm,as_i386_nasmwin32]) then
           begin
             generatenasmlib;
             exit;
@@ -421,7 +421,7 @@ implementation
 {$endif GDB}
          href : treference;
       begin
-         if (aktoutputformat in [as_i386_masm,as_i386_tasm,as_i386_nasmwin32]) then
+         if (target_asm.id in [as_i386_masm,as_i386_tasm,as_i386_nasmwin32]) then
           begin
             generatenasmlib;
             exit;
@@ -700,7 +700,7 @@ implementation
           exportfromlist(texported_item(EList_indexed.Items[i]));
          EList_indexed.Free;
 
-         if (aktoutputformat in [as_i386_masm,as_i386_tasm,as_i386_nasmwin32]) then
+         if (target_asm.id in [as_i386_masm,as_i386_tasm,as_i386_nasmwin32]) then
           begin
             generatenasmlib;
             exit;

+ 10 - 10
compiler/x86/agx86int.pas

@@ -174,7 +174,7 @@ implementation
             AsmWrite('[');
            if assigned(symbol) then
             begin
-              if (aktoutputformat = as_i386_tasm) then
+              if (target_asm.id = as_i386_tasm) then
                 AsmWrite('dword ptr ');
               AsmWrite(symbol.name);
               first:=false;
@@ -306,7 +306,7 @@ implementation
           begin
             if o.ref^.refaddr=addr_no then
               begin
-                if (aktoutputformat <> as_i386_tasm) then
+                if (target_asm.id <> as_i386_tasm) then
                   begin
                     if s=S_FAR then
                       AsmWrite('far ptr ')
@@ -476,7 +476,7 @@ implementation
              begin
                if tai_section(hp).sectype<>sec_none then
                 begin
-                  if aktoutputformat=as_x86_64_masm then
+                  if target_asm.id=as_x86_64_masm then
                     begin
                       if LasTSecType<>sec_none then
                         AsmWriteLn(secnamesml64[LasTSecType]+#9#9'ENDS');
@@ -698,7 +698,7 @@ implementation
                   { nasm prefers prefix on a line alone
                   AsmWriteln(#9#9+prefix); but not masm PM
                   prefix:=''; }
-                  if aktoutputformat in [as_i386_nasmcoff,as_i386_nasmwin32,as_i386_nasmwdosx,
+                  if target_asm.id in [as_i386_nasmcoff,as_i386_nasmwin32,as_i386_nasmwdosx,
                     as_i386_nasmelf,as_i386_nasmobj,as_i386_nasmbeos] then
                      begin
                        AsmWriteln(prefix);
@@ -707,7 +707,7 @@ implementation
                 end
                else
                 prefix:= '';
-               if (aktoutputformat = as_i386_wasm) and
+               if (target_asm.id = as_i386_wasm) and
                  (taicpu(hp).opsize=S_W) and
                  (taicpu(hp).opcode=A_PUSH) and
                  (taicpu(hp).oper[0]^.typ=top_const) then
@@ -715,7 +715,7 @@ implementation
                    AsmWriteln(#9#9'DB 66h,68h ; pushw imm16');
                    AsmWrite(#9#9'DW');
                  end
-               else if (aktoutputformat=as_x86_64_masm) and
+               else if (target_asm.id=as_x86_64_masm) and
                  (taicpu(hp).opcode=A_MOVQ) then
                  AsmWrite(#9#9'mov')
                else
@@ -817,7 +817,7 @@ implementation
       begin
         if tasmsymbol(p).defbind=AB_EXTERNAL then
           begin
-            case aktoutputformat of
+            case target_asm.id of
               as_i386_masm,as_i386_wasm:
                 currentasmlist.AsmWriteln(#9'EXTRN'#9+p.name
                   +': NEAR');
@@ -842,7 +842,7 @@ implementation
     begin
       DoAssemble:=Inherited DoAssemble;
       { masm does not seem to recognize specific extensions and uses .obj allways PM }
-      if (aktoutputformat in [as_i386_masm,as_i386_wasm]) then
+      if (target_asm.id in [as_i386_masm,as_i386_wasm]) then
         begin
           if not(cs_asm_extern in aktglobalswitches) then
             begin
@@ -868,11 +868,11 @@ implementation
        comment(v_info,'Start writing intel-styled assembler output for '+current_module.mainsource^);
 {$endif}
       LasTSecType:=sec_none;
-      if aktoutputformat<>as_x86_64_masm then
+      if target_asm.id<>as_x86_64_masm then
         begin
           AsmWriteLn(#9'.386p');
           { masm 6.11 does not seem to like LOCALS PM }
-          if (aktoutputformat = as_i386_tasm) then
+          if (target_asm.id = as_i386_tasm) then
             begin
               AsmWriteLn(#9'LOCALS '+target_asm.labelprefix);
             end;