From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31146 invoked by alias); 22 Feb 2010 15:34:12 -0000 Received: (qmail 31131 invoked by uid 22791); 22 Feb 2010 15:34:11 -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-ww0-f41.google.com (HELO mail-ww0-f41.google.com) (74.125.82.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 22 Feb 2010 15:34:06 +0000 Received: by wwb24 with SMTP id 24so408649wwb.0 for ; Mon, 22 Feb 2010 07:34:03 -0800 (PST) MIME-Version: 1.0 Received: by 10.216.165.146 with SMTP id e18mr227251wel.54.1266852843395; Mon, 22 Feb 2010 07:34:03 -0800 (PST) In-Reply-To: <20100222144141.GA30100@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> Date: Mon, 22 Feb 2010 15:34:00 -0000 Message-ID: <6dc9ffc81002220734i15bd1279mb54cb0b64a37f3dc@mail.gmail.com> Subject: Re: PATCH: Enable x86 XML target descriptions From: "H.J. Lu" To: Mark Kettenis , hjl.tools@gmail.com, gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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/msg00537.txt.bz2 On Mon, Feb 22, 2010 at 6:41 AM, Daniel Jacobowitz w= rote: > On Mon, Feb 22, 2010 at 02:42:28PM +0100, Mark Kettenis wrote: >> > +/* Get Linux/x86 target description from running target. =A0*/ >> > + >> > +static const struct target_desc * >> > +amd64_linux_read_description (struct target_ops *ops) >> > +{ >> > + =A0if (gdbarch_ptr_bit (target_gdbarch) =3D=3D 64) >> > + =A0 =A0return tdesc_amd64_linux; >> > + =A0else >> > + =A0 =A0return tdesc_i386_linux; >> > +} >> > + >> >> This made me wonder what happens if you attach to a process without >> loading an executable first. =A0Currently this works, since GDB can >> figure out what executable belongs to the the process and load the >> executable automatically. =A0But I fear a chicken & egg problem here: >> the gdbarch is derviced from the tdesc, but in order to determine the >> tdesc you need a gdbarch. > > Yes, I'm not comfortable having this function respond based on the > gdbarch. =A0It's supposed to query the target. =A0For instance, if you had > a ptrace request that failed if the target was 32-bit, you could use > that. =A0If that's not possible, it probably shouldn't be implemented. > 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? --=20 H.J.