This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC v2] Extend gdb.parse_and_eval to accept a format string
- From: Tom Tromey <tromey at redhat dot com>
- To: Siva Chandra <sivachandra at google dot com>
- Cc: gdb-patches <gdb-patches at sourceware dot org>
- Date: Thu, 13 Feb 2014 10:56:32 -0700
- Subject: Re: [RFC v2] Extend gdb.parse_and_eval to accept a format string
- Authentication-results: sourceware.org; auth=none
- References: <CAGyQ6gyHc-T0fQjLoDiOYRtqBzjQm_KruZc2S3DFTgrdwZnYwg at mail dot gmail dot com>
>>>>> "Siva" == Siva Chandra <sivachandra@google.com> writes:
Siva> If the string argument to gdb.parse_and_eval is a format string, then a
Siva> variable number of args of type gdb.Value can follow. The number of
Siva> gdb.Value args to be passed is determined by the format string. The Nth
Siva> gdb.Value arg is referenced by "${N}" in the format string. The value
Siva> of N starts at 0.
Siva> The idea here is that the format string argument will be parsed and
Siva> evaluated as an expression after the "${N}" occurances in it are
Siva> replaced with an internal variable having the same value as encapsulated
Siva> by the Nth gdb.Value arg.
I appreciate the quick-and-dirty programming that this patch enables,
but I am not that fond of this particular expression of the idea. It
seems to me that it would be more generally useful to present a way for
Python scripts to create and manipulate convenience variables; and that
this would additionally solve the problem at hand equally well.
As to the patch itself, I think that it leaves the special convenience
variables lying about after parsing; which doesn't seem so great. Also
I think the "true_alias" code is not really needed. I think similar
functionality could be achieved by making the new internalvars be
computed.
thanks,
Tom