This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Simulator question about argc/argv


Hi Steve,

Some new tests have been added to the GCC testsuite (cilk tests) that
check the value of argc and they expect it to be 1 if there are no
arguments to the test program (and there are none) but I am getting 0
when I run the tests under the gnu simulator.  Does anyone know why
this is?

Yes - many simulators do not support passing any arguments to the program that they are simulating. So they set argc to zero when they invoke main. (They usually also set argv to NULL and envp to NULL).

Tests that depend upon a non-zero argc value are, IMHO, dubious. Tests should be able to be run in an automated fashion without anything being provided to them via the command line or their environment.

Cheers
  Nick



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]