This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch v3 16/16] btrace, x86: restrict to Atom


> > > > +  __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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]