1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* include/ruby/ruby.h (ruby_special_consts): added RUBY_SPECIAL_SHIFT.

* .gdbinit: some improvements.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-08-07 04:58:07 +00:00
parent 8063c2b2e3
commit f800cdbabc
3 changed files with 39 additions and 13 deletions

View file

@ -1,8 +1,8 @@
define rp
if (long)$arg0 & 1
if (VALUE)$arg0 & 1
printf "FIXNUM: %d\n", $arg0 >> 1
else
if ((long)$arg0 & 0xff) == 0x0e
if ((VALUE)$arg0 & ~(~(VALUE)0<<RUBY_SPECIAL_SHIFT)) == SYMBOL_FLAG
printf "SYMBOL(%d)\n", $arg0 >> 8
else
if $arg0 == 0
@ -17,7 +17,7 @@ define rp
if $arg0 == 6
echo undef\n
else
if (long)$arg0 & 0x03
if (VALUE)$arg0 & 0x03
echo immediate\n
else
set $flags = ((struct RBasic*)$arg0)->flags
@ -50,11 +50,21 @@ define rp
print (struct RFloat *)$arg0
else
if ($flags & 0x1f) == 0x07
printf "T_STRING: \"%s\" ", ($flags & RUBY_FL_USER1) ? ((struct RString*)$arg0)->as.heap.ptr : ((struct RString*)$arg0)->as.ary
printf "T_STRING: "
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 " "
print (struct RString *)$arg0
else
if ($flags & 0x1f) == 0x08
printf "T_REGEXP: \"%s\" ", (((struct RRegexp*)$arg0)->str)
printf "T_REGEXP: "
set print address off
output ((struct RRegexp*)$arg0)->str
set print address on
printf " "
print (struct RRegexp *)$arg0
else
if ($flags & 0x1f) == 0x09
@ -67,16 +77,25 @@ define rp
print (struct RBasic *)$arg0
else
if ($flags & 0x1f) == 0x0b
printf "T_HASH: len=%d ", ((struct RHash *)$arg0)->tbl ? ((struct RHash *)$arg0)->tbl->num_entries : 0
printf "T_HASH: ",
if ((struct RHash *)$arg0)->tbl
printf "len=%d ", ((struct RHash *)$arg0)->tbl->num_entries
end
print (struct RHash *)$arg0
else
if ($flags & 0x1f) == 0x0c
printf "T_STRUCT: len=%d ", (($flags & (RUBY_FL_USER1|RUBY_FL_USER2)) ? ($flags & (RUBY_FL_USER1|RUBY_FL_USER2)) >> (RUBY_FL_USHIFT+1) : ((struct RStruct *)$arg0)->as.heap.len)
printf "T_STRUCT: len=%d ", \
(($flags & (RUBY_FL_USER1|RUBY_FL_USER2)) ? \
($flags & (RUBY_FL_USER1|RUBY_FL_USER2)) >> (RUBY_FL_USHIFT+1) : \
((struct RStruct *)$arg0)->as.heap.len)
print (struct RStruct *)$arg0
x/xw (($flags & (RUBY_FL_USER1|RUBY_FL_USER2)) ? ((struct RStruct *)$arg0)->as.ary : ((struct RStruct *)$arg0)->as.heap.len)
x/xw (($flags & (RUBY_FL_USER1|RUBY_FL_USER2)) ? \
((struct RStruct *)$arg0)->as.ary : \
((struct RStruct *)$arg0)->as.heap.len)
else
if ($flags & 0x1f) == 0x0d
printf "T_BIGNUM: sign=%d len=%d ", ((struct RBignum*)$arg0)->sign, ((struct RBignum*)$arg0)->len
printf "T_BIGNUM: sign=%d len=%d ", \
((struct RBignum*)$arg0)->sign, ((struct RBignum*)$arg0)->len
print (struct RBignum *)$arg0
x/xw ((struct RBignum*)$arg0)->digits
else
@ -108,7 +127,7 @@ define rp
else
if ($flags & 0x1f) == 0x1a
printf "T_VALUES: "
print (struct RBasic *)$arg0
print (struct RValues *)$arg0
else
if ($flags & 0x1f) == 0x1b
printf "T_BLOCK: "

View file

@ -1,3 +1,9 @@
Tue Aug 7 13:58:03 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* include/ruby/ruby.h (ruby_special_consts): added RUBY_SPECIAL_SHIFT.
* .gdbinit: some improvements.
Tue Aug 7 13:28:32 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* common.mk (node_name.inc): use $? instead of $< for nmake.

View file

@ -209,9 +209,9 @@ VALUE rb_ull2inum(unsigned LONG_LONG);
#define IMMEDIATE_P(x) ((VALUE)(x) & IMMEDIATE_MASK)
#define SYMBOL_P(x) (((VALUE)(x)&0xff)==SYMBOL_FLAG)
#define ID2SYM(x) ((VALUE)(((long)(x))<<8|SYMBOL_FLAG))
#define SYM2ID(x) RSHIFT((unsigned long)x,8)
#define SYMBOL_P(x) (((VALUE)(x)&~(~(VALUE)0<<RUBY_SPECIAL_SHIFT))==SYMBOL_FLAG)
#define ID2SYM(x) (((VALUE)(x)<<RUBY_SPECIAL_SHIFT)|SYMBOL_FLAG)
#define SYM2ID(x) RSHIFT((unsigned long)x,RUBY_SPECIAL_SHIFT)
/* special contants - i.e. non-zero and non-fixnum constants */
enum ruby_special_consts {
@ -223,6 +223,7 @@ enum ruby_special_consts {
RUBY_IMMEDIATE_MASK = 0x03,
RUBY_FIXNUM_FLAG = 0x01,
RUBY_SYMBOL_FLAG = 0x0e,
RUBY_SPECIAL_SHIFT = 8,
};
#define Qfalse ((VALUE)RUBY_Qfalse)