From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 115996 invoked by alias); 29 Aug 2015 21:29: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 115982 invoked by uid 89); 29 Aug 2015 21:29:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: mail-oi0-f51.google.com Received: from mail-oi0-f51.google.com (HELO mail-oi0-f51.google.com) (209.85.218.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sat, 29 Aug 2015 21:29:39 +0000 Received: by oigm66 with SMTP id m66so41683496oig.0 for ; Sat, 29 Aug 2015 14:29:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=ojVp+srOJ5mXhpvwnAPKgx1i2ozKigjCeH8yOo+Hu5E=; b=Dc9jyp5xRdLcCwFtPFTsE3laIVMS0NySvS7fbnsksmwaa1bQAuIyrcZmaYcvL+iFMd +/49GkWAzs9OX+oQst5GU/auMn/weM1egl9CqZ4gShYltreG31Xkf2VZn6IB/rHNaHUe TUiFVtw3TarrceyIzHpiLfGMXt2hFkWTsLLfKW4AAZQ4tNZZKfh31Co94SWyIx38iSkr 5MSQ4Uc0AgI3y+sZoJnoskqf8s4RPMebUMy4iq6mYKl6mab1q0ODiicPdbcErli5WKpL Pc63ZFnxJf3T3oTQLyvLjRCNE+K6YYkmHENlg7iXVuKHe0H3d/CWZYr4NtnllSvUKCq+ 79tw== X-Gm-Message-State: ALoCoQn+MUJWUtJ+NH9Hp3D+WW1OotYxkb+YgzHCRfiOAeG/16hQsDA1/W6xLz7EHc7xKUU3yv7j X-Received: by 10.202.196.82 with SMTP id u79mr9249761oif.78.1440883777819; Sat, 29 Aug 2015 14:29:37 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.115.105 with HTTP; Sat, 29 Aug 2015 14:29:18 -0700 (PDT) In-Reply-To: References: <1435631281-31970-1-git-send-email-patrick@parcs.ath.cx> <1435631281-31970-2-git-send-email-patrick@parcs.ath.cx> From: Patrick Palka Date: Sat, 29 Aug 2015 21:29:00 -0000 Message-ID: Subject: Re: [PATCH 2/2] Use gdbarch obstack to allocate the TYPE_NAME string in arch_type To: Doug Evans Cc: "gdb-patches@sourceware.org" Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2015-08/txt/msg00843.txt.bz2 On Sat, Aug 29, 2015 at 2:19 PM, Doug Evans wrote: > 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]. Oops :/ I will fix this. > > 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]. And I will do this as well. Thanks for checking out these two patches.