From 8321a9c4e9679c2b9e83268652a59df585b8a7f5 Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Wed, 23 Oct 2024 20:32:33 -0500 Subject: [PATCH] Update dump_df_globals.rb allow `--size` option to output the size in the extended table for images with an extended table --- dump_df_globals.rb | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/dump_df_globals.rb b/dump_df_globals.rb index 1a18d2b..c32f4f7 100644 --- a/dump_df_globals.rb +++ b/dump_df_globals.rb @@ -225,6 +225,9 @@ def dfhack_names(n) off = table_start + elems*bits/8 global = {} +if extended + global_size = {} +end global[off] = 'global_table' while true @@ -239,6 +242,10 @@ def dfhack_names(n) break if ptr_str == 0 name = dasm.decode_strz(ptr_str) global[ptr_var] = name + if extended + global_size[ptr_var] = size + $stderr.puts "#{name} #{size}\n" + end end ptr_prev = 0 @@ -253,10 +260,14 @@ def dfhack_names(n) case dump_fmt when 'xml' if not dump_size - out << "" + out << "" else - size = ptr_prev > 0 ? (ptr_prev-ptr_var) : 0 - out << "" + if extended + size = global_size[ptr_var] || 0 + else + size = ptr_prev > 0 ? (ptr_prev-ptr_var) : 0 + end + out << "" ptr_prev = ptr_var end when 'idc'