Debugging Ruby
Off to a good start on Langbinding for Ruby. Created a debugging Ruby and I’m able to trace into it in XCode. I’m surpised that I didn’t have to specify a source location, XCode/gdb found the source in the directory where I built Ruby.
CCFLAGS=”-g -O0″ ./configure –prefix=/er
That didn’t do the trick, since optimization was set at -O2 in the Makefile, so I had to make that edit, but otherwise the build was fine.
Then I followed the instructions in an article at mozilla.org on debugging a mozilla project in XCode to load Ruby as an executable in an XCode project.
It took some fiddling to get the Ruby application selected, so that the menu would debug it, instead of the C++ application in the project I choose for this experiement. I think selecting my “Ruby” application in the “Run Log” window and choosing Debug -> Debug Executable did the trick.
I set a “symbolic breakpoint” in “main” and it stopped in Ruby’s main. Magic.
October 19th, 2005 at 11:57 am
Alan,
I spent all of yesterday trying to get XCode to debug Apache httpd-2.1.8-beta, and failed. Always, after setting a breakpoint in main.c and then starting the debugger, I would check the debugger console and find a message saying “no source file named main.c”. Also, the debugger wouldn’t stop at my breakpoint.
In fact, as a troubleshooting experiment, I tried using XCode to debug a simple project that had only a main.c file and a Makefile, both together in the project root directory. As with the httpd project, I set a breakpoint in main.c and again received the “no source file named main.c” message. And again, the debugger wouldn’t stop at my breakpoint.
Do you have any suggestions?
Thanks.
Doug
October 19th, 2005 at 12:15 pm
Doug
I selected Breakpoints from the Debug menu (Debug -> Breakpoints) and then, when the Breakpionts window came up, I clicked the New Breakpoint button and typed “main”. That’s what worked for me.
Once I stop in main, I can see that I’m able to set breaks points in that file.
If you are setting breakpoints using the “breakpoint” window, don’t use the filename, of course, use the function name “main”.
Sounds perplexing. Let me know how it goes.
December 13th, 2005 at 4:14 pm
Here’s an article about Debugging arbitrary applications with XCode.