ruby-changes:45261
From: nobu <ko1@a...>
Date: Sun, 15 Jan 2017 15:08:14 +0900 (JST)
Subject: [ruby-changes:45261] nobu:r57334 (trunk): .gdbinit: refine rp [ci skip]
nobu 2017-01-15 15:08:09 +0900 (Sun, 15 Jan 2017) New Revision: 57334 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57334 Log: .gdbinit: refine rp [ci skip] * .gdbinit (rp, output_string, rp): show the contents after NUL char. Modified files: trunk/.gdbinit Index: .gdbinit =================================================================== --- .gdbinit (revision 57333) +++ .gdbinit (revision 57334) @@ -95,14 +95,15 @@ define rp https://github.com/ruby/ruby/blob/trunk/.gdbinit#L95 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 print address off - output (char *)(($rsflags & RUBY_FL_USER1) ? \ + output *(char *)(($rsflags & RUBY_FL_USER1) ? \ ((struct RString*)$regsrc)->as.heap.ptr : \ - ((struct RString*)$regsrc)->as.ary) + ((struct RString*)$regsrc)->as.ary) @ $len set print address on - printf " len:%ld ", ($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) + printf " len:%ld ", $len if $flags & RUBY_FL_USER6 printf "(none) " end @@ -422,21 +423,17 @@ end https://github.com/ruby/ruby/blob/trunk/.gdbinit#L423 define output_string set $flags = ((struct RBasic*)($arg0))->flags - printf "%s", (char *)(($flags & RUBY_FL_USER1) ? \ + 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) + output *(char *)(($flags & RUBY_FL_USER1) ? \ ((struct RString*)($arg0))->as.heap.ptr : \ - ((struct RString*)($arg0))->as.ary) + ((struct RString*)($arg0))->as.ary) @ $len end define rp_string - set $flags = ((struct RBasic*)($arg0))->flags - set print address off - output (char *)(($flags & RUBY_FL_USER1) ? \ - ((struct RString*)($arg0))->as.heap.ptr : \ - ((struct RString*)($arg0))->as.ary) - set print address on - printf " bytesize:%ld ", ($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) + output_string $arg0 + printf " bytesize:%ld ", $len if !($flags & RUBY_FL_USER1) printf "(embed) " else -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/