From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11630 invoked by alias); 28 Sep 2012 06:51:45 -0000 Received: (qmail 11621 invoked by uid 22791); 28 Sep 2012 06:51:44 -0000 X-SWARE-Spam-Status: No, hits=-7.9 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mga14.intel.com (HELO mga14.intel.com) (143.182.124.37) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 28 Sep 2012 06:51:40 +0000 Received: from azsmga002.ch.intel.com ([10.2.17.35]) by azsmga102.ch.intel.com with ESMTP; 27 Sep 2012 23:51:40 -0700 X-ExtLoop1: 1 Received: from irsmsx101.ger.corp.intel.com ([163.33.3.153]) by AZSMGA002.ch.intel.com with ESMTP; 27 Sep 2012 23:51:38 -0700 Received: from irsmsx102.ger.corp.intel.com ([169.254.2.34]) by IRSMSX101.ger.corp.intel.com ([169.254.1.35]) with mapi id 14.01.0355.002; Fri, 28 Sep 2012 07:51:25 +0100 From: "Metzger, Markus T" To: Mark Kettenis CC: "gdb-patches@sourceware.org" , "markus.t.metzger@gmail.com" , "jan.kratochvil@redhat.com" , "palves@redhat.com" , "tromey@redhat.com" Subject: RE: [patch v3 16/16] btrace, x86: restrict to Atom Date: Fri, 28 Sep 2012 06:51:00 -0000 Message-ID: References: <1344949171-9545-1-git-send-email-markus.t.metzger@intel.com> <1344949171-9545-17-git-send-email-markus.t.metzger@intel.com> <201208141327.q7EDR7TC017727@glazunov.sibelius.xs4all.nl> <201209280239.q8S2ddal001019@glazunov.sibelius.xs4all.nl> In-Reply-To: <201209280239.q8S2ddal001019@glazunov.sibelius.xs4all.nl> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes 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 X-SW-Source: 2012-09/txt/msg00666.txt.bz2 > -----Original Message----- > From: Mark Kettenis [mailto:mark.kettenis@xs4all.nl] > Sent: Friday, September 28, 2012 4:40 AM > To: Metzger, Markus T > Cc: mark.kettenis@xs4all.nl; gdb-patches@sourceware.org; markus.t.metzger= @gmail.com; jan.kratochvil@redhat.com; > palves@redhat.com; tromey@redhat.com > Subject: Re: [patch v3 16/16] btrace, x86: restrict to Atom >=20 > > From: "Metzger, Markus T" > > Date: Mon, 24 Sep 2012 12:22:42 +0000 > > > > Ping. >=20 > Native code can only go into -nat.c files. Thanks. I sent out an updated patch. > But I still think putting CPU model specific checks anywhere in GDB is > wrong. If there are broken kernels out there, figure out a way to > detect them. The cpuid check is simple and reliable. Anything else will be more complica= ted and also less straight-forward to understand. Regards, Markus. >=20 > > > -----Original Message----- > > > From: Metzger, Markus T > > > Sent: Tuesday, August 14, 2012 3:42 PM > > > To: Mark Kettenis > > > Cc: gdb-patches@sourceware.org; markus.t.metzger@gmail.com; jan.krato= chvil@redhat.com; palves@redhat.com; > > > tromey@redhat.com > > > Subject: RE: [patch v3 16/16] btrace, x86: restrict to Atom > > > > > > > -----Original Message----- > > > > From: Mark Kettenis [mailto:mark.kettenis@xs4all.nl] > > > > Sent: Tuesday, August 14, 2012 3:27 PM > > > > > > Thanks for your feedback! > > > > > > > > > > > +int > > > > > +i386_linux_supports_btrace (void) > > > > > +{ > > > > > + unsigned int cpuid, model, family; > > > > > + > > > > > + if (!linux_supports_btrace ()) > > > > > + return 0; > > > > > + > > > > > + __asm__ __volatile__ ("movl $1, %%eax;" > > > > > + "cpuid;" > > > > > + : "=3Da" (cpuid) > > > > > + :: "%ebx", "%ecx", "%edx"); > > > > > + > > > > > > [...] > > > > > > > You can't have this function in a -tdep.c, since this file needs to= be > > > > compilable everywhere (not just on i386/amd64). But even in a -nat= .c > > > > file you shouldn't use inline assembly, since it isn't a standardiz= ed > > > > C feature. I can only guess why you want to restrict this feature = to > > > > Atom only, but I suspect that the proper solution is to query the > > > > target whether branch tracing is supported. That means the -nat.c > > > > code should have code to query for support in the Linux kernel. > > > > > > I agree that it would be better to have this check done in the kernel= . The problem is that such a patch will take very long before > > > it becomes available in distributions. And even then, we would need t= o handle kernels without the patch, so we would need > > > something > > > similar to this in gdb, as well. > > > > > > I took the cpuid bits from gdb/go32-nat.c. I have not seen any compil= ation guard around it. > > > > > > I thought that the i386-tdep files are meant to contain i386 specific= code, that's why I put the code there. Where would be the > > > right place to put such code? > > > > > > Thanks, > > > Markus. > > Intel GmbH > > Dornacher Strasse 1 > > 85622 Feldkirchen/Muenchen, Deutschland > > Sitz der Gesellschaft: Feldkirchen bei Muenchen > > Geschaeftsfuehrer: Peter Gleissner, Christian Lamprechter, Hannes Schwa= derer, Douglas Lusk > > Registergericht: Muenchen HRB 47456 > > Ust.-IdNr./VAT Registration No.: DE129385895 > > Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052 > > > > > > Intel GmbH Dornacher Strasse 1 85622 Feldkirchen/Muenchen, Deutschland Sitz der Gesellschaft: Feldkirchen bei Muenchen Geschaeftsfuehrer: Peter Gleissner, Christian Lamprechter, Hannes Schwadere= r, Douglas Lusk Registergericht: Muenchen HRB 47456 Ust.-IdNr./VAT Registration No.: DE129385895 Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052