[MacRuby] #880: Bus error with Dispatch::Source, Using 32bit arch.
#880: Bus error with Dispatch::Source, Using 32bit arch. ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Test Script: {{{ #!ruby require "dispatch" @q = Dispatch::Queue.new('org.macruby.gcd_spec.sources') @sm = Dispatch::Semaphore.new(0) @type = Dispatch::Source::DATA_ADD src = Dispatch::Source.new(@type, 0, 0, @q) { } p src }}} Result of 64bit: {{{ $ macruby -v t.rb MacRuby 0.7 (ruby 1.9.2) [universal-darwin10.0, x86_64] /Library/Frameworks/MacRuby.framework/Versions/0.7/usr/lib/ruby/1.9.2/dispatch/enumerable.rb:34: warning: `&' interpreted as argument prefix /Library/Frameworks/MacRuby.framework/Versions/0.7/usr/lib/ruby/1.9.2/dispatch/enumerable.rb:36: warning: `&' interpreted as argument prefix #<Dispatch::Source:0x2000ea220> }}} Result of 32bit: {{{ $ DYLD_LIBRARY_PATH=. gdb --args ./macruby -v -I./lib t.rb GNU gdb 6.3.50-20050815 (Apple version gdb-1469) (Wed May 5 04:36:56 UTC 2010) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries ..... done (gdb) r Starting program: /Users/qoo/src/MacRuby/macruby -v -I./lib t.rb Reading symbols for shared libraries .++++........................ done Reading symbols for shared libraries . done MacRuby 0.7 (ruby 1.9.2) [universal-darwin10.0, i386] /Users/qoo/src/MacRuby/lib/dispatch/enumerable.rb:34: warning: `&' interpreted as argument prefix /Users/qoo/src/MacRuby/lib/dispatch/enumerable.rb:36: warning: `&' interpreted as argument prefix Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_PROTECTION_FAILURE at address: 0x00000008 0x98259b4b in dispatch_resume () (gdb) bt #0 0x98259b4b in dispatch_resume () #1 0x0010aa3f in rb_dispatch_resume [inlined] () at /Users/qoo/src/MacRuby/gcd.c:606 #2 0x0010aa3f in rb_source_init (self=25746864, sel=0x96d9a538, type=1, handle=1, mask=1, queue=25678560) at gcd.c:839 #3 0x00154283 in rb_vm_dispatch (_vm=0xe06530, cache=0xa0433e0, top=0, self=25746864, klass=0x187a360, sel=0x96d9a538, block=0x18841c0, opt=2 '\002', argc=4, argv=0xbffff27c) at dispatcher.cpp:167 #4 0x00075238 in rb_class_new_instance_imp (klass=25666400, sel=0xe53e70, argc=4, argv=0xbffff27c) at vm.h:594 #5 0x00154130 in rb_vm_dispatch (_vm=0xe06530, cache=0xa050460, top=25287232, self=25666400, klass=0x187a3a0, sel=0xe53e70, block=0x18841c0, opt=0 '\0', argc=4, argv=0xbffff27c) at dispatcher.cpp:435 #6 0x09e00b85 in ?? () #7 0x09e00368 in ?? () #8 0x0016134c in rb_vm_run (fname=0x18773a0 "t.rb", node=0x187f0c0, binding=0x0, inside_eval=false) at vm.cpp:3823 #9 0x00043391 in ruby_run_node (n=0x187f0c0) at eval.c:211 #10 0x00001c68 in main (argc=4, argv=0xe060b0, envp=0xbffff36c) at main.cpp:40 (gdb) }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/880> MacRuby <http://macruby.org/>
#880: Bus error with Dispatch::Source, Using 32bit arch. ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Comment(by watson1978@…): I think that the reason for the order of declaring the member of rb_source_t is not corresponding to rb_dispatch_obj_t, rb_queue_t and rb_group_t. {{{ #!diff diff --git a/gcd.c b/gcd.c index cacd6b5..42131d2 100644 --- a/gcd.c +++ b/gcd.c @@ -77,8 +77,8 @@ typedef enum SOURCE_TYPE_ENUM typedef struct { struct RBasic basic; int suspension_count; - source_enum_t source_enum; dispatch_source_t source; + source_enum_t source_enum; rb_vm_block_t *event_handler; VALUE handle; } rb_source_t; @@ -87,6 +87,7 @@ typedef struct { typedef struct { struct RBasic basic; + int reserved; dispatch_semaphore_t sem; long count; } rb_semaphore_t; }}} Result: {{{ $ DYLD_LIBRARY_PATH=. arch -x86_64 ./macruby -v -I./lib t.rb MacRuby 0.7 (ruby 1.9.2) [universal-darwin10.0, x86_64] /Users/watson/src/MacRuby/lib/dispatch/enumerable.rb:34: warning: `&' interpreted as argument prefix /Users/watson/src/MacRuby/lib/dispatch/enumerable.rb:36: warning: `&' interpreted as argument prefix #<Dispatch::Source:0x2000d5c80> $ DYLD_LIBRARY_PATH=. arch -i386 ./macruby -v -I./lib t.rb MacRuby 0.7 (ruby 1.9.2) [universal-darwin10.0, i386] /Users/watson/src/MacRuby/lib/dispatch/enumerable.rb:34: warning: `&' interpreted as argument prefix /Users/watson/src/MacRuby/lib/dispatch/enumerable.rb:36: warning: `&' interpreted as argument prefix #<Dispatch::Source:0x2081c60> }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/880#comment:1> MacRuby <http://macruby.org/>
#880: Bus error with Dispatch::Source, Using 32bit arch. ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Comment(by lsansonetti@…): Sigh, I wish the guys working on this file were more careful :( I believe it would be better to include a rb_dispatch_obj_t field in each structure instead, which would make the code less error prone (but it would probably require a few additional changes). -- Ticket URL: <http://www.macruby.org/trac/ticket/880#comment:2> MacRuby <http://macruby.org/>
#880: Bus error with Dispatch::Source, Using 32bit arch. ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: blocker | Milestone: MacRuby 0.7 Component: MacRuby | Resolution: fixed Keywords: | ----------------------------------+----------------------------------------- Changes (by watson1978@…): * status: new => closed * resolution: => fixed * milestone: => MacRuby 0.7 Comment: Fixed with r4481. -- Ticket URL: <http://www.macruby.org/trac/ticket/880#comment:3> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby