From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: hjl.tools@gmail.com
Cc: gdb-patches@sourceware.org
Subject: Re: PATCH: Enable x86 XML target descriptions
Date: Sun, 28 Feb 2010 20:30:00 -0000 [thread overview]
Message-ID: <201002282030.o1SKUe6V032104@glazunov.sibelius.xs4all.nl> (raw)
In-Reply-To: <6dc9ffc81002220617o1d348e68hc918d434118cadcb@mail.gmail.com> (hjl.tools@gmail.com)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3887 bytes --]
> Date: Mon, 22 Feb 2010 06:17:29 -0800
> From: "H.J. Lu" <hjl.tools@gmail.com>
>
> >> +/* Get Linux/x86 target description from core dump. */
> >> +
> >> +static const struct target_desc *
> >> +amd64_linux_core_read_description (struct gdbarch *gdbarch,
> >> + struct target_ops *target,
> >> + bfd *abfd)
> >> +{
> >> + asection *section = bfd_get_section_by_name (abfd, ".reg2");
> >> +
> >> + if (section == NULL)
> >> + return NULL;
> >> +
> >> + switch (bfd_section_size (abfd, section))
> >> + {
> >> + case 0x200:
> >> + /* Linux/x86-64. */
> >> + return tdesc_amd64_linux;
> >> + default:
> >> + return NULL;
> >> + }
> >> +}
> >
> > This seems a bit odd to me. I'd expect this function to just return
> > tdesc_amd64_linux unconditionally.
>
> The folowup patch for AVX will change it to
>
> xcr0 = i386_linux_core_read_xcr0 (gdbarch, target, abfd);
> switch (bfd_section_size (abfd, section))
> {
> case 0x200:
> /* Linux/x86-64. */
> if ((xcr0 & XSTATE_AVX_MASK) == XSTATE_AVX_MASK)
> return tdesc_amd64_avx_linux;
> else
> return tdesc_amd64_linux;
> default:
> return NULL;
> }
>
> Other OSes will need a similar change to support AVX.
Even with that, checking the size of the .reg2 section makes no sense
to me.
> >> @@ -1282,10 +1292,31 @@ amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
> >>
> >> /* Add the %orig_rax register used for syscall restarting. */
> >> set_gdbarch_write_pc (gdbarch, amd64_linux_write_pc);
> >> +
> >> + /* Reserve a number for orig_rax. */
> >> set_gdbarch_num_regs (gdbarch, AMD64_LINUX_NUM_REGS);
> >> - set_gdbarch_register_name (gdbarch, amd64_linux_register_name);
> >> - set_gdbarch_register_type (gdbarch, amd64_linux_register_type);
> >> - set_gdbarch_register_reggroup_p (gdbarch, amd64_linux_register_reggroup_p);
> >
> > Why do you need to set num_regs here, but not the register_name,
> > register_type and register_reggroup_p members? All four are set by
> > tdesc_use_registers().
>
> tdesc_use_registers is called after amd64_linux_init_abi. At this
> point, num_regs is incorrect for Linux. We need to update it for
>
> valid_p = tdesc_numbered_register (feature, tdesc_data,
> AMD64_LINUX_ORIG_RAX_REGNUM,
> "orig_rax");
Sorry, but I don't understand this. How does checking a register in
the target description care about the number of registers set in the
gdbarch we're building?
> >> +
> >> + if (! tdesc_has_registers (tdesc))
> >> + tdesc = tdesc_amd64_linux;
> >> + tdep->tdesc = tdesc;
> >> +
> >> + feature = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.linux");
> >
> > Shouldn't that be org.gnu.gdb.amd64.linux?
>
> 64bit-core.xml and 64bit-sse.xml have
>
> <feature name="org.gnu.gdb.i386.core">
>
> and
>
> <feature name="org.gnu.gdb.i386.sse">
Which seems wrong to me. Both the core registers and the SSE
registers are different in 64-bit mode. But perhaps Daniel can shed
some light on how these features are supposed to be used?
> so that i386_gdbarch_init can have
>
> /* Get core registers. */
> feature_core = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.core");
>
> /* Get SSE registers. */
> feature_vector = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.sse");
>
> after
>
> /* Hook in ABI-specific overrides, if they have been registered. */
> info.tdep_info = (void *) tdesc_data;
> gdbarch_init_osabi (info, gdbarch);
>
> It will be odd for 64bit-linux.xml to have
>
> <feature name="org.gnu.gdb.i386.linux">
Exactly. So why is it ok for 64bit-sse.xml to have
<fearure name="org.gnu.gdb.i386.sse">
?
next prev parent reply other threads:[~2010-02-28 20:30 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-10 20:03 H.J. Lu
2010-02-17 14:59 ` H.J. Lu
2010-02-17 15:23 ` Mark Kettenis
2010-02-17 15:42 ` H.J. Lu
2010-02-17 15:46 ` Daniel Jacobowitz
2010-02-17 16:19 ` Mark Kettenis
2010-02-18 5:44 ` H.J. Lu
2010-02-18 15:37 ` H.J. Lu
2010-02-18 23:01 ` H.J. Lu
2010-02-22 13:42 ` Mark Kettenis
2010-02-22 14:17 ` H.J. Lu
2010-02-22 15:01 ` Mark Kettenis
2010-02-22 15:27 ` H.J. Lu
2010-02-22 15:30 ` Daniel Jacobowitz
2010-02-22 15:39 ` H.J. Lu
2010-02-28 20:30 ` Mark Kettenis [this message]
2010-02-28 20:58 ` H.J. Lu
2010-02-28 22:23 ` Daniel Jacobowitz
2010-02-22 14:41 ` Daniel Jacobowitz
2010-02-22 15:34 ` H.J. Lu
2010-02-22 15:52 ` Daniel Jacobowitz
2010-02-22 15:58 ` H.J. Lu
2010-02-22 16:10 ` Daniel Jacobowitz
2010-02-22 16:58 ` Mark Kettenis
2010-02-22 17:03 ` Daniel Jacobowitz
2010-02-22 19:52 ` Mark Kettenis
2010-02-22 21:06 ` H.J. Lu
2010-02-22 21:31 ` Mark Kettenis
2010-02-22 21:41 ` H.J. Lu
2010-02-22 22:05 ` H. Peter Anvin
2010-02-22 22:07 ` H.J. Lu
2010-02-22 22:15 ` H. Peter Anvin
2010-02-22 22:21 ` H.J. Lu
2010-02-28 20:12 ` Mark Kettenis
2010-02-22 21:04 ` H.J. Lu
2010-02-28 21:16 ` H.J. Lu
2010-03-01 14:49 ` Mark Kettenis
2010-03-01 17:07 ` Daniel Jacobowitz
2010-03-01 17:09 ` H.J. Lu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201002282030.o1SKUe6V032104@glazunov.sibelius.xs4all.nl \
--to=mark.kettenis@xs4all.nl \
--cc=gdb-patches@sourceware.org \
--cc=hjl.tools@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox