[PATCH v2] gdb: make "start" breakpoint inferior-specific

Pedro Alves pedro@palves.net
Thu Nov 10 17:47:06 GMT 2022


On 2022-11-10 5:33 p.m., Simon Marchi wrote:

>>> +proc do_test {} {
>>> +    # With remote, to be able to start an inferior while another one is
>>> +    # running, we need to use the non-stop variant of the protocol.
>>> +    save_vars { ::GDBFLAGS } {
>>> +	if { [target_info gdb_protocol] == "extended-remote"} {
>>> +	    append ::GDBFLAGS " -ex \"maintenance set target-non-stop on\""
>>> +	}
>>> +
>>> +	clean_restart ${::binfile_other}
>>> +    }
>>> +
>>> +    gdb_test "run&" "Starting program: .*" "start background inferior"
>>
>> I was going to point out that if the inferior prints something, this can
>> timeout, as that output would appear after the prompt.  I then looked around
>> the tree for "run&" uses, to confirm we are using gdb_test_multiple with that,
>> and found that you just recently added "gdb_test -no-prompt-anchor", for exactly
>> this scenario.  :-)  I think that should be used here.
> 
> Even if, in this case, we know the inferior won't print anything?

Admitedly it's a bit pedantic, but it seems to me to be safer.  Say
someones adds some logging to the program or something.  It just looks
like good practice to me to not have an anchor when the inferior is left
running after the prompt is printed.


More information about the Gdb-patches mailing list