Invalid segment resister value on x86_64-windows

Joel Brobecker brobecker@adacore.com
Tue May 1 23:04:00 GMT 2012


Hello,

One of our customers noticed that GDB was displaying invalid values
for the ss & gs register.  It's obviously invalid because the value
was wider than the registers' size (16 bits). I noticed that the XML
files define these register as being 32bit, which I am assuming was
an oversight (?).

As a result of the 32bit size, GDB was reading the value of these
registers as 4 bytes, instead of just 2. On GNU/Linux, I did not
check the kernel sources, but it appears that it was harmless,
because the extra bytes were always zero. But on some Windows
systems, we werent' that lucky.  The extra 2 bytes were not null,
and thus we ended up with a polluted value.

This patch series first regenerates the .c files in features/i386,
because I noticed a difference between the current files and the
generated version.  And the second patch changes the size of all
segment registers to match the size found in the various reference
manuals.

The series was tested on x86_64-linux, standalone and then with
gdbserver. I also checked by hand that the new GDB is still able
to work with an older GDBserver (thanks to the fact that GDBserver
sends the target description to GDB). And I also tested this patch
on x86_64-windows, using AdaCore's testsuite.



More information about the Gdb-patches mailing list