@@ -32,6 +32,7 @@ use std::io::process;
32
32
use std:: io:: timer;
33
33
use std:: io;
34
34
use std:: os;
35
+ use std:: iter:: repeat;
35
36
use std:: str;
36
37
use std:: string:: String ;
37
38
use std:: thread:: Thread ;
@@ -367,7 +368,6 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
367
368
let DebuggerCommands {
368
369
commands,
369
370
check_lines,
370
- use_gdb_pretty_printer,
371
371
breakpoint_lines
372
372
} = parse_debugger_commands ( testfile, "gdb" ) ;
373
373
let mut cmds = commands. connect ( "\n " ) ;
@@ -521,16 +521,11 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
521
521
if header:: gdb_version_to_int ( version. as_slice ( ) ) >
522
522
header:: gdb_version_to_int ( "7.4" ) {
523
523
// Add the directory containing the pretty printers to
524
- // GDB's script auto loading safe path ...
524
+ // GDB's script auto loading safe path
525
525
script_str. push_str (
526
526
format ! ( "add-auto-load-safe-path {}\n " ,
527
527
rust_pp_module_abs_path. replace( "\\ " , "\\ \\ " ) . as_slice( ) )
528
528
. 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 ( ) ) ;
534
529
}
535
530
}
536
531
_ => {
@@ -543,6 +538,9 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
543
538
// pretty printing, it just tells GDB to print values on one line:
544
539
script_str. push_str ( "set print pretty off\n " ) ;
545
540
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
+
546
544
// Load the target executable
547
545
script_str. push_str ( format ! ( "file {}\n " ,
548
546
exe_file. as_str( ) . unwrap( ) . replace( "\\ " , "\\ \\ " ) )
@@ -564,12 +562,6 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
564
562
script_str. as_slice ( ) ,
565
563
"debugger.script" ) ;
566
564
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
-
573
565
// run debugger script with gdb
574
566
#[ cfg( windows) ]
575
567
fn debugger ( ) -> String {
@@ -611,19 +603,6 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
611
603
}
612
604
613
605
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
- }
627
606
}
628
607
629
608
fn find_rust_src_root ( config : & Config ) -> Option < Path > {
@@ -781,7 +760,6 @@ struct DebuggerCommands {
781
760
commands : Vec < String > ,
782
761
check_lines : Vec < String > ,
783
762
breakpoint_lines : Vec < uint > ,
784
- use_gdb_pretty_printer : bool
785
763
}
786
764
787
765
fn parse_debugger_commands ( file_path : & Path , debugger_prefix : & str )
@@ -794,7 +772,6 @@ fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str)
794
772
let mut breakpoint_lines = vec ! ( ) ;
795
773
let mut commands = vec ! ( ) ;
796
774
let mut check_lines = vec ! ( ) ;
797
- let mut use_gdb_pretty_printer = false ;
798
775
let mut counter = 1 ;
799
776
let mut reader = BufferedReader :: new ( File :: open ( file_path) . unwrap ( ) ) ;
800
777
for line in reader. lines ( ) {
@@ -804,10 +781,6 @@ fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str)
804
781
breakpoint_lines. push ( counter) ;
805
782
}
806
783
807
- if line. as_slice ( ) . contains ( "gdb-use-pretty-printer" ) {
808
- use_gdb_pretty_printer = true ;
809
- }
810
-
811
784
header:: parse_name_value_directive (
812
785
line. as_slice ( ) ,
813
786
command_directive. as_slice ( ) ) . map ( |cmd| {
@@ -832,7 +805,6 @@ fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str)
832
805
commands : commands,
833
806
check_lines : check_lines,
834
807
breakpoint_lines : breakpoint_lines,
835
- use_gdb_pretty_printer : use_gdb_pretty_printer,
836
808
}
837
809
}
838
810
@@ -976,8 +948,7 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
976
948
proc_res : & ProcRes ) {
977
949
978
950
// 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 ( ) ;
981
952
982
953
if proc_res. status . success ( ) {
983
954
fatal ( "process did not return an error status" ) ;
@@ -1337,7 +1308,7 @@ fn make_run_args(config: &Config, props: &TestProps, testfile: &Path) ->
1337
1308
// Add the arguments in the run_flags directive
1338
1309
args. extend ( split_maybe_args ( & props. run_flags ) . into_iter ( ) ) ;
1339
1310
1340
- let prog = args. remove ( 0 ) . unwrap ( ) ;
1311
+ let prog = args. remove ( 0 ) ;
1341
1312
return ProcArgs {
1342
1313
prog : prog,
1343
1314
args : args,
0 commit comments