From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ODZxJdo6AGIbFgAAWB0awg (envelope-from ) for ; Sun, 06 Feb 2022 16:17:14 -0500 Received: by simark.ca (Postfix, from userid 112) id 86CC71F3C6; Sun, 6 Feb 2022 16:17:14 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 1798A1ECEB for ; Sun, 6 Feb 2022 16:17:14 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5E1963858418 for ; Sun, 6 Feb 2022 21:17:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5E1963858418 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1644182233; bh=LReIXnCPThyhxZas6luSPunDxfihhrNYIeUuDeqrCAI=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=xifwYGGb8uZgpMiBqJi8WU+1VECVn1meQHlW7W2P7YLsDNbqd0KF3e2tkq5mKTHUo 5yL3HXDseq+miaWHhJviBI4L3w3S+mVfEyACLbXlBErfKILQxxolXgLtUP/8lX/cKE A99LpBQH+mjOGMnSFqI6O91bI5SSga7j11qR08yc= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 2BCEB3858D3C for ; Sun, 6 Feb 2022 21:16:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2BCEB3858D3C Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 216LGloP005143 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 6 Feb 2022 16:16:52 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 216LGloP005143 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 2FAAE1ECEB; Sun, 6 Feb 2022 16:16:47 -0500 (EST) Message-ID: Date: Sun, 6 Feb 2022 16:16:46 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Subject: Re: [PATCH 0/5] create GDB/MI commands using python Content-Language: en-US To: Andrew Burgess , Jan Vrany References: <20220117124425.2658516-1-jan.vrany@labware.com> <20220118135541.GG622389@redhat.com> <20220121152208.GK622389@redhat.com> In-Reply-To: <20220121152208.GK622389@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Sun, 6 Feb 2022 21:16:47 +0000 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" > 3. The top level result name can be changed from 'result' to anything > the user wants, here's an example session: > > (gdb) python > >class MyCommand(gdb.MICommand): > > def __init__(self): > > super(MyCommand, self).__init__("-my-command", "greeting") > > def invoke(self, args): > > return "Hello World" > > > >end > (gdb) python cmd = MyCommand() > (gdb) interpreter-exec mi "-my-command" > ^done,greeting="Hello World" > (gdb) I find this a bit surprising, why is "greeting" passed to the constructor? Since an MI result, at the root, is basically a dict, my intuition would be to only allow the invoke method to return a dict. def invoke(self, args): return {'a': 1, 'b': "hello"} which would result int: ^done,a="1",b="hello" Returning None (which is returned if there's no explicit "return") would also be allowed, in which case there is not result: ^done Simon