Fix compiletest on FreeBSD

Recent FreeBSD gdb packages have a different format for the version string.
This commit is contained in:
Alan Somers 2021-03-26 15:25:48 -06:00
parent 52e3dffa50
commit 4f73d2153c
2 changed files with 5 additions and 1 deletions

View File

@ -909,7 +909,8 @@ fn extract_gdb_version(full_version_line: &str) -> Option<u32> {
// This particular form is documented in the GNU coding standards:
// https://www.gnu.org/prep/standards/html_node/_002d_002dversion.html#g_t_002d_002dversion
let mut splits = full_version_line.rsplit(' ');
let unbracketed_part = full_version_line.split('[').next().unwrap();
let mut splits = unbracketed_part.trim_end().rsplit(' ');
let version_string = splits.next().unwrap();
let mut splits = version_string.split('.');

View File

@ -39,6 +39,9 @@ fn test_extract_gdb_version() {
7012000: "GNU gdb (GDB) 7.12",
7012000: "GNU gdb (GDB) 7.12.20161027-git",
7012050: "GNU gdb (GDB) 7.12.50.20161027-git",
9002000: "GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2",
10001000: "GNU gdb (GDB) 10.1 [GDB v10.1 for FreeBSD]",
}
}