~taiite/protodump

19283baf9b7a645f7afd49fbcae72423f8c1bf2f — Hubert Hirtz 2 years ago 29b3000
Deal with incomplete type as if they are "void"

So..

    struct my_incomplete_type;
    struct mostly_complete {
        int itsanumber;
        char *nameOfTheNumber;
        struct my_incomplete_type *mostly_complete;
    };

will show up as

    struct my_incomplete_type;
    struct mostly_complete {
        int itsanumber;
        char *nameOfTheNumber;
        void *mostly_complete;
    };

which is the same thing, at least from protodump standpoint.

When reading the members of "struct mostly_complete", protodump will try
and read the definition of "struct my_incomplete_type". The problem is
that clang and gcc do not provide it, even if there is a proper
declaration of it somewhere else in your program.

This prevents protodump from trying to figure out if two types relying
on "struct my_incomplete_type" are the same when they are defined in
separate compilation units.
1 files changed, 7 insertions(+), 1 deletions(-)

M src/types.rs
M src/types.rs => src/types.rs +7 -1
@@ 632,7 632,13 @@ where
                | gimli::DW_TAG_structure_type
                | gimli::DW_TAG_subroutine_type
                | gimli::DW_TAG_union_type => {
                    underlying = Some(self.resolve_definition(unit, &entry)?);
                    if let Some(gimli::AttributeValue::Flag(true)) =
                        entry.attr_value(gimli::DW_AT_declaration)?
                    {
                        // This debug entry does not define the type. Mark it as void.
                    } else {
                        underlying = Some(self.resolve_definition(unit, &entry)?);
                    }
                    break;
                }
                gimli::DW_TAG_unspecified_type => {