This is the mail archive of the gdb-patches@sources.redhat.com 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]

Re: [prelim patch] Add the notion of a global init file to gdb.


[ i've been busy; sorry for the slight delay in reply. 8-]

Fernando Nasser <fnasser@cygnus.com> writes:
>First of all, we must make sure gdb mentions that it found this file and it is
>"sourcing" it.  Imagine how difficult it can be to debug gdb problems without
>knowing that some commands were executed at startup.

'help source' will tell you (at least some of) the files which gdb
tries to source at startup.  (it does _not_ currently mention
$(HOME)/.gdbinit, as far as I can tell, nor does it do so on non-ansi
C systems iirc.  My patch updated it to mention the global init file,
if any, and, obviously, I'll have to do the documentation if this
patch is considered a good thing.)

I disagree that GDB has to, or even should, mention that it found the
file; it doesn't do that for $(HOME)/.gdbinit, or .gdbinit, why is
this any different?  (In fact, in this case, the whole _point_ is the
possibility of transparent extension of gdb.)

In my particular case, because I want to make _sure_ the right thing
is happening, I have my loaded script print a note about it being
loaded.  But I don't see why this should be treated differently than
$(HOME)/.gdbinit or even ./.gdbinit.


> And will -nx inhibit global, $HOME and start directory gdbinits?
> Or just the last two?

As i implemented it, all.

To be honest, I'm of two minds about it:

One perspective is that if it's a "local transparent extension" of
GDB, you'd never want to run GDB without that extension in the local
context, so it shouldn't be disabled by -nx.

On the other hand, having it not be sourced is more consistent with
the current and i'd say expected behaviour of GDB: -nx means don't
source the normally-used init files.

I implemented it so that all would be disabled, following the latter
pattern of thought, because it's easier to work around:

If you say -nx and it disables automatic inclusion, you can always
include it yourself (if you want/need it).

On the other hand, if -nx _doesn't_ disable automatic inclusion, then
it may be insane to attempt to override the script (for users who
don't necessary have permission to remove it).



Anyway, those are my opinions and rationale; i'd love to hear the
opinions of other members of the community.

If there's some kind of consensus, I'll be glad to implement it (since
I'd like to see the feature in, so I don't have to maintain it
locally), but I'd like to hear some more voices.  8-)


chris

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