@@ -80,17 +80,22 @@ impl EarlyProps {
80
80
81
81
if let Some ( actual_version) = config. gdb_version {
82
82
if line. contains ( "min-gdb-version" ) {
83
- let min_version = extract_gdb_version_range ( line) ;
83
+ let ( start_ver , end_ver ) = extract_gdb_version_range ( line) ;
84
84
85
- if min_version . 0 != min_version . 1 {
85
+ if start_ver != end_ver {
86
86
panic ! ( "Expected single GDB version" )
87
87
}
88
88
// Ignore if actual version is smaller the minimum required
89
89
// version
90
- actual_version < min_version . 0
90
+ actual_version < start_ver
91
91
} else if line. contains ( "ignore-gdb-version" ) {
92
- let version_range = extract_gdb_version_range ( line) ;
93
- actual_version >= version_range. 0 && actual_version <= version_range. 1
92
+ let ( min_version, max_version) = extract_gdb_version_range ( line) ;
93
+
94
+ if max_version < min_version {
95
+ panic ! ( "Malformed GDB version range: max < min" )
96
+ }
97
+
98
+ actual_version >= min_version && actual_version <= max_version
94
99
} else {
95
100
false
96
101
}
@@ -99,6 +104,11 @@ impl EarlyProps {
99
104
}
100
105
}
101
106
107
+ // Takes a directive of the form "ignore-gdb-version <version1> [- <version2>]",
108
+ // returns the numeric representation of <version1> and <version2> as
109
+ // tuple: (<version1> as u32, <version2> as u32)
110
+ // If the <version2> part is omitted, the second component of the tuple
111
+ // is the same as <version1>.
102
112
fn extract_gdb_version_range ( line : & str ) -> ( u32 , u32 ) {
103
113
const ERROR_MESSAGE : & ' static str = "Malformed GDB version directive" ;
104
114
@@ -109,7 +119,6 @@ impl EarlyProps {
109
119
. collect :: < Vec < & str > > ( ) ;
110
120
111
121
match range_components. len ( ) {
112
- 0 => panic ! ( ERROR_MESSAGE ) ,
113
122
1 => {
114
123
let v = extract_gdb_version ( range_components[ 0 ] ) . unwrap ( ) ;
115
124
( v, v)
0 commit comments