[PATCH 00/16] Add styling to the gdb CLI and TUI

Matt Rice ratmice@gmail.com
Sun Mar 3 18:04:00 GMT 2019


On Sun, Mar 3, 2019 at 9:13 AM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: Matt Rice <ratmice@gmail.com>
> > Date: Sun, 3 Mar 2019 08:16:27 -0800
> > Cc: Tom Tromey <tom@tromey.com>,
> >       "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
> >
> > I didn't see a easy way to get the gdb version from python,
> > except parsing the output of "show version", perhaps I missed it.
> >
> > but I have added stuff conditional on the inferior binary name before..
> > py
> > def on_bin_echo(): gdb.execute("set arg -d")
> > exec_funcs = {"/bin/echo" : on_bin_echo}
> > map(lambda x: exec_funcs[x.filename]() if
> > exec_funcs.has_key(x.filename) else None, gdb.objfiles())
> > end
> >
> > You should be able to do the same by parsing the output of 'show version',
> > However, given that, I think it'd be better in this case to just try
> > and use the gdb.parameter API from python to set the setting,
> > and handling any exception which should be thrown for old gdb without
> > the appropriate parameter.
>
> Thanks.  I hoped for a way that would avoid using Python or Guile, but
> I guess you are saying there is no such way, is that right?
>
> Maybe we should add a convenience variable $_gdb_version ?

I'm not going to say there is no way, I just don't know of one which
is robust/portable/palatable.
If you can use the gdb shell command , and get the parent PID/path to
the gdb from there, then write out a gdb script
after that source the newly generated script

So, perhaps I'm missing some obvious/nice way, but i don't really know, sorry.



More information about the Gdb-patches mailing list