From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14384 invoked by alias); 21 Aug 2019 18:33:48 -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 14164 invoked by uid 89); 21 Aug 2019 18:33:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.7 required=5.0 tests=AWL,BAYES_00,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,RCVD_IN_JMF_BL,SPF_PASS,USER_IN_DEF_SPF_WL autolearn=no version=3.3.1 spammy=shipping X-HELO: mail-oi1-f193.google.com Received: from mail-oi1-f193.google.com (HELO mail-oi1-f193.google.com) (209.85.167.193) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 21 Aug 2019 18:33:46 +0000 Received: by mail-oi1-f193.google.com with SMTP id o6so2356524oic.9 for ; Wed, 21 Aug 2019 11:33:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=g6dCnqIwe0y6Tb6z8UkUapDZjpM29ksY2wkgK0nV7iw=; b=F6iSXA0LyO8UtcXVLc2XvhXVdYFl0XuEGeH2XV1EQzFcE+puB3DyNBQsAFtQstDd71 W/WT+akSGGU0JOvSXPCCXM16pCgmXOrUCSQU6SNiAe6HJOCqr3r/FesXw/WNo2EUol8F oIecZuVO4dG+ExbtcWmrOYGk36EvjduE5WuCUIPvpjUD2j6Tofd+UCjAwSSa+fDtJpea uRC0YPk2xm/o3ec/hU+UdMGdesIiUZ2WzrLree/EMxpTy/W4izFKOnjIsVFEzSJMaDG7 4hMXc82S5msUNLTzbVplSxWZPc8PONG4gHs45q0Ar4nnyDAYpviNWS8rJXGQIOWMzJmQ pGNA== MIME-Version: 1.0 References: <20190820221745.147370-1-cbiesinger@google.com> In-Reply-To: From: "Christian Biesinger via gdb-patches" Reply-To: Christian Biesinger Date: Wed, 21 Aug 2019 18:33:00 -0000 Message-ID: Subject: Re: [PATCH 0/3] [RFC] Load gdbinit files from a directory To: Pedro Alves Cc: Christian Biesinger via gdb-patches Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2019-08/txt/msg00507.txt.bz2 On Wed, Aug 21, 2019 at 1:13 PM Pedro Alves wrote: > On 8/20/19 11:17 PM, Christian Biesinger via gdb-patches wrote: > > This patch series is some refactoring and then a patch to load gdbinit > > files from a directory, instead of only allowing a single file. > > > > Fedora ships a system gdbinit file that does something similar; this > > does this by default and also works if Python is disabled. > > Note that Fedora won't be able to replace the current mechanism with > this, because it also loads Python files from the dir: > > python > import glob > # glob.iglob is not available in python-2.4 (RHEL-5). > for f in glob.glob('/etc/gdbinit.d/*.gdb'): > gdb.execute('source %s' % f) > for f in glob.glob('/etc/gdbinit.d/*.py'): > gdb.execute('source %s' % f) > end > > So we'd need an additional "--with-system-python-scripts-dir" > for Python scripts or some such. That's a good point. I don't think -with-system-python-scripts-dir would really work for Fedora either since the directory there is currently the same but I could change the patch to use get_ext_lang_of_file/ext_lang_script_sourcer (which is effectively pretty similar to the current Fedora gdbinit) > The advantage of Fedora's method IMO is that it's more flexible: > A distro or packager can decide to load gdb scripts from more than > one dir by default, e.g., from "~/gdbinit.d/", or to load gdb scripts and > python scripts from different dirs, etc. It's similar to > /etc/bashrc loading scripts from /etc/profile.d/, etc. instead of bash > loading the scripts from a dir itself. Of course the difference > here is that you can't walk directories with gdb's cli scripting. I guess it may be possible to add glob support to the source command. > Speaking of Python scripts, I guess Fedora's script should be > loading Guile scripts as well. I agree. (Certainly if GDB shipped a default gdbinit like that, it should do that) > That isn't to say that I object to your patchset, TBC. I just > see it a bit under the "why do it in C when you can script" light. > Of course the answer can reasonably be "I need this without Python". So there were two reasons why I liked this approach: - This ships something with GDB, that will work on all Linux distributions the same way, as long as they agree on a directory location - It works without Python enabled I'd also be happy with shipping a default gdbinit file that does a similar thing, especially if we were to add glob support to the source command. I dunno, anyone else have thoughts on this? Christian