From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 115873 invoked by alias); 3 Mar 2019 16:16:44 -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 114946 invoked by uid 89); 3 Mar 2019 16:16:43 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-ed1-f52.google.com Received: from mail-ed1-f52.google.com (HELO mail-ed1-f52.google.com) (209.85.208.52) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 03 Mar 2019 16:16:42 +0000 Received: by mail-ed1-f52.google.com with SMTP id f2so2225408edy.13 for ; Sun, 03 Mar 2019 08:16:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hfrK+gcwqGvHzP0ntvJz1h2TLEz9aPMF/Hx5+kkD7Ys=; b=gRjM/Ez0uTj8+3cgf1U8VSNCHx+Dhxzatges3MJYs812CsDTf1z1yAaifBxmqyngGZ 7TIgkHklyCphWeVQtkguXdDO3MkcGpyXCKuVCZk+EE9SwbaNtnRcsXlY7OrTLy+/Gjyh s9VKj6SVK03tfnaKpS+q9+VEs1dqWmjAAmdVCYrtR5ZqdOXq2MSi0WggGIlxKBxUISuo 1D1f2Sjc5fjYMEvwXtZVyFMzZ3Pa65apEYoDoQ1LaYYVRSt7nNlIqU/3sll6QjCxWDlg Dp2sAfFayzxWe4HO+YfTOHXvdlC29aMPRiM9daVI8nE9u/XEKtrIOMFo7tIS/x/WprcB rqXg== MIME-Version: 1.0 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> In-Reply-To: <83d0n8eyzw.fsf@gnu.org> From: Matt Rice Date: Sun, 03 Mar 2019 16:16:00 -0000 Message-ID: Subject: Re: [PATCH 00/16] Add styling to the gdb CLI and TUI To: Eli Zaretskii Cc: Tom Tromey , "gdb-patches@sourceware.org" Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2019-03/txt/msg00023.txt.bz2 On Sun, Mar 3, 2019 at 7:53 AM Eli Zaretskii wrote: > > A few minor comments and questions related to this feature: > > And one more issue, only tangentially related: if I put on my > ~/.gdbinit settings that customize style, older versions of GDB > complain when they start up, because they don't know about styles. Is > there any way of conditioning scripting commands on the GDB version, > or some other way of avoiding such problems? 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. If the gdb in question python or guile, I really have no idea, but i hope that helps.