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: Enable x86 XML target descriptions


On Mon, Feb 22, 2010 at 7:52 AM, Daniel Jacobowitz <dan@codesourcery.com> wrote:
> On Mon, Feb 22, 2010 at 07:34:01AM -0800, H.J. Lu wrote:
>> I just need to know if the inferior is 32bit or 64bit. Why shouldn't
>> target_gdbarch be used? At this point, target_gdbarch should have
>> the correct bfd cpu info. Is that correct?
>
> Not if, for instance, we did not find the executable.

How do you debug if you can't find executable? I am not sure if
you can get that far.

> If you are just guessing based on the gdbarch, what value does this
> function add?
>

AVX version is

static const struct target_desc *
amd64_linux_read_description (struct target_ops *ops)
{
  gdb_assert (i386_xstate.status != XSTATE_UNKNOWN);

  if (have_ptrace_getregset == -1)
    {
      int tid;
      unsigned long long xstateregs[i386_xstate.n_of_int64];
      struct iovec iov;

      /* GNU/Linux LWP ID's are process ID's.  */
      tid = TIDGET (inferior_ptid);
      if (tid == 0)
        tid = PIDGET (inferior_ptid); /* Not a threaded program.  */

      iov.iov_base = xstateregs;
      iov.iov_len = i386_xstate.size;

      /* Check if PTRACE_GETREGSET works.  */
      if (ptrace (PTRACE_GETREGSET, tid,
                  (unsigned int) NT_X86_XSTATE, (long) &iov) < 0)
        have_ptrace_getregset = 0;
      else
        have_ptrace_getregset = 1;
    }

  /* Check the native XCR0 only if PTRACE_GETREGSET is available.  */
  if (have_ptrace_getregset &&
      (i386_xstate.xcr0 & XSTATE_AVX_MASK) == XSTATE_AVX_MASK)
    {
      if (gdbarch_ptr_bit (target_gdbarch) == 64)
        return tdesc_amd64_avx_linux;
      else
        return tdesc_i386_avx_linux;
    }
  else
    {
      if (gdbarch_ptr_bit (target_gdbarch) == 64)
        return tdesc_amd64_linux;
      else
        return tdesc_i386_linux;
    }
}

That is we use AVX target only if kernel and hardware support it.


-- 
H.J.


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