From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ZrEuOJfz0WOXtSEAWB0awg (envelope-from ) for ; Wed, 25 Jan 2023 22:29:27 -0500 Received: by simark.ca (Postfix, from userid 112) id D95F41E128; Wed, 25 Jan 2023 22:29:27 -0500 (EST) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=BqyRAHsY; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_DNSWL_HI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 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 277AA1E112 for ; Wed, 25 Jan 2023 22:29:27 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4B5843858414 for ; Thu, 26 Jan 2023 03:29:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4B5843858414 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1674703766; bh=BV1cp4jFCc8TqaElNoEdW8G+HDl+AvVuQHbvKvezgoQ=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=BqyRAHsYf5+kfr9GOSdPQr20ZEo+eg5+B0CxvRnhETGsbD5od30SYzACNQmUdpUTv eWQi34/sSaDUKcRlXTZ2g+kube5wvDR2K2YvxESKtSDCVmgCw6WC8iccZpr7KflL2R MQHCMbcPQp/dNwD2X905UH4zEgUQ9+x6rEyGdA38= Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 210A03858D28 for ; Thu, 26 Jan 2023 03:29:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 210A03858D28 Received: from [10.0.0.11] (unknown [217.28.27.60]) (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 78C291E112; Wed, 25 Jan 2023 22:29:07 -0500 (EST) Message-ID: <99e8075c-3f94-5b51-dc43-b74d2ad84cbd@simark.ca> Date: Wed, 25 Jan 2023 22:29:06 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH 6/9] gdb/testsuite/dap: pass around dicts instead of ton objects Content-Language: en-US To: Tom Tromey , Simon Marchi via Gdb-patches Cc: Simon Marchi References: <20230106185729.42372-1-simon.marchi@efficios.com> <20230106185729.42372-7-simon.marchi@efficios.com> <87a626tgnj.fsf@tromey.com> In-Reply-To: <87a626tgnj.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 1/25/23 17:04, Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi via Gdb-patches writes: > > Simon> Change-Id: I2ca47bea355bf459090bae8680c6a917350b5c3f > > Probably could use a commit message. Oops, that was a mistake. I always put at least a little something in the commit messages, except for the extremely obvious commits. > The main issue with this is that dicts lose type information from the > JSON. So, if we ever need to check the type of some value sent by gdb, > we won't be able to. Ah, interesting. > But I suppose we could always just add some new proc that returns the > TON form and go from there. I don't recall if I've needed any such > tests yet. Arguably maybe we should write one. The idea of my change was that we currently did `namespace eval ton::2dict` pretty much everywhere. So I thought it would be nice to make it easier on callers and to the ton::2dict for them, that makes the tests less verbose. I think we can indeed add intermediary functions that return ton objects as needed. For instance, have dap_request_and_response_ton can do most of the work, and have dap_request_and_response be a small wrapper around it to do the ton::2dict. Based on this, my commit message would be: The DAP helper functions generally return TON objects. However, callers almost all immediately use ton::2dict to convert them to dicts, to access their contents. This commits makes things a bit simpler for them by having function return dicts directly instead. The downside is that the TON objects contain type information. For instance, a "2" in a TCL dict could have been the integer 2 or the string "2" in JSON. By converting to TCL dicts, we lose that information. If some tests specifically want to check the types of some fields, I think we can add intermediary functions that return TON objects, without having to complicate other callers who don't care. Simon