From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27016 invoked by alias); 5 Aug 2016 17:26:47 -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 27007 invoked by uid 89); 5 Aug 2016 17:26:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=spots, Hx-languages-length:1757 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 05 Aug 2016 17:26:45 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E9527811A2; Fri, 5 Aug 2016 17:26:43 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u75HQgrK031701; Fri, 5 Aug 2016 13:26:43 -0400 Subject: Re: [PATCH 1/2] mi: Restore original thread/frame when specifying --thread or --thread-group To: Simon Marchi , gdb-patches@sourceware.org References: <20160801211401.18155-1-simon.marchi@ericsson.com> <20160801211401.18155-2-simon.marchi@ericsson.com> <155e8052-19b5-a446-c9bd-f973ded3eaa3@ericsson.com> <83adec9c-d7a1-3165-eac7-236372e994ef@redhat.com> <9a530702-6889-0d20-0a20-fcbce3cd57e2@ericsson.com> From: Pedro Alves Message-ID: Date: Fri, 05 Aug 2016 17:26:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <9a530702-6889-0d20-0a20-fcbce3cd57e2@ericsson.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-08/txt/msg00091.txt.bz2 On 08/03/2016 11:20 PM, Simon Marchi wrote: > > On 16-08-03 09:41 AM, Pedro Alves wrote: > I tried to set command_changes_user_selected_thread in normal_stop, but it didn't work > right away. That's because a breakpoint hit during an infcall calls error(), and the code > that discards the cleanup when command_changes_user_selected_thread is true is not executed. > > I solved that by adding a try/catch in mi_cmd_execute that discards the cleanup and rethrows > the exception. Yeah. The approach of extending the previous_inferior_ptid's scope a bit would avoid this, since it wouldn't need to revert back anything with a cleanup. Might end up being that once all the spots are identified, switching to the other approach ends up being a simpler patch. > >> E.g., this user-defined command starts the program and stops in >> thread 2.1, but MI still reverts back to the "--thread" thread: ... > I was surprised this wasn't automatically solved with the fix in normal_stop. That's > because "start" sets previous_inferior_ptid to the initial thread when it is started > (in init_wait_for_inferior). Actually, I think that starting a new inferior is a case > where we want to change the user selected thread. Setting command_changes_user_selected_thread > in init_wait_for_inferior fixes this. Right. > Here's an updated patch. Notes/todo: > > - I did not test with compile yet. > - I thought about that just before sending: I think there's also something to do about > "frame X", "up" and "down", e.g.: > > -interpreter-exec --thread 1 console "up" > > won't work. Sounds like it. And don't we need a similar treatment for --frame ? Thanks, Pedro Alves