From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 From: Andrew Burgess To: Simon Marchi Cc: gdb-patches@sourceware.org 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-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org 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: , X-List-Received-Date: Tue, 25 Jan 2022 16:07:37 -0000 * 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