This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Unset attach_flag when running a new process
- From: Patrick Palka <patrick at parcs dot ath dot cx>
- To: Pedro Alves <palves at redhat dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Wed, 26 Aug 2015 20:55:56 -0400
- Subject: Re: [PATCH] Unset attach_flag when running a new process
- Authentication-results: sourceware.org; auth=none
- References: <CA+C-WL-pXAYhLBcVE2Cj7Qtjhxm_XbHnJOHjwB=4FmHhvnoQ7Q at mail dot gmail dot com> <1439816493-17559-1-git-send-email-patrick at parcs dot ath dot cx> <55DDF228 dot 3080402 at redhat dot com>
On Wed, Aug 26, 2015 at 1:06 PM, Pedro Alves <palves@redhat.com> wrote:
> On 08/17/2015 02:01 PM, Patrick Palka wrote:
>> We currently set attach_flag when attaching to a process, so we should
>> make sure to unset it when forking a new process. Otherwise attach_flag
>> would remain set after forking, if the previous process associated with
>> the inferior was attached to.
>>
>> gdb/ChangeLog:
>>
>> * target.c (target_pre_inferior): Unset attach_flag.
>>
>> gdb/testsuite/ChangeLog:
>>
>> * gdb.base/run-after-attach.exp: New test file.
>> * gdb.base/run-after-attach.c: New test file.
>
> OK, but,
>
>> +set test "attempt kill via quit"
>> +# The quit prompt should warn about killing the process, not about detaching the
>> +# process, since this process was not attached to.
>> +set ok 0
>> +gdb_test_multiple "quit" $test {
>> + -re "will be killed.*.y or n. $" {
>> + set ok 1
>> + send_gdb "n\n"
>> + exp_continue
>> + }
>> + -re "will be detached.*.y or n. $" {
>> + send_gdb "n\n"
>> + exp_continue
>> + }
>> + -re "$gdb_prompt $" {
>> + gdb_assert $ok $test
>> + }
>> + default {
>> + fail $test
>> + }
>
> I don't think you need this default? gdb_test_multiple
> handles timeout and eof itself.
Ah, yeah, that is an artifact from the previous version which used
gdb_expect. Committed with that change.