.gdbinit: Update RString printing for new layout [ci skip]

This commit is contained in:
Alan Wu 2024-11-11 22:08:09 -05:00
Родитель c028bf0c7b
Коммит 8655cbec39
1 изменённых файлов: 7 добавлений и 13 удалений

Просмотреть файл

@ -83,13 +83,11 @@ define rp
set $regsrc = ((struct RRegexp*)($arg0))->src
set $rsflags = ((struct RBasic*)$regsrc)->flags
printf "%sT_REGEXP%s: ", $color_type, $color_end
set $len = ($rsflags & RUBY_FL_USER1) ? \
((struct RString*)$regsrc)->as.heap.len : \
(($rsflags & (RUBY_FL_USER2|RUBY_FL_USER3|RUBY_FL_USER4|RUBY_FL_USER5|RUBY_FL_USER6)) >> RUBY_FL_USHIFT+2)
set $len = ((struct RString*)($arg0))->len
set print address off
output *(char *)(($rsflags & RUBY_FL_USER1) ? \
((struct RString*)$regsrc)->as.heap.ptr : \
((struct RString*)$regsrc)->as.ary) @ $len
((struct RString*)$regsrc)->as.embed.ary) @ $len
set print address on
printf " len:%ld ", $len
if $flags & RUBY_FL_USER6
@ -424,13 +422,11 @@ end
define output_string
set $flags = ((struct RBasic*)($arg0))->flags
set $len = ($flags & RUBY_FL_USER1) ? \
((struct RString*)($arg0))->as.heap.len : \
(($flags & (RUBY_FL_USER2|RUBY_FL_USER3|RUBY_FL_USER4|RUBY_FL_USER5|RUBY_FL_USER6)) >> RUBY_FL_USHIFT+2)
set $len = ((struct RString*)($arg0))->len
if $len > 0
output *(char *)(($flags & RUBY_FL_USER1) ? \
((struct RString*)($arg0))->as.heap.ptr : \
((struct RString*)($arg0))->as.ary) @ $len
((struct RString*)($arg0))->as.embed.ary) @ $len
else
output ""
end
@ -438,13 +434,11 @@ end
define print_string
set $flags = ((struct RBasic*)($arg0))->flags
set $len = ($flags & RUBY_FL_USER1) ? \
((struct RString*)($arg0))->as.heap.len : \
(($flags & (RUBY_FL_USER2|RUBY_FL_USER3|RUBY_FL_USER4|RUBY_FL_USER5|RUBY_FL_USER6)) >> RUBY_FL_USHIFT+2)
set $len = ((struct RString*)($arg0))->len
if $len > 0
printf "%s", *(char *)(($flags & RUBY_FL_USER1) ? \
((struct RString*)($arg0))->as.heap.ptr : \
((struct RString*)($arg0))->as.ary) @ $len
((struct RString*)($arg0))->as.embed.ary) @ $len
end
end
@ -1295,7 +1289,7 @@ define dump_node
set $flags = ((struct RBasic*)($str))->flags
printf "%s", (char *)(($flags & RUBY_FL_USER1) ? \
((struct RString*)$str)->as.heap.ptr : \
((struct RString*)$str)->as.ary)
((struct RString*)$str)->as.embed.ary)
end
define print_flags