From 2b1fee21f19ea9c04e7594d0e68718aa62c48a9b Mon Sep 17 00:00:00 2001 From: peter Date: Sun, 2 May 2004 17:26:19 +0000 Subject: [PATCH] * fix stabs for globals --- compiler/ncgutil.pas | 29 +++------------- compiler/pmodules.pas | 79 +++++++++++++++++++++++-------------------- 2 files changed, 47 insertions(+), 61 deletions(-) diff --git a/compiler/ncgutil.pas b/compiler/ncgutil.pas index 65eec93814..ca64d69ec7 100644 --- a/compiler/ncgutil.pas +++ b/compiler/ncgutil.pas @@ -1785,18 +1785,6 @@ implementation if (cs_create_smart in aktmoduleswitches) then curconstSegment.concat(Tai_cut.Create); curconstSegment.concat(Tai_align.create(const_align(l))); -{$ifdef GDB} - if cs_debuginfo in aktmoduleswitches then - begin - if not sym.isstabwritten then - begin - stabstr:=sym.stabstring; - if stabstr<>nil then - curconstsegment.concat(Tai_stabs.create(stabstr)); - sym.isstabwritten:=true; - end; - end; -{$endif GDB} if (sym.owner.symtabletype=globalsymtable) or (cs_create_smart in aktmoduleswitches) or (assigned(current_procinfo) and @@ -1829,18 +1817,6 @@ implementation if (cs_create_smart in aktmoduleswitches) then bssSegment.concat(Tai_cut.Create); bssSegment.concat(Tai_align.create(varalign)); -{$ifdef GDB} - if cs_debuginfo in aktmoduleswitches then - begin - if not sym.isstabwritten then - begin - stabstr:=sym.stabstring; - if stabstr<>nil then - bsssegment.concat(Tai_stabs.create(stabstr)); - sym.isstabwritten:=true; - end; - end; -{$endif GDB} if (sym.owner.symtabletype=globalsymtable) or (cs_create_smart in aktmoduleswitches) or DLLSource or @@ -2146,7 +2122,10 @@ implementation end. { $Log$ - Revision 1.197 2004-03-29 14:43:47 peter + Revision 1.198 2004-05-02 17:26:19 peter + * fix stabs for globals + + Revision 1.197 2004/03/29 14:43:47 peter * cleaner temp get/unget for exceptions Revision 1.196 2004/03/03 22:02:52 peter diff --git a/compiler/pmodules.pas b/compiler/pmodules.pas index d0168db11e..3e456fd618 100644 --- a/compiler/pmodules.pas +++ b/compiler/pmodules.pas @@ -642,41 +642,45 @@ implementation end; end; - begin - if not (cs_debuginfo in aktmoduleswitches) then - exit; - { reset unit type info flag } - reset_unit_type_info; - { write used types from the used units } - write_used_unit_type_info(current_module); - { first write the types from this unit } - if assigned(current_module.globalsymtable) then - begin - { all types } - tglobalsymtable(current_module.globalsymtable).concattypestabto(debuglist); - { and all local symbols} - tglobalsymtable(current_module.globalsymtable).concatstabto(debuglist); - end; - if assigned(current_module.localsymtable) then - begin - { all types } - tstaticsymtable(current_module.localsymtable).concattypestabto(debuglist); - { and all local symbols} - tstaticsymtable(current_module.localsymtable).concatstabto(debuglist); - end; - if (cs_gdb_dbx in aktglobalswitches) then - begin - debugList.concat(tai_comment.Create(strpnew('EINCL of global '+ - tglobalsymtable(current_module.globalsymtable).name^+' has index '+ - tostr(tglobalsymtable(current_module.globalsymtable).unitid)))); - debugList.concat(Tai_stabs.Create(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; - end; + var + vardebuglist : taasmoutput; + begin + if not (cs_debuginfo in aktmoduleswitches) then + exit; + { 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; + if assigned(current_module.globalsymtable) then + tglobalsymtable(current_module.globalsymtable).concatstabto(vardebuglist); + if assigned(current_module.localsymtable) then + tstaticsymtable(current_module.localsymtable).concatstabto(vardebuglist); + { reset unit type info flag } + reset_unit_type_info; + { write used types from the used units } + write_used_unit_type_info(current_module); + { last write the types from this unit } + if assigned(current_module.globalsymtable) then + tglobalsymtable(current_module.globalsymtable).concattypestabto(debuglist); + if assigned(current_module.localsymtable) then + tstaticsymtable(current_module.localsymtable).concattypestabto(debuglist); + { now all defs have a type in the debuglist, we now can add the vardebuglist since + all references to defs can be solved } + debuglist.concatlist(vardebuglist); + vardebuglist.free; + { include files } + if (cs_gdb_dbx in aktglobalswitches) then + begin + debugList.concat(tai_comment.Create(strpnew('EINCL of global '+ + tglobalsymtable(current_module.globalsymtable).name^+' has index '+ + tostr(tglobalsymtable(current_module.globalsymtable).unitid)))); + debugList.concat(Tai_stabs.Create(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; + end; {$EndIf GDB} @@ -1454,7 +1458,10 @@ implementation end. { $Log$ - Revision 1.148 2004-03-24 20:24:25 hajny + Revision 1.149 2004-05-02 17:26:19 peter + * fix stabs for globals + + Revision 1.148 2004/03/24 20:24:25 hajny * OS/2 heap management modified to be able to grow heap as needed Revision 1.147 2004/03/18 11:43:57 olle