From: Tim Hunter Date: 2005-01-27T06:05:55+09:00 Subject: Re: Debugging C Extensions and [A bit OT] general C Questions On Thu, 27 Jan 2005 04:11:22 +0900, Brian Schr�der wrote: >Hello Group, > >I'm right now learning to write C extensions and it works quite good. The only problem is, that my C was never very profound and I seem to have forgotten all of it in the meantime. So obviously I write a lot of bugs. The question is, how do I debug them. > >Right now I'm using printf to output things to the console, but I'd rather like to debug the process in somethink like ddd. Is this possible? >I tried to connect to the running process, but it said to me that the process was "no program". Sure it's possible. I use gdb. Start ruby under gdb: gdb ruby When gdb prompts you, set a breakpoint in dln.c at the point just after the extension gets loaded. That line varies from release to release but it's around line 1350. Look for the call to your initialization function: "(*init_fct)();" b dln.c:1350 After your extension is loaded you can set breakpoints in it.