views:

40

answers:

1

I basically want to debug a cgi programm with gdb by emulating the environment variables and stdin stream.
How do I set the variables and stdin?

I am using lampp and gdb.

Thanks!

A: 

From http://inside.mines.edu/~lwiencke/elab/gdb/gdb_19.html:

show environment [varname]
set environment varname [=] value 

And from http://davis.lbl.gov/Manuals/GDB/gdb_5.html#SEC22

You can redirect your program's input and/or output using shell redirection with the run command. For example,

E.g.

run < input_file

would redirect the standard input of your debugged program.

DS