From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 84796 invoked by alias); 9 Feb 2016 22:01:48 -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 84769 invoked by uid 89); 9 Feb 2016 22:01:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 09 Feb 2016 22:01:46 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 4A119C0C236B; Tue, 9 Feb 2016 22:01:44 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u19M1hgs030860; Tue, 9 Feb 2016 17:01:43 -0500 Message-ID: <56BA61C6.8060807@redhat.com> Date: Tue, 09 Feb 2016 22:01:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: "Metzger, Markus T" CC: "gdb-patches@sourceware.org" Subject: Re: [PATCH v2 3/3] btrace, frame: fix crash in get_frame_type References: <1454681922-2228-1-git-send-email-markus.t.metzger@intel.com> <1454681922-2228-3-git-send-email-markus.t.metzger@intel.com> <56B9D620.2020104@redhat.com> In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-02/txt/msg00247.txt.bz2 On 02/09/2016 02:42 PM, Metzger, Markus T wrote: >>> CORE_ADDR frame_unwind_pc (struct frame_info *this_frame) { >>> + if (this_frame == NULL) >>> + throw_error (NOT_AVAILABLE_ERROR, _("PC not available")); >> >> How can this happen? > > One of its callers, frame_unwind_caller_pc, calls it with the result of > skip_artificial_frames like this: > > CORE_ADDR > frame_unwind_caller_pc (struct frame_info *this_frame) > { > return frame_unwind_pc (skip_artificial_frames (this_frame)); > } > > Rather than handling the skip_artificial_frames() NULL return here, > I made frame_unwind_pc handle a NULL frame argument. > > I can move the check into frame_unwind_caller_pc if you prefer. Yes, please. Though, I think all these frame_unwind_caller_XXX methods should be consistent in how they handle skip_artificial_frames (this_frame) returning NULL, because they're all called together, assuming they're referring to the same frame. If we throw error here, then I think we should throw in frame_unwind_caller_arch too, instead of having that one return the arch of the next frame. Thanks, Pedro Alves