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: PR 7536 - ``set input-radix 1'' changes radix


On Monday 29 December 2008 19:11:17, Tom Tromey wrote:

> I also looked at this bug a little, and I was wondering whether we
> should fix this generically, for all parameters, by saving the
> parameter's value and then restoring it if the setter function raises
> an error.  What do you think of that?

That's actually something that crosses my mind everytime I
touch these set/validate functions.

There are a couple of corner/tricky case that you would have to consider
like QUIT (pagination makes that easy-ish to trigger), and the fact that
it can happen before or after the setter having already done
side effects; or, an error not meaning the setting didn't take effect.
A codebase audit would probably be required to make sure side effects
are unwound correctly, but it's probably doable.  Another option would
be to pass to the setter the new alreayd parsed value, and let it validate
and set the final variable itself --- the setter code always knows what
it it setting.  The issue is that you either pass a variant, or have
a different setter function type for each type of variable.

-- 
Pedro Alves


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