@@ -32,6 +32,7 @@ use std::io::process;
3232use std:: io:: timer;
3333use std:: io;
3434use std:: os;
35+ use std:: iter:: repeat;
3536use std:: str;
3637use std:: string:: String ;
3738use std:: thread:: Thread ;
@@ -367,7 +368,6 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
367368 let DebuggerCommands {
368369 commands,
369370 check_lines,
370- use_gdb_pretty_printer,
371371 breakpoint_lines
372372 } = parse_debugger_commands ( testfile, "gdb" ) ;
373373 let mut cmds = commands. connect ( "\n " ) ;
@@ -521,16 +521,11 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
521521 if header:: gdb_version_to_int ( version. as_slice ( ) ) >
522522 header:: gdb_version_to_int ( "7.4" ) {
523523 // Add the directory containing the pretty printers to
524- // GDB's script auto loading safe path ...
524+ // GDB's script auto loading safe path
525525 script_str. push_str (
526526 format ! ( "add-auto-load-safe-path {}\n " ,
527527 rust_pp_module_abs_path. replace( "\\ " , "\\ \\ " ) . as_slice( ) )
528528 . as_slice ( ) ) ;
529- // ... and also the test directory
530- script_str. push_str (
531- format ! ( "add-auto-load-safe-path {}\n " ,
532- config. build_base. as_str( ) . unwrap( ) . replace( "\\ " , "\\ \\ " ) )
533- . as_slice ( ) ) ;
534529 }
535530 }
536531 _ => {
@@ -543,6 +538,9 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
543538 // pretty printing, it just tells GDB to print values on one line:
544539 script_str. push_str ( "set print pretty off\n " ) ;
545540
541+ // Add the pretty printer directory to GDB's source-file search path
542+ script_str. push_str ( format ! ( "directory {}\n " , rust_pp_module_abs_path) [ ] ) ;
543+
546544 // Load the target executable
547545 script_str. push_str ( format ! ( "file {}\n " ,
548546 exe_file. as_str( ) . unwrap( ) . replace( "\\ " , "\\ \\ " ) )
@@ -564,12 +562,6 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
564562 script_str. as_slice ( ) ,
565563 "debugger.script" ) ;
566564
567- if use_gdb_pretty_printer {
568- // Only emit the gdb auto-loading script if pretty printers
569- // should actually be loaded
570- dump_gdb_autoload_script ( config, testfile) ;
571- }
572-
573565 // run debugger script with gdb
574566 #[ cfg( windows) ]
575567 fn debugger ( ) -> String {
@@ -611,19 +603,6 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
611603 }
612604
613605 check_debugger_output ( & debugger_run_result, check_lines. as_slice ( ) ) ;
614-
615- fn dump_gdb_autoload_script ( config : & Config , testfile : & Path ) {
616- let mut script_path = output_base_name ( config, testfile) ;
617- let mut script_file_name = script_path. filename ( ) . unwrap ( ) . to_vec ( ) ;
618- script_file_name. push_all ( "-gdb.py" . as_bytes ( ) ) ;
619- script_path. set_filename ( script_file_name. as_slice ( ) ) ;
620-
621- let script_content = "import gdb_rust_pretty_printing\n \
622- gdb_rust_pretty_printing.register_printers(gdb.current_objfile())\n "
623- . as_bytes ( ) ;
624-
625- File :: create ( & script_path) . write ( script_content) . unwrap ( ) ;
626- }
627606}
628607
629608fn find_rust_src_root ( config : & Config ) -> Option < Path > {
@@ -781,7 +760,6 @@ struct DebuggerCommands {
781760 commands : Vec < String > ,
782761 check_lines : Vec < String > ,
783762 breakpoint_lines : Vec < uint > ,
784- use_gdb_pretty_printer : bool
785763}
786764
787765fn parse_debugger_commands ( file_path : & Path , debugger_prefix : & str )
@@ -794,7 +772,6 @@ fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str)
794772 let mut breakpoint_lines = vec ! ( ) ;
795773 let mut commands = vec ! ( ) ;
796774 let mut check_lines = vec ! ( ) ;
797- let mut use_gdb_pretty_printer = false ;
798775 let mut counter = 1 ;
799776 let mut reader = BufferedReader :: new ( File :: open ( file_path) . unwrap ( ) ) ;
800777 for line in reader. lines ( ) {
@@ -804,10 +781,6 @@ fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str)
804781 breakpoint_lines. push ( counter) ;
805782 }
806783
807- if line. as_slice ( ) . contains ( "gdb-use-pretty-printer" ) {
808- use_gdb_pretty_printer = true ;
809- }
810-
811784 header:: parse_name_value_directive (
812785 line. as_slice ( ) ,
813786 command_directive. as_slice ( ) ) . map ( |cmd| {
@@ -832,7 +805,6 @@ fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str)
832805 commands : commands,
833806 check_lines : check_lines,
834807 breakpoint_lines : breakpoint_lines,
835- use_gdb_pretty_printer : use_gdb_pretty_printer,
836808 }
837809}
838810
@@ -976,8 +948,7 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
976948 proc_res : & ProcRes ) {
977949
978950 // true if we found the error in question
979- let mut found_flags = Vec :: from_elem (
980- expected_errors. len ( ) , false ) ;
951+ let mut found_flags: Vec < _ > = repeat ( false ) . take ( expected_errors. len ( ) ) . collect ( ) ;
981952
982953 if proc_res. status . success ( ) {
983954 fatal ( "process did not return an error status" ) ;
@@ -1337,7 +1308,7 @@ fn make_run_args(config: &Config, props: &TestProps, testfile: &Path) ->
13371308 // Add the arguments in the run_flags directive
13381309 args. extend ( split_maybe_args ( & props. run_flags ) . into_iter ( ) ) ;
13391310
1340- let prog = args. remove ( 0 ) . unwrap ( ) ;
1311+ let prog = args. remove ( 0 ) ;
13411312 return ProcArgs {
13421313 prog : prog,
13431314 args : args,
0 commit comments