0

often i see some gdb guide using examples without parameters. But in parctice, i need to gdb debug a programe with parameters.

this program is run as "./voronoi -t outputfile", -t is programme voronoi itself parameter, is input, and outputfile is outputfile. but when i using "gdb ./voronoi -t outputfile", it will tell me some error, but when using no gdb debug, run "./voronoi -t outputfile" is OK.

How make it both can gdb debugging and aslo with parameters? How to set the parameters?

user1279988
  • 757
  • 1
  • 11
  • 27
  • plz read this http://stackoverflow.com/questions/455544/how-to-load-program-reading-stdin-and-taking-parameters-in-gdb?rq=1 – Jeyaram Jan 06 '14 at 02:49

3 Answers3

2

You may want to take a look at the run and start commands of gdb—you can pass them the commandline parameters just like you are used to at the shell prompt:

% gdb my_program
[...]
start par1 par2 par3 ...
mafso
  • 5,433
  • 2
  • 19
  • 40
1

$ gdb program

break linenumber|functionName

run [parameters]

rfermi
  • 179
  • 11
0

if your system is windows,you can do this: 1.gdb your_program 2.set args para1 para2 para3...

Nibnat
  • 119
  • 7