summaryrefslogtreecommitdiff
path: root/.gdbinit
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-20 04:53:06 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-20 04:53:06 +0000
commita9534d1b4889cc9a3a5d487944b52c859ecd9e65 (patch)
tree06458cd6e15b7165dc2fb9fefa4547990f76bc32 /.gdbinit
parent1bf8b67c4f9a8d7d8439b780792ef434a2928abe (diff)
downloadbundler-a9534d1b4889cc9a3a5d487944b52c859ecd9e65.tar.gz
.gdbinit: rp_string
* .gdbinit (rp_string): extract from rp. * .gdbinit (rp_id): use rp_string to show the content. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to '.gdbinit')
-rw-r--r--.gdbinit76
1 files changed, 42 insertions, 34 deletions
diff --git a/.gdbinit b/.gdbinit
index d649efea81..9127db09ef 100644
--- a/.gdbinit
+++ b/.gdbinit
@@ -80,39 +80,7 @@ define rp
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
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
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