From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32265 invoked by alias); 27 Sep 2012 07:08:08 -0000 Received: (qmail 32250 invoked by uid 22791); 27 Sep 2012 07:08:06 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_NO X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 27 Sep 2012 07:07:52 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 6A0051C7D92; Thu, 27 Sep 2012 03:07:51 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id gUeY-pbpjzZV; Thu, 27 Sep 2012 03:07:51 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id B56AB1C7D91; Thu, 27 Sep 2012 03:07:50 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 143BBC8051; Thu, 27 Sep 2012 09:07:49 +0200 (CEST) Date: Thu, 27 Sep 2012 07:08:00 -0000 From: Joel Brobecker To: "Metzger, Markus T" Cc: Mark Kettenis , "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 Message-ID: <20120927070748.GA2980@adacore.com> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 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/msg00614.txt.bz2 > > > > + __asm__ __volatile__ ("movl $1, %%eax;" > > > > + "cpuid;" > > > > + : "=a" (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). [...] > > 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 > > to handle kernels without the patch, so we would need something > > similar to this in gdb, as well. [...] > > 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? The -tdep files are target-support files, and are independent of the host. For instance, you can very well have an x86-solaris debugger hosted on x86_64-windows. The code should be in a -nat file. If this is specific to x86 and Linux kernels, I would say i386-linux-nat.c. If you need to access this information from the tdep file, then things get a little more tricky, since the tdep file cannot assume that it is running on an x86-linux host. For that, we use a transfer mechanism. See how we use TARGET_OBJECT_HPUX_SOLIB_GOT in ia64-hpux-tdep.c for instance. -- Joel