This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 0/3] [RFC] Load gdbinit files from a directory


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]