From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20403 invoked by alias); 3 Mar 2019 18:04:59 -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 20393 invoked by uid 89); 3 Mar 2019 18:04:58 -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-f65.google.com Received: from mail-ed1-f65.google.com (HELO mail-ed1-f65.google.com) (209.85.208.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 03 Mar 2019 18:04:57 +0000 Received: by mail-ed1-f65.google.com with SMTP id m12so2388734edv.4 for ; Sun, 03 Mar 2019 10:04:57 -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=ixbvlfc5fjzO5Ar1XXwAzurJXFw61WFBQwKQ1Ir/dRA=; b=dTGfBU93lif2K31WAa7es7ipCLYR+AjDxr3rRYbZ3Yw/nQ6te3qNNiiCkY0oiXQ82h V65xvepkmztpKkFDpurVziNLObetJw6Gkns8Lj2bnkTpL6WHaQZjsuaYFOJbFlSbSBL1 VtVxuXYfAImJERI/9uzNCL1AaciyVA4LtxI1eEPeOP669h417TH83wGpkfGu6JHwj2gx C0zzO6xp6L1FAcx/KRUBzMrI3xJnH7ziLlQAVHxbuW8pKLrcNCux+MoDYASFzvBmIlSL j3rlO7U3HcaeXlsYTW+C2ga5N7ckSboGx+qo1vaf1qU7Kr9/mbXxscur2AhEfK8DiaC7 xAoA== 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> <837edfg9tu.fsf@gnu.org> In-Reply-To: <837edfg9tu.fsf@gnu.org> From: Matt Rice Date: Sun, 03 Mar 2019 18:04: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/msg00025.txt.bz2 On Sun, Mar 3, 2019 at 9:13 AM Eli Zaretskii wrote: > > > 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 ? 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.