@@ -80,17 +80,22 @@ impl EarlyProps {
8080
8181 if let Some ( actual_version) = config. gdb_version {
8282 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) ;
8484
85- if min_version . 0 != min_version . 1 {
85+ if start_ver != end_ver {
8686 panic ! ( "Expected single GDB version" )
8787 }
8888 // Ignore if actual version is smaller the minimum required
8989 // version
90- actual_version < min_version . 0
90+ actual_version < start_ver
9191 } 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
9499 } else {
95100 false
96101 }
@@ -99,6 +104,11 @@ impl EarlyProps {
99104 }
100105 }
101106
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>.
102112 fn extract_gdb_version_range ( line : & str ) -> ( u32 , u32 ) {
103113 const ERROR_MESSAGE : & ' static str = "Malformed GDB version directive" ;
104114
@@ -109,7 +119,6 @@ impl EarlyProps {
109119 . collect :: < Vec < & str > > ( ) ;
110120
111121 match range_components. len ( ) {
112- 0 => panic ! ( ERROR_MESSAGE ) ,
113122 1 => {
114123 let v = extract_gdb_version ( range_components[ 0 ] ) . unwrap ( ) ;
115124 ( v, v)
0 commit comments