From 88c951762929729911539cd7bc98fb2ca4ffca7a Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 4 Jun 2021 14:59:15 +0900 Subject: [PATCH] [qfprogs] Dump class ivars when dumping modules --- tools/qfcc/source/dump_modules.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tools/qfcc/source/dump_modules.c b/tools/qfcc/source/dump_modules.c index 7516f323b..0fcda6e50 100644 --- a/tools/qfcc/source/dump_modules.c +++ b/tools/qfcc/source/dump_modules.c @@ -46,6 +46,29 @@ #include "tools/qfcc/include/qfprogs.h" +static void +dump_ivars (progs_t *pr, pr_ivar_list_t *ivars) +{ + if (!ivars || !ivars->ivar_count) { + puts (" { }"); + return; + } + puts (" {"); + for (int i = 0; i < ivars->ivar_count; i++) { + const char *name = ""; + const char *type = ""; + if (PR_StringValid (pr, ivars->ivar_list[i].ivar_name)) { + name = PR_GetString (pr, ivars->ivar_list[i].ivar_name); + } + if (PR_StringValid (pr, ivars->ivar_list[i].ivar_type)) { + type = PR_GetString (pr, ivars->ivar_list[i].ivar_type); + } + printf (" %d %s %s\n", ivars->ivar_list[i].ivar_offset, + name, type); + } + puts (" }"); +} + static void dump_methods (progs_t *pr, pr_method_list_t *methods, int class) { @@ -158,6 +181,7 @@ dump_class (progs_t *pr, pr_class_t *class) printf (" meta:%x verion:%d info:%u size:%d\n", class->class_pointer, class->version, class->info, class->instance_size); + dump_ivars (pr, &G_STRUCT (pr, pr_ivar_list_t, class->ivars)); dump_methods (pr, &G_STRUCT (pr, pr_method_list_t, class->methods), 0); dump_methods (pr, &G_STRUCT (pr, pr_method_list_t, meta->methods), 1); printf (" %x\n", class->protocols);