@@ -71,7 +71,8 @@ pub fn parse_config(args: Vec<String> ) -> Config {
71
71
optflag( "" , "jit" , "run tests under the JIT" ) ,
72
72
optopt( "" , "target" , "the target to build for" , "TARGET" ) ,
73
73
optopt( "" , "host" , "the host to build for" , "HOST" ) ,
74
- optopt( "" , "gdb-version" , "the version of GDB used" , "MAJOR.MINOR" ) ,
74
+ optopt( "" , "gdb-version" , "the version of GDB used" , "VERSION STRING" ) ,
75
+ optopt( "" , "lldb-version" , "the version of LLDB used" , "VERSION STRING" ) ,
75
76
optopt( "" , "android-cross-path" , "Android NDK standalone path" , "PATH" ) ,
76
77
optopt( "" , "adb-path" , "path to the android debugger" , "PATH" ) ,
77
78
optopt( "" , "adb-test-dir" , "path to tests for the android debugger" , "PATH" ) ,
@@ -149,6 +150,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
149
150
target : opt_str2 ( matches. opt_str ( "target" ) ) ,
150
151
host : opt_str2 ( matches. opt_str ( "host" ) ) ,
151
152
gdb_version : extract_gdb_version ( matches. opt_str ( "gdb-version" ) ) ,
153
+ lldb_version : extract_lldb_version ( matches. opt_str ( "lldb-version" ) ) ,
152
154
android_cross_path : opt_path ( matches, "android-cross-path" ) ,
153
155
adb_path : opt_str2 ( matches. opt_str ( "adb-path" ) ) ,
154
156
adb_test_dir : opt_str2 ( matches. opt_str ( "adb-test-dir" ) ) ,
@@ -391,3 +393,37 @@ fn extract_gdb_version(full_version_line: Option<String>) -> Option<String> {
391
393
_ => None
392
394
}
393
395
}
396
+
397
+ fn extract_lldb_version ( full_version_line : Option < String > ) -> Option < String > {
398
+ // Extract the major LLDB version from the given version string.
399
+ // LLDB version strings are different for Apple and non-Apple platforms.
400
+ // At the moment, this function only supports the Apple variant, which looks
401
+ // like this:
402
+ //
403
+ // LLDB-179.5 (older versions)
404
+ // lldb-300.2.51 (new versions)
405
+ //
406
+ // We are only interested in the major version number, so this function
407
+ // will return `Some("179")` and `Some("300")` respectively.
408
+
409
+ match full_version_line {
410
+ Some ( ref full_version_line)
411
+ if full_version_line. as_slice ( ) . trim ( ) . len ( ) > 0 => {
412
+ let full_version_line = full_version_line. as_slice ( ) . trim ( ) ;
413
+
414
+ let re = Regex :: new ( r"[Ll][Ll][Dd][Bb]-([0-9]+)" ) . unwrap ( ) ;
415
+
416
+ match re. captures ( full_version_line) {
417
+ Some ( captures) => {
418
+ Some ( captures. at ( 1 ) . to_string ( ) )
419
+ }
420
+ None => {
421
+ println ! ( "Could not extract LLDB version from line '{}'" ,
422
+ full_version_line) ;
423
+ None
424
+ }
425
+ }
426
+ } ,
427
+ _ => None
428
+ }
429
+ }
0 commit comments