From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23639 invoked by alias); 22 Feb 2010 15:58:01 -0000 Received: (qmail 23617 invoked by uid 22791); 22 Feb 2010 15:58:00 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40 X-Spam-Check-By: sourceware.org Received: from mail-ew0-f223.google.com (HELO mail-ew0-f223.google.com) (209.85.219.223) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 22 Feb 2010 15:57:55 +0000 Received: by ewy23 with SMTP id 23so3009285ewy.4 for ; Mon, 22 Feb 2010 07:57:52 -0800 (PST) MIME-Version: 1.0 Received: by 10.216.93.1 with SMTP id k1mr1674297wef.151.1266854272679; Mon, 22 Feb 2010 07:57:52 -0800 (PST) In-Reply-To: <20100222155243.GC30100@caradoc.them.org> References: <20100210200303.GA19632@lucon.org> <20100218054312.GA9022@lucon.org> <20100218153402.GA27929@lucon.org> <20100218230135.GA17916@intel.com> <201002221342.o1MDgSZA029705@glazunov.sibelius.xs4all.nl> <20100222144141.GA30100@caradoc.them.org> <6dc9ffc81002220734i15bd1279mb54cb0b64a37f3dc@mail.gmail.com> <20100222155243.GC30100@caradoc.them.org> Date: Mon, 22 Feb 2010 15:58:00 -0000 Message-ID: <6dc9ffc81002220757v5e9b48bdnba56a260f0f3c0a8@mail.gmail.com> Subject: Re: PATCH: Enable x86 XML target descriptions From: "H.J. Lu" To: "H.J. Lu" , Mark Kettenis , gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 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: 2010-02/txt/msg00540.txt.bz2 On Mon, Feb 22, 2010 at 7:52 AM, Daniel Jacobowitz 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.