From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 67858 invoked by alias); 3 Mar 2015 12:25:28 -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 67848 invoked by uid 89); 3 Mar 2015 12:25:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL,BAYES_00,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 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; Tue, 03 Mar 2015 12:25:26 +0000 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 03 Mar 2015 04:25:23 -0800 X-ExtLoop1: 1 Received: from irsmsx103.ger.corp.intel.com ([163.33.3.157]) by FMSMGA003.fm.intel.com with ESMTP; 03 Mar 2015 04:19:11 -0800 Received: from irsmsx104.ger.corp.intel.com ([169.254.5.145]) by IRSMSX103.ger.corp.intel.com ([169.254.3.247]) with mapi id 14.03.0195.001; Tue, 3 Mar 2015 12:25:20 +0000 From: "Metzger, Markus T" To: Pedro Alves CC: "gdb-patches@sourceware.org" Subject: RE: [PATCH] btrace: avoid tp != NULL assertion Date: Tue, 03 Mar 2015 12:25:00 -0000 Message-ID: References: <1423473902-2286-1-git-send-email-markus.t.metzger@intel.com> <54F4DF9D.3060400@redhat.com> <54F5A12F.9000702@redhat.com> In-Reply-To: <54F5A12F.9000702@redhat.com> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2015-03/txt/msg00072.txt.bz2 > -----Original Message----- > From: Pedro Alves [mailto:palves@redhat.com] > Sent: Tuesday, March 3, 2015 12:55 PM > To: Metzger, Markus T > Cc: gdb-patches@sourceware.org > Subject: Re: [PATCH] btrace: avoid tp !=3D NULL assertion > Frame #7 where we convert the ptid to something inf-ptrace.c understands. >=20 > The fix is just to stop losing information. This also improves > performance a tiny bit, as currently we fetch registers out of ptrace > twice, once for {pid,lwp} in linux-nat.c, and another for {pid,0} in > inf-ptrace/i386-linux-nat.c. We'll now use a single regcache object > everywhere. >=20 > Please try the patch below. It works. Thanks. I'll drop my patch, then. > Note that this in your patch: >=20 > + lwp =3D ptid_get_lwp (ptid); > + if (lwp =3D=3D 0) > + { > + int pid; > + > + /* Not a threaded program. Use the PID as LWP ID. */ > + pid =3D ptid_get_pid (ptid); > + ptid =3D ptid_build (pid, pid, 0); > + } > + > + return find_thread_ptid (ptid); > +} > + >=20 > is wrong because when debugging a multi-threaded program, you'll > have e.g. ({pid,lwp}) {1,1}, {1,2}, {1,3}, etc. Your patch makes > btrace look for {2,2}, {3,3}, etc. in the thread list, which just > aren't there, and thus return NULL. I assume that that's why you > needed to downgrade the asserts to errors. No, that wasn't the reason for replacing the assert. There are no such errors in the gdb.btrace suite (which is mostly single-threaded) with my patch and I have not seen any such errors otherwise, either. I just found it safer and more user-friendly in case we run into further problems in this area. I see what you mean, though... > - /* Convert to something the lower layer understands. */ > - ptid =3D pid_to_ptid (ptid_get_lwp (lp->ptid)); > - linux_ops->to_resume (linux_ops, ptid, step, signo); Regards, Markus. Intel GmbH Dornacher Strasse 1 85622 Feldkirchen/Muenchen, Deutschland Sitz der Gesellschaft: Feldkirchen bei Muenchen Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk Registergericht: Muenchen HRB 47456 Ust.-IdNr./VAT Registration No.: DE129385895 Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052