From 0bde38e56e27d5c76596853c71b3d2a3c58c77c2 Mon Sep 17 00:00:00 2001 From: PengZheng Date: Wed, 10 Jan 2024 15:31:05 +0800 Subject: [PATCH] Only Skip typedefs already printed when printing a dynType. --- libs/dfi/src/dyn_type.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/libs/dfi/src/dyn_type.c b/libs/dfi/src/dyn_type.c index 84e3d5f51..0ad3e330d 100644 --- a/libs/dfi/src/dyn_type.c +++ b/libs/dfi/src/dyn_type.c @@ -938,8 +938,8 @@ static void dynType_printComplex(const char* name, const dyn_type* type, int dep static void dynType_printSequence(const char* name, const dyn_type* type, int depth, FILE* stream) { dynType_printDepth(depth, stream); - fprintf(stream, "%s: sequence, size is %zu, alignment is %i, descriptor is '%c'. fields:\n", - name, type->ffiType->size, type->ffiType->alignment, type->descriptor); + fprintf(stream, "sequence, size is %zu, alignment is %i, descriptor is '%c'. fields:\n", + type->ffiType->size, type->ffiType->alignment, type->descriptor); dynType_printDepth(depth + 1, stream); fprintf(stream, "cap: simple type, size is %zu, alignment is %i.\n", @@ -999,7 +999,20 @@ static void dynType_printText(const char* name, const dyn_type* type, int depth, static void dynType_printTypes(const dyn_type* type, FILE* stream) { if (type->type == DYN_TYPE_REF) { - return; + const dyn_type* real = type->ref.ref; + while (real->type == DYN_TYPE_REF) { + real = real->ref.ref; + } + dyn_type* parent = type->parent; + struct type_entry* pentry = NULL; + while (parent != NULL) { + TAILQ_FOREACH(pentry, &parent->nestedTypesHead, entries) { + if (pentry->type == real) { + return; + } + } + parent = parent->parent; + } } struct type_entry* entry = NULL;