compiler: generate debug info for record methods:

- extended write_symtable_procdefs to handle record definitions
  - fix stabs info generator to use prefixed symbol names for record methods, also handle records static symbols the same way as for object types
  - fix dwarf info record generation: add visibility info and write methods, also prefix record members the same way as object members

git-svn-id: branches/paul/extended_records@16570 -
This commit is contained in:
paul 2010-12-16 06:12:05 +00:00
parent d83eab7ae8
commit 915c412ae3
3 changed files with 16 additions and 11 deletions

View File

@ -527,9 +527,9 @@ implementation
if assigned(tprocdef(def).localst) then if assigned(tprocdef(def).localst) then
write_symtable_procdefs(list,tprocdef(def).localst); write_symtable_procdefs(list,tprocdef(def).localst);
end; end;
objectdef : objectdef,recorddef :
begin begin
write_symtable_procdefs(list,tobjectdef(def).symtable); write_symtable_procdefs(list,tabstractrecorddef(def).symtable);
end; end;
end; end;
end; end;

View File

@ -1654,8 +1654,8 @@ implementation
procedure TDebugInfoDwarf.appenddef_record(list:TAsmList;def:trecorddef); procedure TDebugInfoDwarf.appenddef_record(list:TAsmList;def:trecorddef);
begin begin
if assigned(def.typesym) then if assigned(def.objname) then
appenddef_record_named(list,def,symname(def.typesym)) appenddef_record_named(list,def,def.objname^)
else else
appenddef_record_named(list,def,''); appenddef_record_named(list,def,'');
end; end;
@ -1674,6 +1674,11 @@ implementation
]); ]);
finish_entry; finish_entry;
def.symtable.symList.ForEachCall(@enum_membersyms_callback,nil); def.symtable.symList.ForEachCall(@enum_membersyms_callback,nil);
{ don't know whether external record declaration is allow but if it so then
do the same as we do for other object types - skip procdef info generation
for external defs (Paul Ishenin) }
if not(oo_is_external in def.objectoptions) then
write_symtable_procdefs(current_asmdata.asmlists[al_dwarf_info],def.symtable);
finish_children; finish_children;
end; end;
@ -2000,7 +2005,7 @@ implementation
in_currentunit:=def.in_currentunit; in_currentunit:=def.in_currentunit;
if not in_currentunit and if not in_currentunit and
(def.owner.symtabletype<>objectsymtable) then not (def.owner.symtabletype in [objectsymtable,recordsymtable]) then
exit; exit;
{ happens for init procdef of units without init section } { happens for init procdef of units without init section }
@ -2015,7 +2020,7 @@ implementation
defnumberlist.Add(def); defnumberlist.Add(def);
{ Write methods and only in the scope of their parent objectdefs. } { Write methods and only in the scope of their parent objectdefs. }
if (def.owner.symtabletype=objectsymtable) then if (def.owner.symtabletype in [objectsymtable,recordsymtable]) then
begin begin
{ this code can also work for nested procdefs, but is not yet { this code can also work for nested procdefs, but is not yet
activated for those because there is no clear advantage yet to activated for those because there is no clear advantage yet to
@ -2081,7 +2086,7 @@ implementation
end; end;
{ accessibility: public/private/protected } { accessibility: public/private/protected }
if (def.owner.symtabletype=objectsymtable) then if (def.owner.symtabletype in [objectsymtable,recordsymtable]) then
append_visibility(def.visibility); append_visibility(def.visibility);
{ Return type. } { Return type. }
@ -2487,7 +2492,7 @@ implementation
end; end;
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_plus_uconst))); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_plus_uconst)));
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_uleb128bit(fieldoffset)); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_uleb128bit(fieldoffset));
if (sym.owner.symtabletype=objectsymtable) then if (sym.owner.symtabletype in [objectsymtable,recordsymtable]) then
append_visibility(sym.visibility); append_visibility(sym.visibility);
append_labelentry_ref(DW_AT_type,def_dwarf_lab(def)); append_labelentry_ref(DW_AT_type,def_dwarf_lab(def));
@ -3130,7 +3135,7 @@ implementation
result:=tobjectdef(ttypesym(sym).typedef).objextname^ result:=tobjectdef(ttypesym(sym).typedef).objextname^
else if (ds_dwarf_method_class_prefix in current_settings.debugswitches) and else if (ds_dwarf_method_class_prefix in current_settings.debugswitches) and
(sym.typ=procsym) and (sym.typ=procsym) and
(tprocsym(sym).owner.symtabletype=objectsymtable) then (tprocsym(sym).owner.symtabletype in [objectsymtable,recordsymtable]) then
result:=tprocsym(sym).owner.name^+'__'+sym.name result:=tprocsym(sym).owner.name^+'__'+sym.name
else else
result:=sym.name; result:=sym.name;

View File

@ -1109,7 +1109,7 @@ implementation
RType := 'f'; RType := 'f';
if assigned(def.owner) then if assigned(def.owner) then
begin begin
if (def.owner.symtabletype = objecTSymtable) then if (def.owner.symtabletype in [ObjectSymtable,recordsymtable]) then
obj := GetSymTableName(def.owner)+'__'+GetSymName(def.procsym); obj := GetSymTableName(def.owner)+'__'+GetSymName(def.procsym);
if not(cs_gdb_valgrind in current_settings.globalswitches) and if not(cs_gdb_valgrind in current_settings.globalswitches) and
(def.owner.symtabletype=localsymtable) and (def.owner.symtabletype=localsymtable) and
@ -1197,7 +1197,7 @@ implementation
ss : ansistring; ss : ansistring;
begin begin
ss:=''; ss:='';
if (sym.owner.symtabletype=objecTSymtable) and if (sym.owner.symtabletype in [ObjectSymtable,recordsymtable]) and
(sp_static in sym.symoptions) then (sp_static in sym.symoptions) then
ss:=sym_stabstr_evaluate(sym,'"${ownername}__${name}:S$1",${N_LCSYM},0,${line},${mangledname}', ss:=sym_stabstr_evaluate(sym,'"${ownername}__${name}:S$1",${N_LCSYM},0,${line},${mangledname}',
[def_stab_number(sym.vardef)]); [def_stab_number(sym.vardef)]);