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: [RFA/python:2/2] First script in GDB python library - command/pahole.py


>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:

Joel> I think that if we want to have help and apropos working, we might
Joel> as well just use the simpler approach of running the command scripts
Joel> right from the start.

I have been thinking more about this problem recently.

One idea is KISS: just load all the commands and functions at startup.
I avoided this initially out of fear that it would be too slow -- but I
never measured it.  Maybe it isn't so bad.

A second idea is to install the Command objects eagerly, but have the
implementation lazily load the actual code.  That is, there would be a
single Command subclass that would take a help string, a module name,
and a class name (string) arguments, and then when the user invoked the
command it would import the module and instantiate an object to which
the command operations would be delegated.

This approach would work for convenience functions, too.  It is also
easy for 3rd party users to use.

Also, we can always start with KISS and move to the lazier approach if
it turns out to be too slow.

Tom


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