@@ -323,12 +323,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
323
323
} ;
324
324
325
325
let config = & mut config;
326
- let DebuggerCommands {
327
- commands,
328
- check_lines,
329
- use_gdb_pretty_printer,
330
- ..
331
- } = parse_debugger_commands ( testfile, "gdb" ) ;
326
+ let DebuggerCommands { commands, check_lines, .. } = parse_debugger_commands ( testfile, "gdb" ) ;
332
327
let mut cmds = commands. connect ( "\n " ) ;
333
328
334
329
// compile test file (it should have 'compile-flags:-g' in the header)
@@ -339,6 +334,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
339
334
340
335
let exe_file = make_exe_name ( config, testfile) ;
341
336
337
+ let mut proc_args;
342
338
let debugger_run_result;
343
339
match config. target . as_slice ( ) {
344
340
"arm-linux-androideabi" => {
@@ -458,65 +454,18 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
458
454
}
459
455
460
456
_=> {
461
- let rust_src_root = find_rust_src_root ( config)
462
- . expect ( "Could not find Rust source root" ) ;
463
- let rust_pp_module_rel_path = Path :: new ( "./src/etc" ) ;
464
- let rust_pp_module_abs_path = rust_src_root. join ( rust_pp_module_rel_path)
465
- . as_str ( )
466
- . unwrap ( )
467
- . to_string ( ) ;
468
457
// write debugger script
469
- let mut script_str = String :: with_capacity ( 2048 ) ;
470
-
471
- script_str. push_str ( "set charset UTF-8\n " ) ;
472
- script_str. push_str ( "show version\n " ) ;
473
-
474
- match config. gdb_version {
475
- Some ( ref version) => {
476
- println ! ( "NOTE: compiletest thinks it is using GDB version {}" ,
477
- version. as_slice( ) ) ;
478
-
479
- if header:: gdb_version_to_int ( version. as_slice ( ) ) >
480
- header:: gdb_version_to_int ( "7.4" ) {
481
- // Add the directory containing the pretty printers to
482
- // GDB's script auto loading safe path ...
483
- script_str. push_str (
484
- format ! ( "add-auto-load-safe-path {}\n " ,
485
- rust_pp_module_abs_path. as_slice( ) )
486
- . as_slice ( ) ) ;
487
- // ... and also the test directory
488
- script_str. push_str (
489
- format ! ( "add-auto-load-safe-path {}\n " ,
490
- config. build_base. as_str( ) . unwrap( ) )
491
- . as_slice ( ) ) ;
492
- }
493
- }
494
- _ => {
495
- println ! ( "NOTE: compiletest does not know which version of \
496
- GDB it is using") ;
497
- }
498
- }
499
-
500
- // Load the target executable
501
- script_str. push_str ( format ! ( "file {}\n " ,
502
- exe_file. as_str( ) . unwrap( ) )
503
- . as_slice ( ) ) ;
504
-
505
- script_str. push_str ( cmds. as_slice ( ) ) ;
506
- script_str. push_str ( "quit\n " ) ;
507
-
458
+ let script_str = [
459
+ "set charset UTF-8" . to_string ( ) ,
460
+ cmds,
461
+ "quit\n " . to_string ( )
462
+ ] . connect ( "\n " ) ;
508
463
debug ! ( "script_str = {}" , script_str) ;
509
464
dump_output_file ( config,
510
465
testfile,
511
466
script_str. as_slice ( ) ,
512
467
"debugger.script" ) ;
513
468
514
- if use_gdb_pretty_printer {
515
- // Only emit the gdb auto-loading script if pretty printers
516
- // should actually be loaded
517
- dump_gdb_autoload_script ( config, testfile) ;
518
- }
519
-
520
469
// run debugger script with gdb
521
470
#[ cfg( windows) ]
522
471
fn debugger ( ) -> String {
@@ -534,19 +483,16 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
534
483
vec ! ( "-quiet" . to_string( ) ,
535
484
"-batch" . to_string( ) ,
536
485
"-nx" . to_string( ) ,
537
- format!( "-command={}" , debugger_script. as_str( ) . unwrap( ) ) ) ;
538
-
539
- let proc_args = ProcArgs {
486
+ format!( "-command={}" , debugger_script. as_str( ) . unwrap( ) ) ,
487
+ exe_file . as_str ( ) . unwrap ( ) . to_string ( ) ) ;
488
+ proc_args = ProcArgs {
540
489
prog : debugger ( ) ,
541
490
args : debugger_opts,
542
491
} ;
543
-
544
- let environment = vec ! [ ( "PYTHONPATH" . to_string( ) , rust_pp_module_abs_path) ] ;
545
-
546
492
debugger_run_result = compose_and_run ( config,
547
493
testfile,
548
494
proc_args,
549
- environment ,
495
+ Vec :: new ( ) ,
550
496
config. run_lib_path . as_slice ( ) ,
551
497
None ,
552
498
None ) ;
@@ -558,32 +504,6 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
558
504
}
559
505
560
506
check_debugger_output ( & debugger_run_result, check_lines. as_slice ( ) ) ;
561
-
562
- fn dump_gdb_autoload_script ( config : & Config , testfile : & Path ) {
563
- let mut script_path = output_base_name ( config, testfile) ;
564
- let mut script_file_name = script_path. filename ( ) . unwrap ( ) . to_vec ( ) ;
565
- script_file_name. push_all ( "-gdb.py" . as_bytes ( ) ) ;
566
- script_path. set_filename ( script_file_name. as_slice ( ) ) ;
567
-
568
- let script_content = "import gdb_rust_pretty_printing\n \
569
- gdb_rust_pretty_printing.register_printers(gdb.current_objfile())\n "
570
- . as_bytes ( ) ;
571
-
572
- File :: create ( & script_path) . write ( script_content) . unwrap ( ) ;
573
- }
574
- }
575
-
576
- fn find_rust_src_root ( config : & Config ) -> Option < Path > {
577
- let mut path = config. src_base . clone ( ) ;
578
- let path_postfix = Path :: new ( "src/etc/lldb_batchmode.py" ) ;
579
-
580
- while path. pop ( ) {
581
- if path. join ( path_postfix. clone ( ) ) . is_file ( ) {
582
- return Some ( path) ;
583
- }
584
- }
585
-
586
- return None ;
587
507
}
588
508
589
509
fn run_debuginfo_lldb_test ( config : & Config , props : & TestProps , testfile : & Path ) {
@@ -613,8 +533,7 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
613
533
let DebuggerCommands {
614
534
commands,
615
535
check_lines,
616
- breakpoint_lines,
617
- ..
536
+ breakpoint_lines
618
537
} = parse_debugger_commands ( testfile, "lldb" ) ;
619
538
620
539
// Write debugger script:
@@ -700,7 +619,6 @@ struct DebuggerCommands {
700
619
commands : Vec < String > ,
701
620
check_lines : Vec < String > ,
702
621
breakpoint_lines : Vec < uint > ,
703
- use_gdb_pretty_printer : bool
704
622
}
705
623
706
624
fn parse_debugger_commands ( file_path : & Path , debugger_prefix : & str )
@@ -713,7 +631,6 @@ fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str)
713
631
let mut breakpoint_lines = vec ! ( ) ;
714
632
let mut commands = vec ! ( ) ;
715
633
let mut check_lines = vec ! ( ) ;
716
- let mut use_gdb_pretty_printer = false ;
717
634
let mut counter = 1 ;
718
635
let mut reader = BufferedReader :: new ( File :: open ( file_path) . unwrap ( ) ) ;
719
636
for line in reader. lines ( ) {
@@ -723,10 +640,6 @@ fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str)
723
640
breakpoint_lines. push ( counter) ;
724
641
}
725
642
726
- if line. as_slice ( ) . contains ( "gdb-use-pretty-printer" ) {
727
- use_gdb_pretty_printer = true ;
728
- }
729
-
730
643
header:: parse_name_value_directive (
731
644
line. as_slice ( ) ,
732
645
command_directive. as_slice ( ) ) . map ( |cmd| {
@@ -750,8 +663,7 @@ fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str)
750
663
DebuggerCommands {
751
664
commands : commands,
752
665
check_lines : check_lines,
753
- breakpoint_lines : breakpoint_lines,
754
- use_gdb_pretty_printer : use_gdb_pretty_printer,
666
+ breakpoint_lines : breakpoint_lines
755
667
}
756
668
}
757
669
0 commit comments