summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-07 04:58:07 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-07 04:58:07 +0000
commitf800cdbabc950ff4d18f9183c75670cb2a937d84 (patch)
tree532b4429d919ad1070f2936d122329140ed76e9a
parent8063c2b2e34222884237794d1cdc381765a35d8b (diff)
* 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
-rw-r--r--.gdbinit39
-rw-r--r--ChangeLog6
-rw-r--r--include/ruby/ruby.h7
3 files changed, 39 insertions, 13 deletions
diff --git a/.gdbinit b/.gdbinit
index eb2e30da7e..9d3d455596 100644
--- a/.gdbinit
+++ b/.gdbinit
@@ -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: "
diff --git a/ChangeLog b/ChangeLog
index 0785db1746..0f9e4f86da 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index 8931421672..905ff7d4a9 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -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)