I would like to compile irb from source without any optimizations so I can get more information while stepping through (interpreter) code using gdb. I have successfully compiled ruby 1.9.1 without problems, but I 开发者_Python百科cannot find any documentation regarding irb. I believe that irb is included in the ruby 1.9 source, but have not been able to verify this. Can anyone point me in the right direction?
Can you clarify what you mean exactly by "compiling IRb without optimizations"?
You don't say which implementation of Ruby you are using. I am going to assume you are using YARV.
With, YARV, there is no separate compile step, it compiles IRb automatically for you, everytime you run it. (Even though YARV is a compiler, you can think of it as an interpreter, since you never have to worry about the compilation step.) Also, YARV doesn't do any optimizations when compiling AFAIK, and if it does, there is no way to influence the compilation, thus also no way to turn optimizations off.
IRb is quite easy to find in the YARV sourcecode. The executable lives in the bin
directory:
bin/irb
But it's not doing any interesting work. The real meat is in the standard library:
lib/irb.rb
and- the whole
lib/irb/
directory
精彩评论