ruby-changes:30905
From: nobu <ko1@a...>
Date: Fri, 20 Sep 2013 13:53:12 +0900 (JST)
Subject: [ruby-changes:30905] nobu:r42984 (trunk): .gdbinit: rp_string
nobu 2013-09-20 13:53:06 +0900 (Fri, 20 Sep 2013) New Revision: 42984 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42984 Log: .gdbinit: rp_string * .gdbinit (rp_string): extract from rp. * .gdbinit (rp_id): use rp_string to show the content. Modified files: trunk/.gdbinit Index: .gdbinit =================================================================== --- .gdbinit (revision 42983) +++ .gdbinit (revision 42984) @@ -80,39 +80,7 @@ define rp https://github.com/ruby/ruby/blob/trunk/.gdbinit#L80 else if ($flags & RUBY_T_MASK) == RUBY_T_STRING printf "%sT_STRING%s: ", $color_type, $color_end - 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) - if !($flags & RUBY_FL_USER1) - printf "(embed) " - else - if ($flags & RUBY_FL_USER2) - printf "(shared) " - end - if ($flags & RUBY_FL_USER3) - printf "(assoc) " - end - end - printf "encoding:%d ", ($flags & RUBY_ENCODING_MASK) >> RUBY_ENCODING_SHIFT - if ($flags & RUBY_ENC_CODERANGE_MASK) == 0 - printf "coderange:unknown " - else - if ($flags & RUBY_ENC_CODERANGE_MASK) == RUBY_ENC_CODERANGE_7BIT - printf "coderange:7bit " - else - if ($flags & RUBY_ENC_CODERANGE_MASK) == RUBY_ENC_CODERANGE_VALID - printf "coderange:valid " - else - printf "coderange:broken " - end - end - end - print (struct RString *)($arg0) + rp_string $arg0 $flags else if ($flags & RUBY_T_MASK) == RUBY_T_REGEXP set $regsrc = ((struct RRegexp*)($arg0))->src @@ -351,7 +319,7 @@ define rp_id https://github.com/ruby/ruby/blob/trunk/.gdbinit#L319 printf "(%ld): ", $id rb_numtable_entry global_symbols.id_str $id if $rb_numtable_rec - rp $rb_numtable_rec + rp_string $rb_numtable_rec else echo undef\n end @@ -377,6 +345,46 @@ document rp_id https://github.com/ruby/ruby/blob/trunk/.gdbinit#L345 Print an ID. 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) + if !($flags & RUBY_FL_USER1) + printf "(embed) " + else + if ($flags & RUBY_FL_USER2) + printf "(shared) " + end + if ($flags & RUBY_FL_USER3) + printf "(assoc) " + end + end + printf "encoding:%d ", ($flags & RUBY_ENCODING_MASK) >> RUBY_ENCODING_SHIFT + if ($flags & RUBY_ENC_CODERANGE_MASK) == 0 + printf "coderange:unknown " + else + if ($flags & RUBY_ENC_CODERANGE_MASK) == RUBY_ENC_CODERANGE_7BIT + printf "coderange:7bit " + else + if ($flags & RUBY_ENC_CODERANGE_MASK) == RUBY_ENC_CODERANGE_VALID + printf "coderange:valid " + else + printf "coderange:broken " + end + end + end + print (struct RString *)($arg0) +end +document rp_string + Print the content of a String. +end + define rp_class printf "(struct RClass *) %p", (void*)$arg0 if ((struct RClass *)($arg0))->ptr.origin != $arg0 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/