@@ -430,11 +430,23 @@ actual:\n\
430430 }
431431
432432 fn run_debuginfo_gdb_test_no_opt ( & self ) {
433+ let prefixes = if self . config . gdb_native_rust {
434+ // GDB with Rust
435+ static PREFIXES : & ' static [ & ' static str ] = & [ "gdb" , "gdbr" ] ;
436+ println ! ( "NOTE: compiletest thinks it is using GDB with native rust support" ) ;
437+ PREFIXES
438+ } else {
439+ // Generic GDB
440+ static PREFIXES : & ' static [ & ' static str ] = & [ "gdb" , "gdbg" ] ;
441+ println ! ( "NOTE: compiletest thinks it is using GDB without native rust support" ) ;
442+ PREFIXES
443+ } ;
444+
433445 let DebuggerCommands {
434446 commands,
435447 check_lines,
436448 breakpoint_lines
437- } = self . parse_debugger_commands ( "gdb" ) ;
449+ } = self . parse_debugger_commands ( prefixes ) ;
438450 let mut cmds = commands. join ( "\n " ) ;
439451
440452 // compile test file (it should have 'compile-flags:-g' in the header)
@@ -731,7 +743,7 @@ actual:\n\
731743 check_lines,
732744 breakpoint_lines,
733745 ..
734- } = self . parse_debugger_commands ( "lldb" ) ;
746+ } = self . parse_debugger_commands ( & [ "lldb" ] ) ;
735747
736748 // Write debugger script:
737749 // We don't want to hang when calling `quit` while the process is still running
@@ -826,9 +838,11 @@ actual:\n\
826838 }
827839 }
828840
829- fn parse_debugger_commands ( & self , debugger_prefix : & str ) -> DebuggerCommands {
830- let command_directive = format ! ( "{}-command" , debugger_prefix) ;
831- let check_directive = format ! ( "{}-check" , debugger_prefix) ;
841+ fn parse_debugger_commands ( & self , debugger_prefixes : & [ & str ] ) -> DebuggerCommands {
842+ let directives = debugger_prefixes. iter ( ) . map ( |prefix| (
843+ format ! ( "{}-command" , prefix) ,
844+ format ! ( "{}-check" , prefix) ,
845+ ) ) . collect :: < Vec < _ > > ( ) ;
832846
833847 let mut breakpoint_lines = vec ! ( ) ;
834848 let mut commands = vec ! ( ) ;
@@ -842,17 +856,19 @@ actual:\n\
842856 breakpoint_lines. push ( counter) ;
843857 }
844858
845- header:: parse_name_value_directive (
846- & line,
847- & command_directive) . map ( |cmd| {
848- commands. push ( cmd)
849- } ) ;
850-
851- header:: parse_name_value_directive (
852- & line,
853- & check_directive) . map ( |cmd| {
854- check_lines. push ( cmd)
855- } ) ;
859+ for & ( ref command_directive, ref check_directive) in & directives {
860+ header:: parse_name_value_directive (
861+ & line,
862+ & command_directive) . map ( |cmd| {
863+ commands. push ( cmd)
864+ } ) ;
865+
866+ header:: parse_name_value_directive (
867+ & line,
868+ & check_directive) . map ( |cmd| {
869+ check_lines. push ( cmd)
870+ } ) ;
871+ }
856872 }
857873 Err ( e) => {
858874 self . fatal ( & format ! ( "Error while parsing debugger commands: {}" , e) )
0 commit comments