aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--lib/pp.rb10
2 files changed, 14 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 181d17813b..69b7181728 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Nov 28 20:24:22 2005 Tanaka Akira <akr@m17n.org>
+
+ * lib/pp.rb (PP::PPMethods#object_address_group): mask an address with
+ word size.
+
Tue Nov 29 23:57:05 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (struct parser_params): heap must be placed at same offset
diff --git a/lib/pp.rb b/lib/pp.rb
index dcd293ca7a..934ad6bf67 100644
--- a/lib/pp.rb
+++ b/lib/pp.rb
@@ -150,6 +150,14 @@ class PP < PrettyPrint
group(1, '#<' + obj.class.name, '>', &block)
end
+ if 0x100000000.class == Bignum
+ # 32bit
+ PointerMask = 0xffffffff
+ else
+ # 64bit
+ PointerMask = 0xffffffffffffffff
+ end
+
case Object.new.inspect
when /\A\#<Object:0x([0-9a-f]+)>\z/
PointerFormat = "%0#{$1.length}x"
@@ -158,7 +166,7 @@ class PP < PrettyPrint
end
def object_address_group(obj, &block)
- id = PointerFormat % (obj.__id__ * 2)
+ id = PointerFormat % (obj.__id__ * 2 & PointerMask)
id.sub!(/\Af(?=[[:xdigit:]]{2}+\z)/, '') if id.sub!(/\A\.\./, '')
group(1, "\#<#{obj.class}:0x#{id}", '>', &block)
end