Take the 2-minute tour ×

Firstly, I come from Windows-VisualStudio-C++ background. Now I am developing in a Ubuntu environment.

With the help of a Makefile, I built a mymodule.so and copied it to the modules folder within apache. Now, it appears that the module is working fine. But I would like to debug into this module to understand it better.

  1. So, first, is there any way I can get something similar to the Visual Studio debugger type of feel while debugging this module?
  2. Now, i read that i can use gdb to debug into apache modules, can somebody tell me in detail how this is done or point me to some resource that does it.
  3. Ideally, i would like to single step and stuff. I am trying Code::Blocks IDE which has some debugging support. Using the IDE and custom make file, I build the module. Copied it to module location, but how do i debug.
  4. How do i hook to the apache process. Should I use Attach to Process. I tried that with the pid of httpd, but with no success.
  5. Also, while building is there some flag that i should set so that the .so file is debuggable?

I am pretty basic with Linux because i come from windows programming background. Kindly suggest how I go about this.

Thanks in advance, Arjun

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

I think you can attach to an apache process using gdb (at 1111, where 1111 is the PID of the process, or in Code::Blocks) and set breakpoints in your module functions, if the module was compiled with debug. You will need to be root or the same user as the apache process.

gcc -g flag is used to build binaries with the debug info.

share|improve this answer
add comment

Your Answer


