This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 250720 - Debug apache cgi c++
Summary: Debug apache cgi c++
Status: RESOLVED INCOMPLETE
Alias: None
Product: cnd
Classification: Unclassified
Component: Debugger (show other bugs)
Version: 8.1
Hardware: PC Linux
: P3 normal (vote)
Assignee: henk89
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-26 09:43 UTC by tgarijo
Modified: 2015-03-31 14:47 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
attach remote process (246.68 KB, image/png)
2015-03-03 15:21 UTC, tgarijo
Details
Error when attach apache process (232.93 KB, image/png)
2015-03-03 15:21 UTC, tgarijo
Details
Session of attach process and line stop debug (188.08 KB, image/png)
2015-03-03 15:22 UTC, tgarijo
Details
log file (9.48 KB, application/octet-stream)
2015-03-03 16:28 UTC, tgarijo
Details
gdb log (14.71 KB, application/octet-stream)
2015-03-23 08:29 UTC, tgarijo
Details
symbol file (127.41 KB, image/png)
2015-03-24 12:08 UTC, tgarijo
Details
attachProcces (191.52 KB, image/png)
2015-03-27 09:14 UTC, tgarijo
Details
debug.png (132.52 KB, image/png)
2015-03-27 09:15 UTC, tgarijo
Details
debug properties (139.14 KB, image/png)
2015-03-30 15:12 UTC, tgarijo
Details
log (12.53 KB, application/octet-stream)
2015-03-30 15:33 UTC, tgarijo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tgarijo 2015-02-26 09:43:22 UTC
Hello.

I'm developing a cgi c++ for apache, all tools(dbg, compile) are in a linux server and netbeans ide is in my windows 7 station. When i compile my project all perfect. Now  I'm deploying my proyect but i need debug the project when apache receive data by  post or get. Is possible that  apache receive data by post or get and  my program,  stop in line debug in my windows 7 station?. I was read this post http://codebrane.com/blog/2010/04/29/debugging-an-apache-module-in-netbeans/ but apache server is not in my proccess list. Is there anybody can me help?

Regards
Comment 1 henk89 2015-03-03 12:44:41 UTC
NetBeans supports remote debugging. For doing this you should set up your remote host and attach to a remote process.
Comment 2 tgarijo 2015-03-03 15:21:04 UTC
Created attachment 152370 [details]
attach remote process
Comment 3 tgarijo 2015-03-03 15:21:44 UTC
Created attachment 152371 [details]
Error when attach apache process
Comment 4 tgarijo 2015-03-03 15:22:30 UTC
Created attachment 152372 [details]
Session of attach process and line stop debug
Comment 5 tgarijo 2015-03-03 15:24:22 UTC
Sorry, but this doesn't work well.

I attach my project to remote process (you see in file attach). The ide return an error (file  doesn't  exists). When I call to gci by url, doesn't stop in debug line of my code. I use apache in linux sistem and netbead in windows 7.
Comment 6 henk89 2015-03-03 15:57:57 UTC
It looks like NB was unable to determine a path to a symbol file.
Could you please attach a gdb log?
http://wiki.netbeans.org/GdbLog
Comment 7 tgarijo 2015-03-03 16:28:34 UTC
Created attachment 152374 [details]
log file
Comment 8 henk89 2015-03-04 14:09:58 UTC
Could you please provide me with "/bin/ls -l /proc/<apache's PID>/exe" output?
Comment 9 tgarijo 2015-03-04 15:02:56 UTC
lrwxrwxrwx 1 root root 0 mar  3 13:18 /proc/12329/exe -> /usr/lib/apache2/mpm-worker/apache2
Comment 10 henk89 2015-03-05 07:58:52 UTC
It looks like the process you're going to debug was started by root. Would you try starting the server process and debugging under the same account?
Comment 11 tgarijo 2015-03-05 15:40:30 UTC
Hello

I have three process of apache, I attach to id 12330 or 12329

root     12325     1  0 mar03 ?        00:00:00 /bin/sh /usr/sbin/apache2ctl -X
www-data 12329 12325  0 mar03 ?        00:00:00 /usr/sbin/apache2 -X
www-data 12330 12329  0 mar03 ?        00:00:00 /usr/sbin/apache2 -X
Comment 12 tgarijo 2015-03-09 15:24:19 UTC
Hello, 

Do you know why does not stop in break line?

Regards
Comment 13 henk89 2015-03-11 07:43:13 UTC
(In reply to tgarijo from comment #12)
> Hello, 
> 
> Do you know why does not stop in break line?
> 
> Regards

It occurs because sometimes procfs creates /proc/<PID> folders with inappropriate permissions (in your case superuser is owner instead of www-data).
Comment 14 henk89 2015-03-11 07:44:10 UTC
Fixed in:
http://hg.netbeans.org/cnd-main/rev/6ec8ff163ad7

Now you will be able to set a symbol file to debug using a remote project.
Comment 15 Quality Engineering 2015-03-12 04:27:28 UTC
Integrated into 'main-silver', will be available in build *201503120001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/6ec8ff163ad7
User: Nikolay Koldunov <henk89@netbeans.org>
Log: Fixed #250720 - Debug apache cgi c++
Fixed #
Comment 16 tgarijo 2015-03-13 10:55:06 UTC
Sorry but the problem is not solved for me. I have the same problem with the version 201503120001.
Comment 17 henk89 2015-03-13 13:20:30 UTC
What did you do to set a symbol file to debug?
Comment 18 tgarijo 2015-03-20 09:21:59 UTC
I'm sorry, but I don't understand you the last post.
Comment 19 henk89 2015-03-20 10:41:36 UTC
In order to get this work you have to set a symbol file.
1. Create a remote project on the target machine
2. In the debug properties set a symbol file (the server binary in your case)
3. In the Attach window select the target host, the process and the project created
Comment 20 tgarijo 2015-03-20 12:02:38 UTC
Hi

I do this,  but when I send data to port 80 (apachectl -x) I cannot debug de program because the debug execution doesn't stop in line breakpoints.

In other time I think to told you that the program is a CGI and I need when I send  data to apache,  and apache calls to my cgi program,  the environment netbeand get the control and I can debug my program. I don`t know if this is possible..

Regards
Comment 21 henk89 2015-03-21 16:30:06 UTC
It looks strange as there are many people who debug their binaries in such a way. Please provide me with the new gdb log. I'll try to solve your issue.
Comment 22 henk89 2015-03-21 16:34:26 UTC
May be you should switch the follow fork mode to child in order to get this work.
Please don't forget to specify a symbol file (the binary you're trying to debug)!
Comment 23 tgarijo 2015-03-23 08:29:45 UTC
Created attachment 152782 [details]
gdb log

Thank's
Comment 24 henk89 2015-03-24 10:42:39 UTC
As I can see your symbol file is /bin/dash. It's not correct. You should specify the correct symbol file (your binary) in the project properties. Could you please screenshot the Debug tab in the project properties?
Comment 25 tgarijo 2015-03-24 12:08:14 UTC
Created attachment 152814 [details]
symbol file
Comment 26 henk89 2015-03-25 16:46:49 UTC
Now you should select this project while attaching to the server process.
Comment 27 tgarijo 2015-03-27 09:14:24 UTC
Created attachment 152879 [details]
attachProcces
Comment 28 tgarijo 2015-03-27 09:15:15 UTC
Created attachment 152880 [details]
debug.png

Thank You very much for your work.

I attach a file screen of my environment. If you see, i have a breakpoint on cout. The session is running and the project is attaching to the server process. If i send any data to port 80 (listen apache to cgi) the program doesn't stop on breakpoint and i can not debug it. I'm sorry but this is the true.

Regards
Comment 29 henk89 2015-03-30 14:50:53 UTC
Could you please screenshot the Debug tab in the xmlengine properties?
Also I'd like to see a GDB log after the attempt to attach with the xmlengine project selected.
Comment 30 tgarijo 2015-03-30 15:12:12 UTC
Created attachment 152924 [details]
debug properties
Comment 31 tgarijo 2015-03-30 15:33:47 UTC
Created attachment 152927 [details]
log
Comment 32 henk89 2015-03-31 09:06:55 UTC
During attach GDB replaces symbol file for some reason. I'll try to fix it.
There is a workaround for you before I fix it:
after attaching execute
-file-symbol-file  "/var/www/.netbeans/remote/192.168.3.32/tgarijow7-Windows-x86/P/xmlengine/dist/Debug/GNU-Linux-x86/xmlengine"
in the Debugger console.
Comment 33 henk89 2015-03-31 09:12:15 UTC
Also you can try upgrading your GDB