From: Suraj Kurapati Date: 2009-10-24T04:36:38+09:00 Subject: [ruby-core:26258] [Bug #2258] Kernel#require inside rb_require() inside rb_protect() inside SysV context fails Issue #2258 has been updated by Suraj Kurapati. Hi, I inspected the assembler code for the prep_stdio() function call inside Init_IO() and found that the problem was *not* a corrupted stack pointer as I had imagined, but instead, the wrong argument value was being passed to prep_stdio() by the assembler code: rb_stdin = prep_stdio(stdin, FMODE_READABLE, rb_cIO, ""); Dump of assembler code from 0x808b2bd to 0x808b3bd: 0x0808b2bd : mov 0x8212980,%edx 0x0808b2c3 : mov 0x8202fa4,%eax # <=== HERE 0x0808b2c8 : movl $0x81860bd,0xc(%esp) 0x0808b2d0 : mov %edx,0x8(%esp) 0x0808b2d4 : movl $0x1,0x4(%esp) 0x0808b2dc : mov %eax,(%esp) # <=== stdin 0x0808b2df : call 0x8084fee For some reason, the assembler code is passing the wrong value for the "stdin" parameter. GDB shows that the value of "stdin" inside Init_IO() is: (gdb) p stdin $8 = (struct _IO_FILE *) 0xb7f3b420 But the assembler code thinks that "stdin" is 0x8202fa4 (see "HERE" above). Any suggestions for debugging? Thanks for your consideration. ---------------------------------------- http://redmine.ruby-lang.org/issues/show/2258 ---------------------------------------- http://redmine.ruby-lang.org