From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 106459 invoked by alias); 23 Apr 2018 13:45:55 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 106449 invoked by uid 89); 23 Apr 2018 13:45:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=HContent-Transfer-Encoding:8bit X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 23 Apr 2018 13:45:49 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B31E38182D19; Mon, 23 Apr 2018 13:45:47 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id BE4192024CA1; Mon, 23 Apr 2018 13:45:46 +0000 (UTC) Subject: Re: How to use -list-target-features MI command To: Simon Marchi , Jan Vrany References: <7d2d750c39c73c13c2d0e04667475d8f@polymtl.ca> Cc: gdb@sourceware.org From: Pedro Alves Message-ID: Date: Tue, 24 Apr 2018 10:20:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <7d2d750c39c73c13c2d0e04667475d8f@polymtl.ca> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-SW-Source: 2018-04/txt/msg00021.txt.bz2 On 04/23/2018 02:28 AM, Simon Marchi wrote: > On 2018-04-09 10:22, Jan Vrany wrote: >> I need to know (in advance) whether the target supports async >> mode or not. >> I know that -list-target-features can be used for that, but >> not sure when and how to use -list-target-features. >> >> The documentation says: >> >> "Whenever a target can change, due to commands such as -target-select, >> -target-attach or -exec-run, the list of target features may change, >> and the frontend should obtain it again." >> >> However, once I issue `-exec-run` using a target with no async mode >> support, I will not get the result of -list-target-feature before >> debugee stops. > > I think that's kind of expected.  If the run target does not support mi-async, GDB can't parse and reply to MI commands while the target is executing.  GDB reads and replies to your -list-target-features only when the target stops. > > One way to hack around it would be to use for example the new "starti" command, which breaks at (before?) the first instruction of the program, issue -list-target-features, and then continue.  There might be some better/cleaner solution, but that's what comes to mind right now. IMO the clean solution is to connect to the native target explicitly, with "-target-select native", before -exec-run, instead of letting -exec-run automatically connect to the native target if not connected to any other target yet. -gdb-set mi-async on ^done (gdb) -target-select native ^connected (gdb) -list-target-features ^done,features=["async"] (gdb) -exec-run ... I'd also suggest that frontends consider using "set auto-connect-native-target off" https://sourceware.org/gdb/onlinedocs/gdb/Starting.html Thanks, Pedro Alves