c++ - How to debug a Fast Common Gateway Interface (FCGI) program? -


i encountered problem don't known how debug fcgi program written in c++ , based on fastcgi.

the program managed lighttpd spawn-fcgi , called nginx fastcgi module.

i wrote shell script restart spawn-cgi:

#! /bin/bash  cgi_default="index.cgi" process_pid="pid"  param_ip="127.0.0.1" param_port="9000"  if [ -f "$process_pid" ];     pid=`cat $process_pid`     kill -9 $pid &> /dev/null     rm $process_pid fi  spawn_out=`/usr/local/bin/spawn-fcgi -a $param_ip -p $param_port $cgi_default` # spawn-fcgi: child spawned successfully: pid: 6423 pid=`echo $spawn_out | cut -d " " -f6` expr $pid + 0 &> /dev/null [ $? -eq "0" ] && echo "$pid" > $process_pid 

the program index.cgi built , printf strings out stream.

and configuration in nginx:

location / {     fastcgi_pass    127.0.0.1:9000;     include         fastcgi_params; } 

now wroking on index.cgi, change code (maybe faulty logic). program crashed , 502 bad gateway returned in browser.

it's hard me find out wrong in program because fcgi progam acts callback function of nginx. cannot press debug button , bebug program normally.

so how can debug program , conveniently?

yeah, gdb attach running process debugging lot.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -