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

Simon Marchi simark@simark.ca
Tue May 19 17:13:38 GMT 2020


On 2020-05-15 4:07 p.m., Pedro Alves via Gdb-patches wrote:
> 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
> 

Thanks for the comments.  Michael, would you mind addressing these changes
in my patches in your branch?

Simon


More information about the Gdb-patches mailing list