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

Doug Evans
2012-01-17T18:29:21Z

On Tue, Jan 17, 2012 at 9:48 AM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
> On Tue, 17 Jan 2012 18:26:49 +0100, Doug Evans wrote:
>> I, OTOH, like the (top-gdb) prompt.
>
> I think you and me can very easily do whatever we like with GDB.  I care more
> about both newbie users of GDB and also about newcomers to GDB development.

As if to suggest I don't care ...
Ummm ... eh?

>> One could argue the converse too ... Having to manually request
>> whatever goodies the developers find useful adds a needless burden.
>> Why can't gdb just auto-adjust itself for debugging the program at
>> hand?
>
> Because it is then different than normal GDB.
>
> It is difficult to argue myself but IMO in a survey between GDB newbies they
> find easier if GDB behaves always the same than if it behaves differently
> according to which program you load into it.

Which survey is that? Is it online?
[And I'm curious once they understand what's going on, what do they prefer.
Every new thing involves a bit of a learning curve ... I'd be curious
to know what the long term cost/benefit is for these newbies in
addition to just the short term ... Once they understand it, do they
prefer it?]

>> There is the path that gdb searches for libthread_db, maybe you meant
>> to refer to that;
>
> Yes, I meant this part.
>
>
>> one can change it before choosing the file to debug.   You seem to
>> suggest that -nx was "good enough" before.  If that was good enough
>> before (and that's a big "if"), why is changing the search path first
>> not also "good enough".
>
> Now instead of just -nx one has to use also "set auto-load-scripts off",
> use -ex "file X" and -ex "core-file Y" instead of just X and Y to get that
> "set auto-load-scripts off" executed first,
> use beforehand -ex "set libthread-db-search-path /foo", OK, that may be enough
> if I did not miss anything else.

Script it.

> I admit I did not know about "set auto-load-scripts off" myself until
> recently.
>
>
>> As for Python auto-loading, if -nx was good enough before (and if one
>> *really* wanted to run gdb in a security hardened environment one
>> would use a secured VM or some such anyway ...), then why isn't
>> turning off auto-loading of Python scripts ahead of time also good
>> enough?
>
> Yes, it is, it is just too complicated,

Too complicated how?
Write the script once and you're done.
If we had a contrib-like directory we could even ship one with gdb.

> similiar to the extra VM.  I plan to
> just merge the paragraph above into some user-accessible command-line option
> "-safe".  I am just not sure how to load pretty printers from system libraries
> which are safe but which do not get loaded after "set auto-load-scripts off".

Are we sure we want to claim to the user community -safe is, umm, safe?
It seems like we're a fair ways from being ready to claim it, setting
aside auto-loading.