Re: [patch] New set auto-load-local-gdbinit + disable it by default

Doug Evans
2012-01-17T20:49:35Z

On Tue, Jan 17, 2012 at 12:35 PM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
> On Tue, 17 Jan 2012 21:28:29 +0100, Tom Tromey wrote:
>> I think gdb has touted this -- rightly -- as a feature.  And, if
>> anything, I think we've gone even more in this direction in recent
>> years, what with pretty-printers and Python auto-loading.  Furthermore,
>> I think this is a good trend in general; applications are getting more
>> complex, and this provides an important way to adapt the debugger to
>> them.
>
> In such case the `canned sequences of commands' should be bound to the binary,
> not to the directory.  One (me) runs GDB for so many different executablse
> while staying in src/gdb/ .

Or in binutils, for example, there are lots of different binaries,
though they share a lot in common.

For reference sake, we already have -gdb.py, which is looked for when
the objfile is loaded.

echo "print 'Hi there.'" > gdb-gdb.py && gdb -nx gdb

One could have objdump-gdb.py and readelf-gdb.py, and then if I change
binaries mid-session, the new one will get loaded, which can't happen
with .gdbinit.
[And to what extent vestiges of the old one get discarded depends on
what was done. I can imagine wanting to be able to keep more state
per-main-objfile.
I could be simultaneously debugging gdb and readelf, and not want to
see (top-gdb) (or (^gdb) or whatever) when I switch to readelf. :-)