From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 94342 invoked by alias); 25 Apr 2019 18:38:42 -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 94297 invoked by uid 89); 25 Apr 2019 18:38:42 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy= X-HELO: mail-wr1-f67.google.com Received: from mail-wr1-f67.google.com (HELO mail-wr1-f67.google.com) (209.85.221.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 25 Apr 2019 18:38:41 +0000 Received: by mail-wr1-f67.google.com with SMTP id c12so749772wrt.8 for ; Thu, 25 Apr 2019 11:38:40 -0700 (PDT) Return-Path: Received: from ?IPv6:2001:8a0:f913:f700:4c97:6d52:2cea:997b? ([2001:8a0:f913:f700:4c97:6d52:2cea:997b]) by smtp.gmail.com with ESMTPSA id 17sm18423207wrk.91.2019.04.25.11.38.38 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Thu, 25 Apr 2019 11:38:38 -0700 (PDT) Subject: Re: [PATCH 5/5] Fix memory leak in exception code To: Tom Tromey References: <20190425165256.31226-1-tromey@adacore.com> <20190425165256.31226-6-tromey@adacore.com> <30e99361-c252-53e2-ec7c-5a6bc7301a3f@redhat.com> <87ef5qaqyn.fsf@tromey.com> <874l6m9btt.fsf@tromey.com> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: <1ee639e5-d431-4e79-63f4-0bf167790168@redhat.com> Date: Thu, 25 Apr 2019 18:38:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <874l6m9btt.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-04/txt/msg00550.txt.bz2 On 4/25/19 7:30 PM, Tom Tromey wrote: > Pedro> Why fix it like this, instead of fixing it like in the guile patch? > Pedro> I'd think you could even use a common POD type for both guile and here? > > Tom> No particularly good reason. I'll change it. > > Actually, there was a reason. Converting an exception to a POD means > copying the string contents. > > Perhaps that isn't a big concern. I guess only exceptions escaping to > the top level will do this. Yeah, I don't think it's a concern here. It seemed better than adding a global, thinking about threads, but now that I think a bit more about it, I realize that we won't ever be able to have multiple threads call into readline simultaneously -- it's full of global state. So I'm fine with your patch as is, afterall. I think it'd be good to extend the comment, something like: - /* This is static to avoid undefined behavior when calling - longjmp. */ + /* This is static to avoid undefined behavior when calling + longjmp -- gdb_exception has a dtor with side effects. */ Thanks, Pedro Alves