From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 63118 invoked by alias); 10 Sep 2018 19:03:18 -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 63028 invoked by uid 89); 10 Sep 2018 19:03:17 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=annoying, Lets, Let's, realize X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 10 Sep 2018 19:03:16 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id w8AJ39ns026515 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 10 Sep 2018 15:03:14 -0400 Received: by simark.ca (Postfix, from userid 112) id C833E1E75F; Mon, 10 Sep 2018 15:03:09 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id 1382F1E16B; Mon, 10 Sep 2018 15:03:08 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 10 Sep 2018 19:03:00 -0000 From: Simon Marchi To: John Baldwin Cc: Simon Marchi , gdb-patches@sourceware.org Subject: Re: [PATCH 4/5] Support 'info proc files' on live FreeBSD processes. In-Reply-To: <78a76b21-779f-b44d-29ec-5494b1a5476d@FreeBSD.org> References: <20180908003659.37482-1-jhb@FreeBSD.org> <20180908003659.37482-5-jhb@FreeBSD.org> <5889a8bc-3941-677c-ff54-135b1bb9f2d6@ericsson.com> <78a76b21-779f-b44d-29ec-5494b1a5476d@FreeBSD.org> Message-ID: X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.6 X-IsSubscribed: yes X-SW-Source: 2018-09/txt/msg00296.txt.bz2 On 2018-09-10 19:30, John Baldwin wrote: > On 9/8/18 4:00 PM, Simon Marchi wrote: >> On 2018-09-08 01:36 AM, John Baldwin wrote: >>> This walks the list of struct kinfo_file objects returned by a call >>> to >>> kinfo_getfile outputting a description of each open file descriptor. >> >> LGTM. >> >> It would be nice to share the printing of the information between core >> and live process, so that we can't forget to change one if we change >> the >> other. But if there are some subtle differences between both loops >> that >> would make sharing more annoying than anything, I don't mind. > > I've followed the same approach I used for 'info proc mappings' which > is > to use shared helper routines as much as possible. > > What I could perhaps do to share code is add new TARGET_FREEBSD_ > target objects, but this would entail reworking the code quite a bit I > think. It would mean that I would need a way to let a gdbarch hook > into > the core target's xfer_partial method more generically (right now there > is > a hook just for siginfo, but I think we'd want a hook for arbitrary > objects). I would then rewrite the info proc bits in fbsd-tdep.c in > terms > of fetching target objects and always parsing them in the core dump > format. I think there were a few things in some of the other 'info > proc' > methods that weren't quite as straightforward as for the 'files' and > 'mappings' case though. I was thinking more about how to share the code that formats and print one entry. Let's say you realize later that a column needs to be wider, you have to remember to update both the live and core versions. Not really a big deal though. Simon