From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 67379 invoked by alias); 9 Sep 2017 19:20:46 -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 67370 invoked by uid 89); 9 Sep 2017 19:20:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=catastrophic, HCc:D*ca, D*ca, cake X-HELO: mail-lf0-f48.google.com Received: from mail-lf0-f48.google.com (HELO mail-lf0-f48.google.com) (209.85.215.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 09 Sep 2017 19:20:44 +0000 Received: by mail-lf0-f48.google.com with SMTP id l196so11254930lfl.1 for ; Sat, 09 Sep 2017 12:20:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=3P6FfKZb384WyW9lYwTKn6M6rrsJDjX0XQz0o+5gbxc=; b=MthRxgVhPpVcnzpr3LtTf281Sgo+jX/A20w3TKelrNx7qeZteYlHLudujGc8tQ+yMW ZBV9DxvBkcTnsPQn9ePcd9eDNQiZkBCHCM9ptKF/wrxz2dkPTpyh6ShaYwLhkZq0el/V EAWf2EFuzUB3L6TvfGEOW5mRc7pNvrhprFXX3j12hUHYUiw+BKDYY3pxKghnqkXy1TGK 52iZWiQj3VNfFseQySwBBccDEIBzGVKbweaCVwmlxKAeAm/HgxnCKhDs9+c/Nbp2P9VO OCyA/sL0dFVGmCvUUs7wrJ1qN+U4UaIOvPJjWNRx+VbMWUYC3zg8HBIUzp/mUW8ABF5M tHIA== X-Gm-Message-State: AHPjjUjxEx+szLaZp5FTP8zl6er9HtZYLw7kMjdfNMbz9PlHO5yiEf8C JoGY5Q6/P0t6bBYRvETayzTrr5yzrw== X-Google-Smtp-Source: AOwi7QBJvSLEr8LP/n4wfKZHMRkpY3sbi8ws5ymZFtbn9W1lOK7ZZtZNyk3a1KwTAld8028/erWeKoCDDCi/STvY9YI= X-Received: by 10.25.233.8 with SMTP id g8mr2571267lfh.197.1504984842291; Sat, 09 Sep 2017 12:20:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.235.197 with HTTP; Sat, 9 Sep 2017 12:20:41 -0700 (PDT) In-Reply-To: <87zia3afdt.fsf@bapiya> References: <20170909153540.15008-1-tom@tromey.com> <20170909153540.15008-2-tom@tromey.com> <02d471158b96dd13bd7f998f8ec2a310@polymtl.ca> <87zia3afdt.fsf@bapiya> From: Matt Rice Date: Sat, 09 Sep 2017 19:20:00 -0000 Message-ID: Subject: Re: [RFA 1/7] Use ui_out_emit_table and ui_out_emit_list in print_thread_info_1 To: Tom Tromey Cc: Simon Marchi , "gdb-patches@sourceware.org" Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2017-09/txt/msg00255.txt.bz2 On Sat, Sep 9, 2017 at 11:36 AM, Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi writes: > > Simon> I think overall this function is a bad example of how to share code > Simon> between CLI and MI. There are so many if (is_mi_like_p) that it's > Simon> essentially two functions in one. Apart from iterating on threads, > Simon> the MI and CLI outputs don't share much... > > I think a long term goal should be to remove all those is_mi_like_p > checks. In some situations this might mean introducing "MI 4" and > fixing up the historical baggage; but that would also be a good thing, > as there are a few places where gdb has remained buggy for the sake of > not breaking existing MI readers. > > What I'd really like is for MI to be defined as JSON (it is pretty close > already), but that's maybe a bit much to ask. At some point I had it encoding into python literals, with MI output being converted into something parsable by the python literal_eval function[1] JSON is really not very different, the only thing which kind of sucked about it was dealing with the places a range of values, or a slice is sent, these needed the range to then be marshalled and unmarshalled into tuples of numbers then back into ranges, this is more of an annoyance than anything catastrophic, but it means you have to evaluate the literals, then evaluate the objects returned by that first pass... using some little snippet of code specific to the data being sent. https://docs.python.org/2/library/ast.html#ast.literal_eval I don't know JSON well, but i don't see its format having a notion of slices either neither do I remember where specifically this came up in mi, but if both having and eating cake were on the table JSON + primitive syntax for range/slices would be nice. > A related thought is that if more spots used ui-out (I'm thinking mainly > *-valprint, but maybe there are others), then colorization could be done > at the ui-out layer. > > Tom