Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Christian Biesinger via gdb-patches" <gdb-patches@sourceware.org>
To: Pedro Alves <palves@redhat.com>
Cc: Christian Biesinger via gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH 0/3] [RFC] Load gdbinit files from a directory
Date: Wed, 21 Aug 2019 18:33:00 -0000	[thread overview]
Message-ID: <CAPTJ0XG3G7wQ9YOuYBa+OKuiT-Y3wupwAeD9tfjVxb3XAbxmQA@mail.gmail.com> (raw)
In-Reply-To: <e90c085a-e9a0-ebe9-dc1b-9533bbbbfcbf@redhat.com>

On Wed, Aug 21, 2019 at 1:13 PM Pedro Alves <palves@redhat.com> 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


  reply	other threads:[~2019-08-21 18:33 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-20 22:17 Christian Biesinger via gdb-patches
2019-08-20 22:18 ` [PATCH 1/3] Refactor get_init_files to use std::string Christian Biesinger via gdb-patches
2019-08-21 17:13   ` Sergio Durigan Junior
2019-08-21 17:29     ` Christian Biesinger via gdb-patches
2019-08-21 17:31       ` [PATCH 1/3 v2] " Christian Biesinger via gdb-patches
2019-08-21 17:34       ` [PATCH 1/3] " Sergio Durigan Junior
2019-08-20 22:18 ` [PATCH 2/3] Factor out the code to do the datadir-relocation for gdbinit Christian Biesinger via gdb-patches
2019-08-21 17:19   ` Sergio Durigan Junior
2019-08-21 17:44     ` Christian Biesinger via gdb-patches
2019-08-21 17:44       ` [PATCH 2/3 v2] " Christian Biesinger via gdb-patches
2019-08-21 17:47       ` [PATCH 2/3] " Sergio Durigan Junior
2019-08-21 18:08         ` Christian Biesinger via gdb-patches
2019-08-21 18:10           ` Sergio Durigan Junior
2019-08-20 22:18 ` [PATCH 3/3] Load system gdbinit files from a directory Christian Biesinger via gdb-patches
2019-08-21 17:32   ` Sergio Durigan Junior
2019-08-26  0:25     ` Christian Biesinger via gdb-patches
2019-08-26  0:33       ` [PATCH 3/3 v2] " Christian Biesinger via gdb-patches
2019-08-26  7:22         ` Eli Zaretskii
2019-09-12 22:12           ` Christian Biesinger via gdb-patches
2019-09-24 16:30             ` [PATCH 3/3 v3] " Christian Biesinger via gdb-patches
2019-10-03 18:42               ` Christian Biesinger via gdb-patches
2019-10-13  1:19                 ` Christian Biesinger via gdb-patches
2019-08-21 18:15   ` [PATCH 3/3] " Sergio Durigan Junior
2019-08-21 18:46     ` Christian Biesinger via gdb-patches
2019-08-21 18:13 ` [PATCH 0/3] [RFC] Load " Pedro Alves
2019-08-21 18:33   ` Christian Biesinger via gdb-patches [this message]
2019-08-21 18:54     ` Sergio Durigan Junior
2019-08-25 22:24   ` Christian Biesinger via gdb-patches
2019-08-26 13:31     ` Pedro Alves
2019-09-12 22:14       ` Christian Biesinger via gdb-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPTJ0XG3G7wQ9YOuYBa+OKuiT-Y3wupwAeD9tfjVxb3XAbxmQA@mail.gmail.com \
    --to=gdb-patches@sourceware.org \
    --cc=cbiesinger@google.com \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox