[MacRuby] #1082: Segfault occurs when use a alias of pretty_print_inspect without implementing pretty_print.
MacRuby
ruby-noreply at macosforge.org
Tue Dec 28 16:23:01 PST 2010
#1082: Segfault occurs when use a alias of pretty_print_inspect without
implementing pretty_print.
----------------------------------+-----------------------------------------
Reporter: watson1978@… | Owner: lsansonetti@…
Type: defect | Status: new
Priority: blocker | Milestone:
Component: MacRuby | Keywords:
----------------------------------+-----------------------------------------
Test Script:
{{{
#!ruby
require 'pp'
class PrettyPrintInspectWithPrettyPrint
def pretty_print(x)
x.text "ok"
end
alias inspect pretty_print_inspect
end
class PrettyPrintInspectWithoutPrettyPrint
alias inspect pretty_print_inspect
end
a = PrettyPrintInspectWithPrettyPrint.new
p a.inspect
b = PrettyPrintInspectWithoutPrettyPrint.new
p b.inspect
}}}
Result:
{{{
$ ruby test_pp.rb
"ok"
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/pp.rb:293:in
`inspect': pretty_print is not overridden for
PrettyPrintInspectWithoutPrettyPrint (RuntimeError)
from test_pp.rb:18
$ macruby test_pp.rb
"ok"
zsh: segmentation fault macruby test_pp.rb
}}}
BackTrace:
{{{
$ DYLD_LIBRARY_PATH=. gdb --args ./macruby -I./lib ~/tmp/test_pp.rb
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00007fff5f3ffe80
0x00007fff883cfba0 in __vfprintf ()
(gdb) bt 20
#0 0x00007fff883cfba0 in __vfprintf ()
#1 0x00007fff883d5657 in snprintf ()
#2 0x0000000100153690 in rb_vm_lookup_method2 (klass=0x7fff707cd468,
mid=<value temporarily unavailable, due to optimizations>,
psel=0x7fff5f400a78, pimp=0x7fff5f400a70, pnode=0x7fff5f400a68) at
vm.cpp:2497
#3 0x0000000100147cd8 in rb_vm_get_method (klass=140735080617064, obj=6,
mid=12944, scope=<value temporarily unavailable, due to optimizations>) at
dispatcher.cpp:1438
#4 0x0000000100049a44 in mnew [inlined] () at /Users/watson/src/macruby-
trunk-svn/proc.c:670
#5 0x0000000100049a44 in rb_mod_instance_method (mod=140735080617064,
sel=<value temporarily unavailable, due to optimizations>, vid=<value
temporarily unavailable, due to optimizations>) at proc.c:912
#6 0x000000010014a56b in rb_vm_dispatch (_vm=0x100d25070,
cache=0x100cd2f40, top=8590749344, self=140735080617064,
klass=0x7fff707cd440, sel=0x102e4dc50, block=0x0, opt=0 '\0', argc=<value
temporarily unavailable, due to optimizations>, argv=0x7fff5f401800) at
dispatcher.cpp:161
#7 0x0000000102d5a9b6 in ?? ()
#8 0x0000000102d63543 in ?? ()
#9 0x000000010014a56b in rb_vm_dispatch (_vm=0x100d25070,
cache=0x100cc8900, top=8592622816, self=8590749344, klass=0x2000b3300,
sel=0x102e8f580, block=0x0, opt=0 '\0', argc=<value temporarily
unavailable, due to optimizations>, argv=0x7fff5f402558) at
dispatcher.cpp:161
#10 0x0000000102d5a9b6 in ?? ()
#11 0x0000000102d65d8b in ?? ()
#12 0x000000010014ca83 in rb_vm_yield_args (_vm=0x100d25070, argc=<value
temporarily unavailable, due to optimizations>, argv=0x2000b3300) at
dispatcher.cpp:98
#13 0x0000000102d5e992 in ?? ()
#14 0x0000000102d65efb in ?? ()
#15 0x000000010014a4bc in rb_vm_dispatch (_vm=0x100d25070,
cache=0x100cd39c0, top=8592622816, self=8592622816, klass=0x2000b7080,
sel=0x7fff85de4918, block=0x20028e660, opt=2 '\002', argc=<value
temporarily unavailable, due to optimizations>, argv=0x7fff5f402e70) at
dispatcher.cpp:170
#16 0x0000000102d5a9b6 in ?? ()
#17 0x0000000102d606f3 in ?? ()
#18 0x000000010014a56b in rb_vm_dispatch (_vm=0x100d25070,
cache=0x100cef800, top=8590887936, self=8592622816, klass=0x2000b7080,
sel=0x103101110, block=0x0, opt=0 '\0', argc=<value temporarily
unavailable, due to optimizations>, argv=0x7fff5f4047c8) at
dispatcher.cpp:161
#19 0x0000000102d5a9b6 in ?? ()
(More stack frames follow...)
}}}
--
Ticket URL: <http://www.macruby.org/trac/ticket/1082>
MacRuby <http://macruby.org/>
More information about the macruby-tickets
mailing list