summaryrefslogtreecommitdiff
path: root/.gdbinit
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-15 06:08:09 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-15 06:08:09 +0000
commit53a1b9f28fccc566f7b505081de13eb470e73fea (patch)
tree9701559ba44e8ab91d3ef54e28af313055756e82 /.gdbinit
parent1d36a09d81d3b1b06902942fc912fa9cf8ddd5ad (diff)
.gdbinit: refine rp [ci skip]
* .gdbinit (rp, output_string, rp): show the contents after NUL char. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57334 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to '.gdbinit')
-rw-r--r--.gdbinit29
1 files changed, 13 insertions, 16 deletions
diff --git a/.gdbinit b/.gdbinit
index e364b23219..d5ecc78463 100644
--- a/.gdbinit
+++ b/.gdbinit
@@ -95,14 +95,15 @@ 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 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
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