Re: [PATCH 2/2] gdb/testsuite: add inferior arguments test

Pedro Alves
2020-05-15T20:07:35Z

On 5/10/20 4:59 PM, Simon Marchi via Gdb-patches wrote:

> +++ b/gdb/testsuite/gdb.base/inferior-args.c
> @@ -0,0 +1,8 @@
> +#include <stdio.h>
> +
> +int main(int argc, char **argv) {
> + for (int i = 0; i < argc; i++)
> + printf("[%d] %s\n", i, argv[i]);
> +
> + return 0;
> +}

Formatting. Also missing copyright header.

> +standard_testfile .c
> +
> +if {[build_executable "failed to prepare" $testfile $srcfile debug] == -1} {
> + return
> +}
> +
> +clean_restart $binfile

This seems unnecessary, since do_test already calls it.

Otherwise, you can use prepare_for_testing here.

> +
> +proc do_test { method } {
> + global binfile hex
> +
> + # The second arg is an empty string on purpose.
> + set inferior_args { "first arg" "" "third-arg" }
> +
> + clean_restart $binfile
Otherwise LGTM.

Thanks,
Pedro Alves