Re: How to create new mi commands via python / get current interpreter in python

Jan Vrany
2021-11-03T12:42:50Z

On Tue, 2021-11-02 at 20:11 +0100, Simon Sobisch via Gdb wrote:
> That's exactly I was looking for, so sad that this isn't available in
> GDB 11 :-(

I know...

> In any case that looks quite promising, would be nice to see it at
> least
> in a feature-branch in the official gdb repo until it is ready to be
> merged.

Good idea, I can do that. I'll post here when done.

>
> For the "hack without a patched GDB version": do you know of a good
> way
> to create the mi-expected message with different parameters in plain
> python and/or a way to know which interpreter is active in the
> current
> context of a gdb.Command?
>

I'm not sure I 100% understand what you want to achieve, but I'm afraid
one cannot tell which interprerer was active (as of now).
But, if inside python you do "intepreter-exec mi <some custom py
command>" you may pass down to the command option - say - `--mi` no?

HTH

> Simon
>
> Am 02.11.2021 um 17:56 schrieb Jan Vrany:
> > Hi,
> >
> > On Tue, 2021-11-02 at 17:40 +0100, Simon Sobisch via Gdb wrote:
> > > Additional to this question: is there an option to create new MI
> > > commands from python (instead of "console commands")
> >
> > Sort of. This has been started by Didier Nadeau and then continued
> > by
> > me but sadly, I got carried away and have not done the last bits so
> > it
> > can be pushed.
> >
> > However, I'm using this feature heavily and keep more-or-less
> > up-to-date GDB with this support (and some other hacks/fixes
> > waiting
> > to be polished and submitted, see
> >
> > https://github.com/janvrany/binutils-gdb/tree/users/jv%2Fvdb
> >
> > Here you may find example how I use it:
> >
> >
> > https://swing.fit.cvut.cz/hg/jv-vdb/file/tip/python/vdb/__init__.py#l329
> >
> > Let me know if you have any questions, let me know.
> >
> > I'd like to take the opportunity and apologise to all reviewers
> > for not finishing it yet - hopefuly I'll find long-enough period of
> > quiter time to finish this.
> >
> > Jan
> >
> >