From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17976 invoked by alias); 14 Jul 2018 01:24:30 -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 17853 invoked by uid 89); 14 Jul 2018 01:24:17 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1623 X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 14 Jul 2018 01:24:16 +0000 Received: from [10.0.0.11] (unknown [192.222.164.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 643361E48F; Fri, 13 Jul 2018 21:24:14 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=simark.ca; s=mail; t=1531531454; bh=CSX180j+KfYqPQUjzFvL0sCX+UXylz5oZw1wHtDHiJI=; h=Subject:To:References:From:Date:In-Reply-To:From; b=WAtyLvlGrpJObc0Exn3y2Mf6bxCqfpE8sAefs6/PsWGoiMdCGS30PjYwWolMCh24U ikc/cxS1LpOOtuTiN5fYwbsU5aQ49THWe9HhIJDAVXbaT5YH59bTBiPx6OPyTcx/oC XeSqxjTLoffmpXBJE0yHTjedO6koY5MbU5ELfg14= Subject: Re: [RFA 07/13] Remove unused declaration from py-prettyprint.c To: Tom Tromey , gdb-patches@sourceware.org References: <20180712205208.32646-1-tom@tromey.com> <20180712205208.32646-8-tom@tromey.com> From: Simon Marchi Message-ID: Date: Sat, 14 Jul 2018 01:24:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180712205208.32646-8-tom@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-07/txt/msg00441.txt.bz2 On 2018-07-12 04:52 PM, Tom Tromey wrote: > This removes an unused declaration from py-prettyprint.c, but leaves > the call to value_contents_for_printing, as it may throw.> > 2018-07-12 Tom Tromey > > * python/py-prettyprint.c (gdbpy_apply_val_pretty_printer): Call > value_contents_for_printing for effect. > --- > gdb/ChangeLog | 5 +++++ > gdb/python/py-prettyprint.c | 4 +++- > 2 files changed, 8 insertions(+), 1 deletion(-) > > diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c > index 21b1ce94879..bfcbc95178e 100644 > --- a/gdb/python/py-prettyprint.c > +++ b/gdb/python/py-prettyprint.c > @@ -662,7 +662,9 @@ gdbpy_apply_val_pretty_printer (const struct extension_language_defn *extlang, > struct gdbarch *gdbarch = get_type_arch (type); > struct value *value; > enum string_repr_result print_result; > - const gdb_byte *valaddr = value_contents_for_printing (val); > + > + /* Call for side effects. */ > + value_contents_for_printing (val); > > /* No pretty-printer support for unavailable values. */ > if (!value_bytes_available (val, embedded_offset, TYPE_LENGTH (type))) > Also LGTM. However, since both extension languages call value_contents_for_printing (from what I understand, to ensure the value has been fetched/is not lazy) and bail if some bytes are unavailable, perhaps apply_ext_lang_val_pretty_printer should do it instead. Also, doing if (value->lazy) value_fetch_lazy (value); would communicate better the intent than calling value_contents_for_printing for the same side-effect. Simon