From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21629 invoked by alias); 12 Mar 2013 10:05:05 -0000 Received: (qmail 21575 invoked by uid 22791); 12 Mar 2013 10:05:04 -0000 X-SWARE-Spam-Status: No, hits=-4.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 12 Mar 2013 10:04:55 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1UFM4k-0004ww-81 from Yao_Qi@mentor.com ; Tue, 12 Mar 2013 03:04:54 -0700 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Tue, 12 Mar 2013 03:04:53 -0700 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.1.289.1; Tue, 12 Mar 2013 03:04:53 -0700 Message-ID: <513EFD81.6050401@codesourcery.com> Date: Tue, 12 Mar 2013 10:05:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Jan Kratochvil CC: , "Metzger, Markus T" Subject: Re: [patch] Fix remote.c incorrectly using pop_target (wrt btrace) References: <20130311172836.GA22575@host2.jankratochvil.net> In-Reply-To: <20130311172836.GA22575@host2.jankratochvil.net> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes 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 X-SW-Source: 2013-03/txt/msg00507.txt.bz2 On 03/12/2013 01:28 AM, Jan Kratochvil wrote: > @@ -4348,7 +4344,7 @@ remote_open_1 (char *name, int from_tty, > /* Pop the partially set up target - unless something else did > already before throwing the exception. */ > if (remote_desc != NULL) > - pop_target (); > + remote_unpush_target (); Since it is in remote_open_1, the remote target or exteneded-remote target is just pushed and top most, so pop_target should be fine here. It is not necessary to change it to remote_unpush_target. > if (target_async_permitted) > wait_forever_enabled_p = 1; > throw_exception (ex); > @@ -5096,7 +5092,7 @@ interrupt_query (void) > if (query (_("Interrupted while waiting for the program.\n\ > Give up (and stop debugging it)? "))) > { > - pop_target (); > + remote_unpush_target (); > deprecated_throw_reason (RETURN_QUIT); > } > } > @@ -7051,11 +7047,11 @@ readchar (int timeout) > switch ((enum serial_rc) ch) > { > case SERIAL_EOF: > - pop_target (); > + remote_unpush_target (); Supposing we are in 'record-btrace' target and get a communication error, the current target stack looks like: record-btrace remote exec none remote_unpush_target will unpush or remove the remote target in the stack. So the stack is changed to: record-btrace exec none Is it what we want? When GDB is in record-btrace target, and get some errors in communication, both record-btrace and remote target should be popped from the stack. -- Yao (齐尧)