From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 40989 invoked by alias); 10 Feb 2016 07:40:23 -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 40967 invoked by uid 89); 10 Feb 2016 07:40:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=commercial, Tel, office, tel X-HELO: mga01.intel.com Received: from mga01.intel.com (HELO mga01.intel.com) (192.55.52.88) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 10 Feb 2016 07:40:21 +0000 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP; 09 Feb 2016 23:40:20 -0800 X-ExtLoop1: 1 Received: from irsmsx108.ger.corp.intel.com ([163.33.3.3]) by orsmga001.jf.intel.com with ESMTP; 09 Feb 2016 23:40:19 -0800 Received: from irsmsx104.ger.corp.intel.com ([169.254.5.210]) by IRSMSX108.ger.corp.intel.com ([169.254.11.102]) with mapi id 14.03.0248.002; Wed, 10 Feb 2016 07:40:18 +0000 From: "Metzger, Markus T" To: Pedro Alves CC: "gdb-patches@sourceware.org" Subject: RE: [PATCH v2 3/3] btrace, frame: fix crash in get_frame_type Date: Wed, 10 Feb 2016 07:40:00 -0000 Message-ID: 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> <56BA61C6.8060807@redhat.com> In-Reply-To: <56BA61C6.8060807@redhat.com> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2016-02/txt/msg00268.txt.bz2 > -----Original Message----- > From: Pedro Alves [mailto:palves@redhat.com] > Sent: Tuesday, February 9, 2016 11:02 PM > To: Metzger, Markus T > Cc: gdb-patches@sourceware.org > Subject: Re: [PATCH v2 3/3] btrace, frame: fix crash in get_frame_type >=20 > On 02/09/2016 02:42 PM, Metzger, Markus T wrote: >=20 > >>> CORE_ADDR frame_unwind_pc (struct frame_info *this_frame) { > >>> + if (this_frame =3D=3D 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. >=20 > Yes, please. >=20 > Though, I think all these frame_unwind_caller_XXX methods should be > consistent in how they handle skip_artificial_frames (this_frame) returni= ng > 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. get_frame_arch and frame_unwind_arch don't seem to throw any error today. I'd rather not introduce new exceptions if not strictly necessary. Its cal= lers may not be prepared to handle them. In the absence of an arch unwinder, frame_unwind_arch uses the gdbarch of the next frame. And DWARF tailcall frames use the gdbarch of the bottom non-tailcall frame. This is consistent with the proposed changes. We may want to return frame_unwind_arch (next_frame) instead of get_frame_arch (next_frame). OTOH gdb/dwarf2-frame-tailcall.c's tailcall_frame_prev_arch returns get_frame_arch (cache->next_bottom_frame). I'm currently mimicking that behavior. Regards, Markus. Intel Deutschland GmbH Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Christian Lamprechter Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928