From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 59779 invoked by alias); 29 Aug 2015 18:20:41 -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 59695 invoked by uid 89); 29 Aug 2015 18:20:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f44.google.com Received: from mail-pa0-f44.google.com (HELO mail-pa0-f44.google.com) (209.85.220.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sat, 29 Aug 2015 18:20:39 +0000 Received: by pacgr6 with SMTP id gr6so8694545pac.0 for ; Sat, 29 Aug 2015 11:20:37 -0700 (PDT) X-Received: by 10.66.139.133 with SMTP id qy5mr24958660pab.44.1440872437856; Sat, 29 Aug 2015 11:20:37 -0700 (PDT) Received: from seba.sebabeach.org.gmail.com (173-13-178-53-sfba.hfc.comcastbusiness.net. [173.13.178.53]) by smtp.gmail.com with ESMTPSA id q5sm9315287pdc.65.2015.08.29.11.20.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 29 Aug 2015 11:20:37 -0700 (PDT) From: Doug Evans To: Patrick Palka Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 2/2] Use gdbarch obstack to allocate the TYPE_NAME string in arch_type References: <1435631281-31970-1-git-send-email-patrick@parcs.ath.cx> <1435631281-31970-2-git-send-email-patrick@parcs.ath.cx> Date: Sat, 29 Aug 2015 18:20:00 -0000 In-Reply-To: <1435631281-31970-2-git-send-email-patrick@parcs.ath.cx> (Patrick Palka's message of "Mon, 29 Jun 2015 22:28:01 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2015-08/txt/msg00835.txt.bz2 Patrick Palka writes: > Since the type whose name is being set is now being allocated on the > gdbarch obstack, we should allocate its TYPE_NAME on the obstack too. > This reduces the number of individual valgrind warnings for the command > "gdb gdb" from ~300 to ~150. > > Tested on x86_64-unknown-linux-gnu. > > [ I have a few more patches on top of these that together bring the total > number of valgrind warnings for the command "gdb gdb" down to ~30 > but they are more controversial than these two, and if these aren't OK > then the rest definitely aren't OK. ] > > gdb/ChangeLog: > > * gdbarch.h (gdbarch_obstack_strdup): Declare. > * gdbarch.c (gdbarch_obstack_strdup): Define. > * gdbtypes.c (arch_type): Use it. Hi. A couple of comments. 1) gdbarch.[ch] are machine generated. IIUC, you have to edit gdbarch.sh and then run it to regenerate gdbarch.[ch]. 2) I would have done this slightly differently. If the obstack API doesn't provide a strdup functionality, I wouldn't insist on trying to add it there. But I would like to see it added to gdb in an application-independent way. (make it non-gdbarch specific). obstack_strdup sounds sufficiently useful and generic enough. If one wants to add a gdbarch_obstack_strdup wrapper on top of that, fine by me. IOW, add obstack_strdup to gdb_obstack.[ch].