1. Compile
Remove the strip from the compiled file (if Makefile contains) and add the-G option
2. Setting of environment variable
The variable parameters that are entered by CGI are generally set by environment variables. This is the main difference between debugging CGI and debugging common C + + programs. The CGI input parameters, in CGI, are implemented by reading the environment variables.
(1) can be set in the shell with export
Onionxie@c2c_206_45_sles10sp1:~/c2cforcc/clubs/mcs/web/caseproc/cgi> Export workerid=1001
(2) can be set in GDB using Set environment s
(GDB) Set environment VARNAME [=] VALUE
(GDB) Show environment [VARNAME]
Look at the Workerid in the figure below set in the shell, Kfguin is set in GDB
3. Debugging
Debug in a normal gdb way.
In general, use L to view the main function, and then set breakpoints to track debugging. Will not repeat the narrative.