开发者

How to debug into my apache module built using a Makefile?

开发者 https://www.devze.com 2022-12-25 15:39 出处:网络
Firstly, I come from Windows-VisualStudio-C++ background. Now I am developing in a Ubuntu environment.

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 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.
  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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号