Is there some way to "template" commands for interpolation with gdb.Values?
Tom Tromey
tom@tromey.com
Mon Jan 27 14:08:00 GMT 2020
>>>>> "Matthew" == Matthew Malcomson <hardenedapple@gmail.com> writes:
Matthew> I'm currently looking at modifying my plugin to use gdb.Values instead
Matthew> of pointers.
Matthew> The hope is that gdb.Values could give the plugin a language-agnostic
Matthew> syntax and also make it's use of existing pretty_printer.children() methods
Matthew> more seamless.
...
Matthew> The best I've found is to set an internal variable to the gdb.Value I
Matthew> have and use that (so the user would write "$cur->x").
That's pretty much what I would have tried.
Matthew> I have a workaround where I set one variable to the address and another
Matthew> to the current object ( $addr, and $cur respectively ), but this loses some
Matthew> of the language-agnostic syntax I was keen on, since I still require the
Matthew> ability to access variables through their address in a gdb expression, and
Matthew> adds extra complexity to my plugin interface.
I didn't follow this part. Can you just use .address in your implementation?
Matthew> If not, would it be possible to add syntax to do something that would
Matthew> work in this way?
Definitely, it's just a question of deciding what would be most helpful
and then, of course, someone actually implementing it.
A different approach would be to parse the user's input. This is what
Duel did. However I suppose that is in some conflict with your goal of
being language-agnostic.
Tom
More information about the Gdb
mailing list