Handle CRLF when reading XML on Windows
authorTom Tromey <tromey@adacore.com>
Tue, 10 Dec 2019 18:44:36 +0000 (11:44 -0700)
committerTom Tromey <tromey@adacore.com>
Thu, 19 Dec 2019 17:00:05 +0000 (10:00 -0700)
commitf69656d00fe3154519ea21668d964bf8cc50c01b
treee07fe31898f35e94c42ff5e8e185488e7a26f845
parent228c8f4be0c428369ec6b68e25696863d1e62ed7
Handle CRLF when reading XML on Windows

xml-support.c uses FOPEN_RT, but then reads the entire contents of the
file and verifies that the number of bytes read matches the length.
This can fail on Windows, where the read will translate line
terminators.

This patch fixes the bug by changing xml-support.c to use FOPEN_RB.
This works because expat correctly handles \r\n line terminators.

gdb/ChangeLog
2019-12-11  Tom Tromey  <tromey@adacore.com>

* xml-support.c (xml_fetch_content_from_file): Use FOPEN_RB.

gdb/testsuite/ChangeLog
2019-12-11  Tom Tromey  <tromey@adacore.com>

* gdb.xml/tdesc-arch.exp (set_arch): Add "trans_mode" parameter.
Add crlf test.

Change-Id: I548438f33eed284dde1de8babf755eaa1a40319d
gdb/ChangeLog
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.xml/tdesc-arch.exp
gdb/xml-support.c