From 40ae7d96500f0ffac66f77d1426d4d5387561183 Mon Sep 17 00:00:00 2001 From: Alan Wu Date: Mon, 3 Mar 2025 18:54:08 -0500 Subject: [PATCH] .gdbinit: Fix T_HASH printing [ci skip] Tested and it works with both AR and ST tables, with live process and core dumps. --- .gdbinit | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.gdbinit b/.gdbinit index b778305c8d..b3e12c2ce7 100644 --- a/.gdbinit +++ b/.gdbinit @@ -139,13 +139,15 @@ define rp if ($flags & RUBY_T_MASK) == RUBY_T_HASH printf "%sT_HASH%s: ", $color_type, $color_end, if (((struct RHash *)($arg0))->basic.flags & RHASH_ST_TABLE_FLAG) - printf "st len=%ld ", ((struct RHash *)($arg0))->as.st->num_entries + set $st = (struct st_table *)((uintptr_t)($arg0) + sizeof(struct RHash)) + printf "st len=%ld ", $st->num_entries + print $st else printf "li len=%ld bound=%ld ", \ ((((struct RHash *)($arg0))->basic.flags & RHASH_AR_TABLE_SIZE_MASK) >> RHASH_AR_TABLE_SIZE_SHIFT), \ ((((struct RHash *)($arg0))->basic.flags & RHASH_AR_TABLE_BOUND_MASK) >> RHASH_AR_TABLE_BOUND_SHIFT) + print (struct ar_table_struct *)((uintptr_t)($arg0) + sizeof(struct RHash)) end - print (struct RHash *)($arg0) else if ($flags & RUBY_T_MASK) == RUBY_T_STRUCT set $len = (($flags & (RUBY_FL_USER1|RUBY_FL_USER2)) ? \