From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 93035 invoked by alias); 17 Apr 2015 03:04:58 -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 93018 invoked by uid 89); 17 Apr 2015 03:04:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail-ob0-f180.google.com Received: from mail-ob0-f180.google.com (HELO mail-ob0-f180.google.com) (209.85.214.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 17 Apr 2015 03:04:56 +0000 Received: by obbfy7 with SMTP id fy7so56558053obb.2 for ; Thu, 16 Apr 2015 20:04:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=AavuVg1P/7HNHFMBSX0lg3YJZZZz62iSC9R/IRWTCG4=; b=kldTdlE32vm2HeugAC/UhsgZBhrVZ9OWEugn/51crwpcwih4ZiiTMb4SW5JEqD1igi vo1Y8MbmnOnp8V7EM7lC7HdDB/1DNUsvGSF8s7PKj+o5HRi4neEfswVKcV4VPptrsMzg 6rh0L2Lre4vOzQxXGIzwnWCM7DAFw/31O5j0yuZJBY2Gm5I4ez9Xe49TmiHAE9Qvbyop Y0uovCyZmGCX4G7xKGDEK2lCYNgPvDPn2S7AWP6r3beWtY7JMp7BcJQjgblan6wHCHiB NHje41T8tSHBlqJ9XmBB/tYxjCMPWYuN6HpOtdOpVQgVkXMKsihh/QIdo6xRRruNNBTt kjiw== X-Gm-Message-State: ALoCoQnv45bZ6hldu5m3FtpjrFxU+ptvFKQs4scsDCUJ8LZx5vOGmhM3I+GYgMS78rE8T7ID1MjA MIME-Version: 1.0 X-Received: by 10.182.24.97 with SMTP id t1mr743052obf.77.1429239894994; Thu, 16 Apr 2015 20:04:54 -0700 (PDT) Received: by 10.182.103.101 with HTTP; Thu, 16 Apr 2015 20:04:54 -0700 (PDT) In-Reply-To: <1429186791-6867-3-git-send-email-gbenson@redhat.com> References: <1429186791-6867-1-git-send-email-gbenson@redhat.com> <1429186791-6867-3-git-send-email-gbenson@redhat.com> Date: Fri, 17 Apr 2015 03:04:00 -0000 Message-ID: Subject: Re: [PATCH 2/7] Introduce target_fileio_set_fs From: Doug Evans To: Gary Benson Cc: gdb-patches Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-04/txt/msg00638.txt.bz2 On Thu, Apr 16, 2015 at 5:19 AM, Gary Benson wrote: > This commit introduces a new target method target_fileio_set_fs > and adds calls to it in various places. This allows support to > be added for targets where processes do not share a common > filesystem. > > gdb/ChangeLog: > > * target.h (struct inferior): New forward declaration. > (struct target_ops) : New field. > (target_fileio_set_fs): New declaration. > * target-delegates.c: Regenerate. > * target.c (target_fileio_set_fs): New function. > * exec.c (exec_file_attach): Call target_fileio_set_fs. > * gdb_bfd.c (inferior.h): New include. > (gdb_bfd_iovec_fileio_open): Rename argument. Call > target_fileio_set_fs. > (gdb_bfd_open): Call target_fileio_set_fs. Pass current > inferior as argument to gdb_bfd_iovec_fileio_open. > * linux-tdep.c (linux_info_proc): Call target_fileio_set_fs. > (linux_find_memory_regions_full): Likewise. > (linux_fill_prpsinfo): Likewise. > * solib.c (solib_find_1): Likewise. > ... > diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c > index 9d75b66..44b2970 100644 > --- a/gdb/linux-tdep.c > +++ b/gdb/linux-tdep.c > @@ -715,6 +715,9 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args, > if (args && args[0]) > error (_("Too many parameters: %s"), args); > > + /* Access /proc/ from our filesystem. */ > + target_fileio_set_fs (NULL); > + > printf_filtered (_("process %ld\n"), pid); > if (cmdline_f) > { [here and elsewhere, but here's a good example] It seems odd to have to continually set global state (the target fs) like this before being able to access the fs. Intuitively, I'd expect it to either be set once during some initialization phase, and/or have something passed as a parameter on down. Perhaps things will become clearer later in the patch set, but if you have reasons for doing it this way (that aren't mentioned elsewhere) it'd be good to hear them.