Invalid segment resister value on x86_64-windows

Joel Brobecker brobecker@adacore.com
Wed May 2 17:57:00 GMT 2012


> 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?

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.

Tested on x86-windows and x86_64-windows using AdaCore's testsuite.
Tested on x86_64-linux with the official testsuite (JIC).

Thank you,
-- 
Joel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: segment-registers-windows.diff
Type: text/x-diff
Size: 2931 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20120502/c7d50bf2/attachment.bin>


More information about the Gdb-patches mailing list