[fpc-devel] debug information for Variant type

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Dec 3 14:09:48 CET 2009

On 01 Dec 2009, at 13:42, Paul Ishenin wrote:

> Jonas Maebe wrote:
>> Would it be enough if the type name were changed to "variant"? It  
>> would not be 100% safe (since "variant" is not a reserved word,  
>> anyone can declare a variable/type/... with the name "variant"),  
>> but I don't immediately see another solution.
> I think yes.

Does the attached patch work for DWARF with Lazarus? "ptype  
variantvar" still shows tvardata, but "info variantvar" shows "static  
VARIANT V;", and I don't know what the GDB MI will return for the  
query that Lazarus uses.


Index: dbgdwarf.pas
--- dbgdwarf.pas	(revision 14293)
+++ dbgdwarf.pas	(working copy)
@@ -3245,8 +3245,11 @@

      procedure TDebugInfoDwarf2.appenddef_variant(list:TAsmList;def:  
-        { variants aren't known to dwarf2 but writting tvardata  
should be enough }
-        appenddef_record(list,trecorddef(vardatadef));
+        append_entry(DW_TAG_typedef,false,[
+          DW_AT_name,DW_FORM_string,'Variant'#0
+        ]);
+        append_labelentry_ref(DW_AT_type,def_dwarf_lab(vardatadef));
+        finish_entry;

      function TDebugInfoDwarf2.dwarf_version: Word;

More information about the fpc-devel mailing list