Skip to content
  • Joel Brobecker's avatar
    treat Ada DW_TAG_unspecified_type DIEs as stub types · 74a2f8ff
    Joel Brobecker authored
    Consider the gdb.ada/taft_type.exp testcase, which exercises
    the situation where a variable is defined using a type which
    is a pointer to an incomplete type, with the actual type
    definition being provided by another unit. Up to now, the
    strategy used by GNAT when generating the DWARF debugging info
    was to produce a incomplete DW_TAG_enumeration_type DIE with
    a DW_AT_declaration flag attached to it:
    
            .uleb128 0x4    # (DIE (0x3e) DW_TAG_enumeration_type)
            .long   .LASF4  # DW_AT_name: "pck__empty"
                            # DW_AT_declaration
    
    However, a more standard way for the compiler to describe
    this kind of type is to use the DW_TAG_unspecified_type tag.
    When the compiler is enhanced to do so, we'll need to treat
    such types as stubs -- we only do so with types from Ada units,
    however, as the meaning of this TAG is intentionally left
    permissive and language-specific by the DWARF standard.
    
    Without this patch, running the testcase above with an enhanced
    compiler now yields:
    
        (gdb) print w.e.all
        Attempt to dereference a generic pointer.
        FAIL: gdb.ada/taft_type.exp: print w.e.all
    
    gdb/ChangeLog:
    
    	* dwarf2read.c (read_unspecified_type): Treat
            DW_TAG_enumeration_type DIEs from Ada units as stubs.
    
    Tested on x86_64-linux, fixes the FAIL in gdb.ada/taft_type.exp above.
    74a2f8ff
To find the state of this project's repository at the time of any of these versions, check out the tags.