From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21334 invoked by alias); 22 Feb 2010 15:01:39 -0000 Received: (qmail 21233 invoked by uid 22791); 22 Feb 2010 15:01:38 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO glazunov.sibelius.xs4all.nl) (83.163.83.176) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 22 Feb 2010 15:01:32 +0000 Received: from glazunov.sibelius.xs4all.nl (kettenis@localhost [127.0.0.1]) by glazunov.sibelius.xs4all.nl (8.14.3/8.14.3) with ESMTP id o1MF1Rqw030502; Mon, 22 Feb 2010 16:01:27 +0100 (CET) Received: (from kettenis@localhost) by glazunov.sibelius.xs4all.nl (8.14.3/8.14.3/Submit) id o1MF1Qrq024363; Mon, 22 Feb 2010 16:01:26 +0100 (CET) Date: Mon, 22 Feb 2010 15:01:00 -0000 Message-Id: <201002221501.o1MF1Qrq024363@glazunov.sibelius.xs4all.nl> From: Mark Kettenis To: hjl.tools@gmail.com CC: gdb-patches@sourceware.org In-reply-to: <6dc9ffc81002220617o1d348e68hc918d434118cadcb@mail.gmail.com> (hjl.tools@gmail.com) Subject: Re: PATCH: Enable x86 XML target descriptions References: <20100210200303.GA19632@lucon.org> <20100218054312.GA9022@lucon.org> <20100218153402.GA27929@lucon.org> <20100218230135.GA17916@intel.com> <201002221342.o1MDgSZA029705@glazunov.sibelius.xs4all.nl> <6dc9ffc81002220617o1d348e68hc918d434118cadcb@mail.gmail.com> 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/msg00534.txt.bz2 > Date: Mon, 22 Feb 2010 06:17:29 -0800 > From: "H.J. Lu" > > >> +/* Get Linux/x86 target description from running target.  */ > >> + > >> +static const struct target_desc * > >> +amd64_linux_read_description (struct target_ops *ops) > >> +{ > >> +  if (gdbarch_ptr_bit (target_gdbarch) == 64) > >> +    return tdesc_amd64_linux; > >> +  else > >> +    return tdesc_i386_linux; > >> +} > >> + > > > > This made me wonder what happens if you attach to a process without > > loading an executable first.  Currently this works, since GDB can > > figure out what executable belongs to the the process and load the > > executable automatically.  But 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. > > How do you attach to a process without loading an executable first? > Gdb has to load something to debug. Do you have a testcase? I will > fix it if it doesn't work already. $ gdb ... (gdb) attach PID