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.
- So, first, is there any way I can get something similar to the Visual Studio debugger type of feel while debugging this module?
- 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.
- Ideally, i would like to single step and stuff. I am trying Code::Blocks IDE which has som开发者_开发技巧e debugging support. Using the IDE and custom make file, I build the module. Copied it to module location, but how do i debug.
- 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.
- 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
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.
精彩评论