@@ -73,19 +73,24 @@ impl EarlyProps {
73
73
return false ;
74
74
}
75
75
76
- if parse_name_directive ( line, "ignore-gdb" ) {
76
+ if !line. contains ( "ignore-gdb-version" ) &&
77
+ parse_name_directive ( line, "ignore-gdb" ) {
77
78
return true ;
78
79
}
79
80
80
81
if let Some ( actual_version) = config. gdb_version {
81
82
if line. contains ( "min-gdb-version" ) {
82
- let min_version = line. trim ( )
83
- . split ( ' ' )
84
- . last ( )
85
- . expect ( "Malformed GDB version directive" ) ;
83
+ let min_version = extract_gdb_version_range ( line) ;
84
+
85
+ if min_version. 0 != min_version. 1 {
86
+ panic ! ( "Expected single GDB version" )
87
+ }
86
88
// Ignore if actual version is smaller the minimum required
87
89
// version
88
- actual_version < extract_gdb_version ( min_version) . unwrap ( )
90
+ actual_version < min_version. 0
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
89
94
} else {
90
95
false
91
96
}
@@ -94,6 +99,30 @@ impl EarlyProps {
94
99
}
95
100
}
96
101
102
+ fn extract_gdb_version_range ( line : & str ) -> ( u32 , u32 ) {
103
+ const ERROR_MESSAGE : & ' static str = "Malformed GDB version directive" ;
104
+
105
+ let range_components = line. split ( ' ' )
106
+ . flat_map ( |word| word. split ( '-' ) )
107
+ . filter ( |word| word. len ( ) > 0 )
108
+ . skip_while ( |word| extract_gdb_version ( word) . is_none ( ) )
109
+ . collect :: < Vec < & str > > ( ) ;
110
+
111
+ match range_components. len ( ) {
112
+ 0 => panic ! ( ERROR_MESSAGE ) ,
113
+ 1 => {
114
+ let v = extract_gdb_version ( range_components[ 0 ] ) . unwrap ( ) ;
115
+ ( v, v)
116
+ }
117
+ 2 => {
118
+ let v_min = extract_gdb_version ( range_components[ 0 ] ) . unwrap ( ) ;
119
+ let v_max = extract_gdb_version ( range_components[ 1 ] ) . expect ( ERROR_MESSAGE ) ;
120
+ ( v_min, v_max)
121
+ }
122
+ _ => panic ! ( ERROR_MESSAGE ) ,
123
+ }
124
+ }
125
+
97
126
fn ignore_lldb ( config : & Config , line : & str ) -> bool {
98
127
if config. mode != common:: DebugInfoLldb {
99
128
return false ;
0 commit comments