From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 77448 invoked by alias); 11 Aug 2015 11:55: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 77435 invoked by uid 89); 11 Aug 2015 11:55:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.2 required=5.0 tests=BAYES_05,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: mail-wi0-f179.google.com Received: from mail-wi0-f179.google.com (HELO mail-wi0-f179.google.com) (209.85.212.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 11 Aug 2015 11:55:44 +0000 Received: by wicne3 with SMTP id ne3so173430496wic.1 for ; Tue, 11 Aug 2015 04:55:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=Qz0gmV7Q+yKT+m7xkzRBnDHTzyA+dC3GsxJMlBL9p/4=; b=ZicsLxUA9Eznv9ZBVTtQB7QLMDrpjPV/7K4ygTiO1wWdKdQQ/Q+GjUuQZ7TTvkSdmK lYUDeOz8R1km7q8W7reSasSlAhbGtYGMXIT5hET6yU49f2u4V1Ti6DBOog6DQ28RP8gp K6xuxKi1l0IHr5aTgo1xYzBor2aaoSuVqhdxGWFgHLI1u7QSEjBDOF3qUCaqSaZVa3g8 O2L+ldyRc9N7Tzvc4Vhv3XxC8VKqBFgQoGrPt/IhG2Zn2FK7DD+2OOGDHDgOg2d0aKVH LqyC9NRaUIVySDeZHWsgpmKPJI8nZ5DQYIqZUO5TWL3KjEVz19QFQsgMffVkMPnzfYxD f6UQ== X-Gm-Message-State: ALoCoQmjJLZMy4ApzigZEl27oqApllr5lHOHB2aVrvQR43fPl2eCMtXbtK9g9Ti5/nKM+zhEbDsB X-Received: by 10.194.109.97 with SMTP id hr1mr55452801wjb.38.1439294140464; Tue, 11 Aug 2015 04:55:40 -0700 (PDT) Received: from localhost (host86-138-92-179.range86-138.btcentralplus.com. [86.138.92.179]) by smtp.gmail.com with ESMTPSA id v9sm2656201wjq.41.2015.08.11.04.55.39 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Aug 2015 04:55:39 -0700 (PDT) Date: Tue, 11 Aug 2015 11:55:00 -0000 From: Andrew Burgess To: Gary Benson Cc: gdb-patches@sourceware.org, Sandra Loosemore , Doug Evans , Pedro Alves , Jan Kratochvil , =?iso-8859-1?Q?Andr=E9_P=F6nitz?= , Paul_Koning@Dell.com Subject: Re: [PATCH 1/2] Warn when accessing binaries over RSP Message-ID: <20150811115538.GA7352@embecosm.com> References: <1438788496-32246-1-git-send-email-gbenson@redhat.com> <1438788496-32246-2-git-send-email-gbenson@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1438788496-32246-2-git-send-email-gbenson@redhat.com> X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2015-08/txt/msg00235.txt.bz2 * Gary Benson [2015-08-05 16:28:15 +0100]: > > diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c > index 1781d80..b511777 100644 > --- a/gdb/gdb_bfd.c > +++ b/gdb/gdb_bfd.c > @@ -219,13 +219,38 @@ gdb_bfd_iovec_fileio_open (struct bfd *abfd, void *inferior) > const char *filename = bfd_get_filename (abfd); > int fd, target_errno; > int *stream; > + struct target_ops *ops = find_target_at (process_stratum); > > gdb_assert (is_target_filename (filename)); > + filename += strlen (TARGET_SYSROOT_PREFIX); > + > + /* GDB provides no indicator of progress during file operations, and > + can appear to have locked up during slow remote transfers, so we > + inform the user what is happening and suggest a way out. It's > + unpleasant that we need to detect remote targets this way (rather > + than putting the warnings in remote_hostio_open), but it's not > + possible for remote_hostio_open to differentiate between > + accessing inferior binaries (which can be bypassed) and accessing > + things like /proc/ (which is unavoidable). */ > + if (strcmp (ops->to_shortname, "remote") == 0 > + || strcmp (ops->to_shortname, "extended-remote") == 0) > + { > + static int warning_issued = 0; > + > + printf_unfiltered (_("Reading %s from remote target\n"), > + filename); > + > + if (!warning_issued) > + { > + warning (_("File transfers from remote targets can be slow.\n" > + "Use \"set sysroot\" to access files locally" > + " instead.")); > + warning_issued = 1; > + } > + } Altering the behaviour based on to_shortname feels like breaking this nice target OO model we have. Could the warning not be moved down into target_fileio_open instead? Or if that's really not an appropriate place should we add a new target method? Thanks, Andrew