From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 62996 invoked by alias); 11 Apr 2016 19:14:44 -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 62981 invoked by uid 89); 11 Apr 2016 19:14:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy=TCL, sourced X-HELO: usplmg21.ericsson.net Received: from usplmg21.ericsson.net (HELO usplmg21.ericsson.net) (198.24.6.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 11 Apr 2016 19:14:42 +0000 Received: from EUSAAHC003.ericsson.se (Unknown_Domain [147.117.188.81]) by usplmg21.ericsson.net (Symantec Mail Security) with SMTP id E8.91.22441.877FB075; Mon, 11 Apr 2016 21:14:00 +0200 (CEST) Received: from [142.133.110.144] (147.117.188.8) by smtp-am.internal.ericsson.com (147.117.188.83) with Microsoft SMTP Server id 14.3.248.2; Mon, 11 Apr 2016 15:14:39 -0400 Subject: Re: [PATCH 1/4] native-gdbserver: Clear isremote flag in board info To: Pedro Alves , Simon Marchi , References: <1459912543-15328-1-git-send-email-simon.marchi@polymtl.ca> <570BEF8B.70203@redhat.com> From: Simon Marchi Message-ID: <570BF79F.2070409@ericsson.com> Date: Mon, 11 Apr 2016 19:14:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <570BEF8B.70203@redhat.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-04/txt/msg00220.txt.bz2 On 16-04-11 02:40 PM, Pedro Alves wrote: > On 04/06/2016 04:15 AM, Simon Marchi wrote: > >> There seems to be some confusion globally in the testsuite about what's >> native and what's not, what's remote and what's not. It's probably >> because of the overlap in vocabulary between DejaGnu and GDB. > > Yeah. This whole mess, and the confusion it brings in, has been a known > issue for a long time, and I'm very glad someone's doing something about it! > >> Because of this confution, a lot of tests in the testsuite don't check >> for the right kind of target remote. For example, some use [is_remote >> target] (which checks whether the DejaGnu target is remote), when what >> they really want to know is whether GDB is using its remote target (e.g. >> because feature X is only available when GDB debugs natively). Those >> should use [gdb_is_target_remote] instead. > > Note gdb_is_target_remote is a bit "heavy" in that it runs a gdb > command to check what is the target _right now_. For checks at > the top of testcases that want to bail out early before even > gdb is started, it's cheaper to check: > > [target_info gdb_protocol] == "remote" || [target_info gdb_protocol] == "extended-remote"] > > (we should have a proc for that...) > > My fault for introducing gdb_is_target_remote and using in several > places, when the "cheaper" test would do. Ok, that makes sense. I'll investigate in that direction. >> Also, some of them require careful analysis/discussion. I'd still like >> to submit this patch right now anyway, since I don't want to spend >> countless hours fixing everything and then be told that my approach is >> wrong... I'd like to be told right away, if that's the case :). > > I think you're on the right track. > >> So, I >> have included a few examples of fixed tests in the following patches, >> but it's by no means comprehensive. >> > >> --- a/gdb/testsuite/boards/native-gdbserver.exp >> +++ b/gdb/testsuite/boards/native-gdbserver.exp >> @@ -36,26 +36,6 @@ set_board_info exit_is_reliable 1 >> # We will be using the standard GDB remote protocol. >> set_board_info gdb_protocol "remote" >> >> -proc ${board}_spawn { board cmd } { >> - global board_info >> +set baseboard [lindex [split $board "/"] 0] >> +set board_info($baseboard,isremote) 0 > > OOC, don't we need the "global" declarations as > in native-extended-gdbserver.exp? Apparently not, since it works :) I'm not familiar enough with TCL to know that. Are we executing in the body of a procedure at this point? This file is sourced from some proc in DejaGnu, so I'd say yes, but this example may suggest otherwise. > You're probably already thinking of doing this, but I'll state it > explicitly anyway: it'd be nice to move this isremote frobbing to > a shared .exp file, so that boards that need it can just > source the file. I wasn't, but it's a good idea. isremote is also handled in an unintuitive way, since the testsuite only checks if it's defined. So when you set isremote to 0, it's still considered as "true".