From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id s5LbHlwg8GGReAAAWB0awg (envelope-from ) for ; Tue, 25 Jan 2022 11:07:56 -0500 Received: by simark.ca (Postfix, from userid 112) id 6DFCB1F3B6; Tue, 25 Jan 2022 11:07:56 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.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 E5A0A1EE18 for ; Tue, 25 Jan 2022 11:07:55 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 41A9C385AC1C for ; Tue, 25 Jan 2022 16:07:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 41A9C385AC1C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1643126875; bh=Tjrt3P8DOcLM9G++REGNoRhl4lKhbsPRJkwy6LckFFo=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=qnqb1wF8nX+srTXanGxK+bSz2zldR4kXQlslq3UqH56zbex1sHaUHu6FmSjFqkmCY b2SB2PqQRAKBLdDcXQZaN2aC9TNqI2wq0/9bCrDyxJyZPMRUBqjQ1mURd5Zhsk1HJH ShgFw/FLgEYWny3/Z9sr2BhvLz9TF65g1tSpSdJM= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 0CA193858D39 for ; Tue, 25 Jan 2022 16:07:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0CA193858D39 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-583-mb_TmOUJOAGWHA-mEaQ05Q-1; Tue, 25 Jan 2022 11:07:33 -0500 X-MC-Unique: mb_TmOUJOAGWHA-mEaQ05Q-1 Received: by mail-wm1-f70.google.com with SMTP id w5-20020a1cf605000000b0034b8cb1f55eso1405796wmc.0 for ; Tue, 25 Jan 2022 08:07:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Tjrt3P8DOcLM9G++REGNoRhl4lKhbsPRJkwy6LckFFo=; b=unCTqY6DK9U3fvjrjfvwzgH4LoSoxHGbVWiltGIueoUxoGt7NJhwuf5JBMgumcwnk3 rctgI7RcBu5UJKuDZhxyrJj0FJJNPAiQpZyaGugxDA9XbDPGCBhgLLdHxgiSW7nhfamb hOHJhZU/GfC2RohET2wNIU9X2Sg1ZE0lvwIVtkUuRGtcazGd6A5WjhiWzuwGJx6o77VK oLdOJu0kkkUs/SuXrf1ozgPUV+kxrNS/WyFptnkiqfDshIqVxOUmWsv61/CxyB8CJavp SoKf3/qDpeLVrp6PVScAOc9gfx61nj8GFfRylvjcGltnLhq81w0LDQSl5arMv86gC0Fx tA9A== X-Gm-Message-State: AOAM533Vhe1m9J0buoJvcZ0d2FTTgnj8S2ly1UvOyYrAF4RMPsiV+IDF 2864eH+NLM7ZVmrvI5ioDVWP8etKOpUZ6gubkwWln/vrKlPZT39A/eGjYYNh4mbDQHaUugtSqVp pOoqpJazSnBxu/pQLx+azZQ== X-Received: by 2002:a5d:5712:: with SMTP id a18mr18888085wrv.30.1643126851867; Tue, 25 Jan 2022 08:07:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJyFeEgWKq4PwTtWxpG+YD7oupFxiyajPDFWDr3bMx9AIBizhFSIf6vOSZjqDFwKli8pt4DevQ== X-Received: by 2002:a5d:5712:: with SMTP id a18mr18888069wrv.30.1643126851685; Tue, 25 Jan 2022 08:07:31 -0800 (PST) Received: from localhost (host86-140-92-93.range86-140.btcentralplus.com. [86.140.92.93]) by smtp.gmail.com with ESMTPSA id o15sm923724wms.9.2022.01.25.08.07.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jan 2022 08:07:31 -0800 (PST) Date: Tue, 25 Jan 2022 16:07:30 +0000 To: Simon Marchi Subject: Re: [PATCH] gdb/python: allow Value.format_string to return styled output Message-ID: <20220125160730.GA425591@redhat.com> References: <20220125105005.333575-1-aburgess@redhat.com> MIME-Version: 1.0 In-Reply-To: X-Operating-System: Linux/5.8.18-100.fc31.x86_64 (x86_64) X-Uptime: 16:04:10 up 1 day, 6:51, X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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: Andrew Burgess via Gdb-patches Reply-To: Andrew Burgess Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" * Simon Marchi via Gdb-patches [2022-01-25 07:56:52 -0500]: > LGTM, just two small comments: > > > @@ -725,6 +728,7 @@ valpy_format_string (PyObject *self, PyObject *args, PyObject *kw) > > return NULL; > > if (!copy_py_bool_obj (&opts.static_field_print, static_members_obj)) > > return NULL; > > + bool styling_p = (styling_obj != nullptr) && PyObject_IsTrue (styling_obj); > > Can styling_obj actually be nullptr? Sure, the new 'styling' argument is optional, after the "|" in the gdb_PyArg_ParseTupleAndKeywords call, so if 'styling' isn't given styling_obj will be left as it's default value, which is nullptr. I guess I could initialise styling_obj to Py_False, maybe that would be nicer? > > > @@ -1023,9 +1030,16 @@ with_test_prefix "format_string" { > > # Perform C Tests. > > if { [build_inferior "${binfile}" "c"] == 0 } { > > with_test_prefix "lang_c" { > > - set current_lang "c" > > - prepare_gdb "${binfile}" > > - test_all_common > > + save_vars { env(TERM) } { > > + # We run all of these tests in an environment where styling > > + # could work, but we only expect the final call to > > + # test_styling to actuall produce any styled output. > > actuall -> actually Thanks, will fix. Andrew