Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: brobecker@adacore.com
Cc: gdb-patches@sourceware.org
Subject: Re: Invalid segment resister value on x86_64-windows
Date: Wed, 02 May 2012 20:45:00 -0000	[thread overview]
Message-ID: <201205022044.q42KiQLc021611@glazunov.sibelius.xs4all.nl> (raw)
In-Reply-To: <20120502175724.GW10958@adacore.com> (message from Joel Brobecker	on Wed, 2 May 2012 10:57:24 -0700)

> Date: Wed, 2 May 2012 10:57:24 -0700
> From: Joel Brobecker <brobecker@adacore.com>
> 
> > I'm not sure we can make those changes.  The default layout for the
> > registers in the target description is chosen such that it is
> > compatible with the "old" register cache layout used for stubs that
> > didn't provide a target description.  That layout is still extensively
> > used by kernel stubs such as the ones in the Linux and NetBSD kernels.
> > I don't think breaking those would be acceptable, as kernel debugging
> > is where the segment registers actually matter!
> 
> That's something I was concerned about. Here is another approach, which
> adds special handling for those registers for Windows. The issue was
> that the same code was used for both 32bit and 64bit Windows, so
> I needed to extend the tdep structure to be able to determine whether
> register N was a segment register or not.
> 
> Does the attached patch look good to you?

Hmm, it should be possible to do this without changing any of the
-tdep.c code, but if you prefer to do it this way, can you rename the
new field into cs_regnum, change the comment into "Register number for
%cs", and move it somewhere around the other _regnum variables that
are already part of the struct?  That makes things a bit more
consistent.

> gdb/ChangeLog:
> 
>         * i386-tdep.h (struct gdbarch_tdep): New field
>         `first_segment_regnum'.
>         * amd64-tdep.c (amd64_init_abi): Set tdep->first_segment_regnum.
>         * i386-tdep.c (i386_gdbarch_init): Likewise.
>         * windows-nat.c (do_windows_fetch_inferior_registers): Only
>         read the first 16 bits of segment register values.


  reply	other threads:[~2012-05-02 20:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-01 23:04 Joel Brobecker
2012-05-01 23:04 ` [RFA/commit 1/2] Regenerate the features/i386 target description .c files Joel Brobecker
2012-05-02  6:34   ` Sergio Durigan Junior
2012-05-01 23:05 ` [RFA 2/2] [x86/x86_64] Segment registers are 16 bits long (not 32bits) Joel Brobecker
2012-05-02  0:01 ` [RFA 3/2(+)] Test size of x86/x86_64 segment registers Joel Brobecker
2012-05-02 10:10 ` Invalid segment resister value on x86_64-windows Mark Kettenis
2012-05-02 17:57   ` Joel Brobecker
2012-05-02 20:45     ` Mark Kettenis [this message]
2012-05-02 21:26       ` Joel Brobecker
2012-05-02 21:27         ` Joel Brobecker
2012-05-02 21:50           ` Mark Kettenis
2012-05-02 21:58           ` [WINDOWS/RFC] " Joel Brobecker
2012-05-02 22:10             ` Christopher Faylor
2012-05-02 22:16               ` Christopher Faylor
2012-05-04 18:38               ` checked in: " Joel Brobecker

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=201205022044.q42KiQLc021611@glazunov.sibelius.xs4all.nl \
    --to=mark.kettenis@xs4all.nl \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /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