This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch v3 16/16] btrace, x86: restrict to Atom
- From: Joel Brobecker <brobecker at adacore dot com>
- To: "Metzger, Markus T" <markus dot t dot metzger at intel dot com>
- Cc: Mark Kettenis <mark dot kettenis at xs4all dot nl>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>, "markus dot t dot metzger at gmail dot com" <markus dot t dot metzger at gmail dot com>, "jan dot kratochvil at redhat dot com" <jan dot kratochvil at redhat dot com>, "palves at redhat dot com" <palves at redhat dot com>, "tromey at redhat dot com" <tromey at redhat dot com>
- Date: Thu, 27 Sep 2012 09:07:49 +0200
- Subject: Re: [patch v3 16/16] btrace, x86: restrict to Atom
- 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> <A78C989F6D9628469189715575E55B2307ACF558@IRSMSX102.ger.corp.intel.com> <A78C989F6D9628469189715575E55B2307AEDD71@IRSMSX102.ger.corp.intel.com>
> > > > + __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