From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 78797 invoked by alias); 3 Mar 2019 17:13:45 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 78788 invoked by uid 89); 3 Mar 2019 17:13:44 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1145 X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (209.51.188.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 03 Mar 2019 17:13:42 +0000 Received: from fencepost.gnu.org ([2001:470:142:3::e]:33029) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h0UgG-0003sd-PL; Sun, 03 Mar 2019 12:13:40 -0500 Received: from [176.228.60.248] (port=3739 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1h0UgG-0004QD-D8; Sun, 03 Mar 2019 12:13:40 -0500 Date: Sun, 03 Mar 2019 17:13:00 -0000 Message-Id: <837edfg9tu.fsf@gnu.org> From: Eli Zaretskii To: Matt Rice CC: tom@tromey.com, gdb-patches@sourceware.org In-reply-to: (message from Matt Rice on Sun, 3 Mar 2019 08:16:27 -0800) Subject: Re: [PATCH 00/16] Add styling to the gdb CLI and TUI References: <20181128001435.12703-1-tom@tromey.com> <83k1kxfzwo.fsf@gnu.org> <8736rja4i8.fsf@tromey.com> <83r2brhw8k.fsf@gnu.org> <87h8cmh1wg.fsf@tromey.com> <83va12gz8j.fsf@gnu.org> <87mumeb935.fsf@tromey.com> <83d0n8eyzw.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-IsSubscribed: yes X-SW-Source: 2019-03/txt/msg00024.txt.bz2 > From: Matt Rice > Date: Sun, 3 Mar 2019 08:16:27 -0800 > Cc: Tom Tromey , > "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 ?