From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 97614 invoked by alias); 21 Aug 2019 18:13: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 97605 invoked by uid 89); 21 Aug 2019 18:13:47 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=fedoras, Fedora's, Fedoras, fedora's X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 21 Aug 2019 18:13:45 +0000 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AC846C0546F2 for ; Wed, 21 Aug 2019 18:13:44 +0000 (UTC) Received: by mail-wr1-f70.google.com with SMTP id a17so1607958wrw.3 for ; Wed, 21 Aug 2019 11:13:44 -0700 (PDT) Received: from ?IPv6:2001:8a0:f913:f700:4c97:6d52:2cea:997b? ([2001:8a0:f913:f700:4c97:6d52:2cea:997b]) by smtp.gmail.com with ESMTPSA id o14sm40054612wrg.64.2019.08.21.11.13.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Aug 2019 11:13:42 -0700 (PDT) Subject: Re: [PATCH 0/3] [RFC] Load gdbinit files from a directory To: Christian Biesinger , gdb-patches@sourceware.org References: <20190820221745.147370-1-cbiesinger@google.com> From: Pedro Alves Message-ID: Date: Wed, 21 Aug 2019 18:13:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20190820221745.147370-1-cbiesinger@google.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-08/txt/msg00505.txt.bz2 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. 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. Speaking of Python scripts, I guess Fedora's script should be loading Guile scripts as well. 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". Thanks, Pedro Alves