Re: PATCH: Enable x86 XML target descriptions

Mark Kettenis
2010-02-22T15:01:39Z

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1025 bytes --]

> Date: Mon, 22 Feb 2010 06:17:29 -0800
> From: "H.J. Lu" <hjl.tools@gmail.com>
>
> >> +/* 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