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
write_symtable_procdefs(list,tprocdef(def).localst);
end;
objectdef :
objectdef,recorddef :
begin
write_symtable_procdefs(list,tobjectdef(def).symtable);
write_symtable_procdefs(list,tabstractrecorddef(def).symtable);
end;
end;
end;

View File

@ -1654,8 +1654,8 @@ implementation
procedure TDebugInfoDwarf.appenddef_record(list:TAsmList;def:trecorddef);
begin
if assigned(def.typesym) then
appenddef_record_named(list,def,symname(def.typesym))
if assigned(def.objname) then
appenddef_record_named(list,def,def.objname^)
else
appenddef_record_named(list,def,'');
end;
@ -1674,6 +1674,11 @@ implementation
]);
finish_entry;
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;
end;
@ -2000,7 +2005,7 @@ implementation
in_currentunit:=def.in_currentunit;
if not in_currentunit and
(def.owner.symtabletype<>objectsymtable) then
not (def.owner.symtabletype in [objectsymtable,recordsymtable]) then
exit;
{ happens for init procdef of units without init section }
@ -2015,7 +2020,7 @@ implementation
defnumberlist.Add(def);
{ 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
{ this code can also work for nested procdefs, but is not yet
activated for those because there is no clear advantage yet to
@ -2081,7 +2086,7 @@ implementation
end;
{ accessibility: public/private/protected }
if (def.owner.symtabletype=objectsymtable) then
if (def.owner.symtabletype in [objectsymtable,recordsymtable]) then
append_visibility(def.visibility);
{ Return type. }
@ -2487,7 +2492,7 @@ implementation
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_uleb128bit(fieldoffset));
if (sym.owner.symtabletype=objectsymtable) then
if (sym.owner.symtabletype in [objectsymtable,recordsymtable]) then
append_visibility(sym.visibility);
append_labelentry_ref(DW_AT_type,def_dwarf_lab(def));
@ -3130,7 +3135,7 @@ implementation
result:=tobjectdef(ttypesym(sym).typedef).objextname^
else if (ds_dwarf_method_class_prefix in current_settings.debugswitches) 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
else
result:=sym.name;

View File

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