Re: [RFC/RFA] add struct parse_context to all command functions

Ulrich Weigand
2008-10-21T18:12:20Z

Tom Tromey wrote:

> Also, why pass in this particular subset of globals? There are lots
> of globals in gdb, used all over. My view is that commands are by
> their nature singletons (unless you want to support multiple CLIs at
> once of course :-) and so would reasonably access global state even in
> a design from scratch. IOW, I think it would make sense to only
> bother with global-elimination for layers underneath the command
> functions.

I think it does make sense to make the context where a command is
executed more explicit, so that at some point in the future we might
actually be able to do something like "execute command X on thread Y"
transparently without having to switch global state. Of course, more
than just Joel's patch will be needed to achieve this ...

> FWIW I also have a vaguely similar reorganization in the wings. I
> removed all accesses to global variables from the value_print and
> val_print hierarchy, in favor of a "print options" argument. So, my
> interest in this sort of thing is not totally academic.

Great! I was just about to start implementing something along those
lines (to pull current_gdbarch out of the print routines) ... Do you
already have a version of that patch you could share?

Bye,
Ulrich

--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com