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

Eli Zaretskii
2019-03-03T17:13:45Z

> 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 ?