From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 59223 invoked by alias); 17 Jun 2016 15:07:59 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 59211 invoked by uid 89); 17 Jun 2016 15:07:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-pa0-f68.google.com Received: from mail-pa0-f68.google.com (HELO mail-pa0-f68.google.com) (209.85.220.68) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 17 Jun 2016 15:07:57 +0000 Received: by mail-pa0-f68.google.com with SMTP id us13so6006382pab.1 for ; Fri, 17 Jun 2016 08:07:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=NzhSC5UZJVuT7Ir6ntOe7puXR21rdlT1C4RY0jizSTM=; b=f08W5qSEHJwiYp9wFFAUkr5dnwGwCkeWtLTIdFilUknbuHvHW3pPjM+z9ABcVx9MyF q8X2WravkxCIY9e6zA9+B79KegKYVvxWpapX4SKGQax8d5V050g8Kc1Dx+aA7i80+MFZ TsPBILVpFDQURgNNvLPWcxz/Z5Po41B5/RE4KPwbAInO6QdFE9dgtHfPDB8grRBz9gHc 6DDI7wyCe1BUobcCJNC1cDhQWRvo41aKAak9aXGkEx0yCJhqTYrWpRu9OsvBIE6XFRG5 dR4mpZMp3IwacakH7i9rwW2O8yrEGhUQmfUXt31J5vMtPrjQ94iDhJVP9stBm6rRdJOf opTw== X-Gm-Message-State: ALyK8tLj9wyG1y1Ad1NAY8W9znmfYbulFayEuLvLsrsufmrDBH8YD1UMt67BDF0KYRX9yA== X-Received: by 10.67.15.72 with SMTP id fm8mr2920344pad.50.1466176075677; Fri, 17 Jun 2016 08:07:55 -0700 (PDT) Received: from E107787-LIN (gcc113.osuosl.org. [140.211.9.71]) by smtp.gmail.com with ESMTPSA id fj13sm69263671pab.0.2016.06.17.08.07.52 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 17 Jun 2016 08:07:54 -0700 (PDT) From: Yao Qi To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [PATCH v4 3/3] Fix failure to detach if process exits while detaching on Linux References: <1466119968-15171-1-git-send-email-palves@redhat.com> <1466119968-15171-4-git-send-email-palves@redhat.com> Date: Fri, 17 Jun 2016 15:07:00 -0000 In-Reply-To: <1466119968-15171-4-git-send-email-palves@redhat.com> (Pedro Alves's message of "Fri, 17 Jun 2016 00:32:48 +0100") Message-ID: <86k2hnsvk0.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2016-06/txt/msg00304.txt.bz2 Pedro Alves writes: > +# If testing single-process, simply detach from the process. > +# > +# If testing multi-process, first detach from the child, then detach > +# from the parent and confirm that the parent exits, thus unsuring s/unsuring/ensuring/ ? > +# we've detached from the child successfully, as the parent hangs in > +# its waitpid call otherwise. > +# > +# If connected with "target remote", make sure gdbserver exits. > +# > +# CMD indicates what to do with the parent after detaching the child. > +# Can be either "detach" to detach, or "continue", to continue to > +# exit. If "continue", then CONTINUE_RE is the regexp to expect. > +# Defaults to normal exit output. > +# > +proc do_detach {multi_process cmd {continue_re ""}} { > + global decimal > + global server_spawn_id > + > + if {$continue_re =3D=3D ""} { > + set continue_re "exited normally.*" > + } > + > + set is_remote [expr {[target_info exists gdb_protocol] > + && [target_info gdb_protocol] =3D=3D "remote"}] > + > + if {$multi_process} { > + gdb_test "detach" "Detaching from .*, process $decimal" \ > + "detach child" > + > + gdb_test "inferior 1" "\[Switching to inferior $decimal\].*" \ > + "switch to parent" > + > + if {$cmd =3D=3D "detach"} { > + # Make sure that detach works and that the parent process > + # exits cleanly. > + detach_and_expect_exit "detach parent" > + } elseif {$cmd =3D=3D "continue"} { > + # Make sure that continuing works and that the parent process > + # exits cleanly. > + gdb_test "continue" $continue_re > + } else { > + perror "unhandled command: $mode: $cmd" no variable "mode". > + } > + } else { > + if $is_remote { > + set extra "\r\nEnding remote debugging\." > + } else { > + set extra "" > + } > + if {$cmd =3D=3D "detach"} { > + gdb_test "detach" "Detaching from .*, process $decimal$extra" > + } elseif {$cmd =3D=3D "continue"} { > + gdb_test "continue" $continue_re > + } else { > + perror "unhandled command: $mode: $cmd" > + } > + } > + --=20 Yao (=E9=BD=90=E5=B0=A7)