From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 48720 invoked by alias); 3 Aug 2016 08:15:54 -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 48054 invoked by uid 89); 3 Aug 2016 08:15:53 -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_FROM,KAM_STOCKGEN,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 spammy=safer, face X-HELO: mail-oi0-f54.google.com Received: from mail-oi0-f54.google.com (HELO mail-oi0-f54.google.com) (209.85.218.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 03 Aug 2016 08:15:51 +0000 Received: by mail-oi0-f54.google.com with SMTP id l65so270478840oib.1 for ; Wed, 03 Aug 2016 01:15:51 -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-transfer-encoding; bh=pcd05lYFD8EAsVJmzxajQ6akHD9wBhSw3SdrrVOX+rM=; b=DerLXN0dQoHgDAKZPP2i8T+DkdA6ttDgtS/NGTMwjO0Bs3iz8BPEtxrr2k1/CdR/0M qPvtHUPY2HZ+lj16XR8bhkYswJaSifbpl4jhoquVeVcGOAdJorbcAmtmPGW7iE5m7QnS Yh4RxJOOdvgu7aC/xJlnV/4re/H4AwcUAP1lIi1/HJP68H592QjdxebzxOK56dHIG7gz cKhzUiOqOt39zqE+YSQRxiK2wqbpJix+fsBFVkMsn9nBJLzxV9bfL7VO45KnQE+m6TYg keGbJ9dwmOMfRMWOGr/QT5x3nnAZ9N5XVgv1p8YZxKIsVK/Cnm2gR+7hsZmlKNNYPqyW /e9A== X-Gm-Message-State: AEkoousXwgS6UxQUFcgIkUDCllSKegZWgfcsvM7+a1VAwKZ1iU5JsUygyjtbnFZRZALn/uATe6CbMiNNjIqvmg== X-Received: by 10.202.117.6 with SMTP id q6mr136318oic.195.1470212149480; Wed, 03 Aug 2016 01:15:49 -0700 (PDT) MIME-Version: 1.0 Received: by 10.202.172.75 with HTTP; Wed, 3 Aug 2016 01:15:48 -0700 (PDT) In-Reply-To: <5ab877f8-9e39-6e02-2ece-46fcbcdacc0a@redhat.com> References: <1466439050-11330-1-git-send-email-tom@tromey.com> <86ziqfq6sz.fsf@gmail.com> <8737o5kqtv.fsf@tromey.com> <87bn1lu5h9.fsf@tromey.com> <5ab877f8-9e39-6e02-2ece-46fcbcdacc0a@redhat.com> From: Yao Qi Date: Wed, 03 Aug 2016 08:15:00 -0000 Message-ID: Subject: Re: [RFA] PR python/18565 - make Frame.function work for inline frames To: Pedro Alves Cc: Tom Tromey , "gdb-patches@sourceware.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2016-08/txt/msg00048.txt.bz2 On Tue, Jul 26, 2016 at 12:14 PM, Pedro Alves wrote: > On 07/25/2016 04:01 PM, Tom Tromey wrote: > >> *funname =3D xstrdup (SYMBOL_PRINT_NAME (func)); >> [...] >> if (*funlang =3D=3D language_cplus) >> { >> /* It seems appropriate to use SYMBOL_PRINT_NAME() here, >> to display the demangled name that we already have >> stored in the symbol table, but we stored a version >> with DMGL_PARAMS turned on, and here we don't want to >> display parameters. So remove the parameters. */ >> char *func_only =3D cp_remove_params (*funname); >> >> I'm not 100% sure that cp_remove_params cannot throw. >> However, it's >> simple to deal with this by adding a cleanup in find_frame_funname. I'm >> happy to do this if desired. >> >> Another approach might be to have a free_current_contents cleanup at the >> start of find_frame_funname and discard it at the exit. This would >> maybe make it a bit safer in the face of future changes. > > Yet another approach would be to push the xstrdup call to after the > cp_remove_params call, and remove the xfree call, something like: > > if (*funlang =3D=3D language_cplus) > { > char *func_only =3D cp_remove_params (SYMBOL_PRINT_NAME (fu= nc)); > > if (func_only) > *funname =3D func_only; > else > *funname =3D xstrdup (SYMBOL_PRINT_NAME (func)); > } > else > *funname =3D xstrdup (SYMBOL_PRINT_NAME (func)); > } > > > In any case, IMO this would be the subject of a separate patch. This is the prerequisite of Tom's patch, no? It guarantees that *FUNNAME is not allocated if exception is thrown, otherwise *FUNAME is allocated. Tom's patch relies on this behaviour. I am OK with Tom's original patch, but we need to fix find_frame_funname first. --=20 Yao (=E9=BD=90=E5=B0=A7)