Debugging an Apache module in NetBeans

Posted & filed under apache modules, C++, Guanxi.

As I’ve started to develop mod_guanxi as an Apache module version of a Guanxi Guard, I needed a way to debug it running inside Apache. I eventually gave up trying to use Eclipse and CDT and gave NetBeans a go instead.

That’s it. When you open the site in a browser, NetBeans will kick in and you can step through the module code.

[UPDATE: 3/5/10]

Whenever I tried attaching to the httpd process in Eclipse the browser would just hang. Then I remembered something about gdb and automatically breaking on main(). Sure enough the apache thread was suspended in the debugger on child_main. Resuming the thread in the debugger sorted that. I can now use Eclipse to code/debug the module which is just as well really as NetBeans on the Mac is very slow and clunky but for some reason, the Eclipse attach to application debug type doesn’t let you not break at main()