Skip to content

Commit 6eb4f81

Browse files
---
yaml --- r: 154687 b: refs/heads/try2 c: ee25b6b h: refs/heads/master i: 154685: 10f18ac 154683: 3519171 154679: 698ef99 154671: 9ab4d68 154655: 169e6f9 154623: 960db48 v: v3
1 parent a899733 commit 6eb4f81

File tree

400 files changed

+5333
-9867
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

400 files changed

+5333
-9867
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 5419b2ca2c27b4745fa1f2773719350420542c76
8+
refs/heads/try2: ee25b6bdebf3bd079d4129470c31b803c21bdedc
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/mk/crates.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ DEPS_test := std getopts serialize rbml term time regex native:rust_test_helpers
9696
DEPS_time := std serialize
9797
DEPS_rand := core
9898
DEPS_url := std
99-
DEPS_log := std regex
99+
DEPS_log := std
100100
DEPS_regex := std
101101
DEPS_regex_macros = rustc syntax std regex
102102
DEPS_fmt_macros = std

branches/try2/src/compiletest/procsrv.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub fn run(lib_path: &str,
4747
match cmd.spawn() {
4848
Ok(mut process) => {
4949
for input in input.iter() {
50-
process.stdin.as_mut().unwrap().write(input.as_bytes()).unwrap();
50+
process.stdin.get_mut_ref().write(input.as_bytes()).unwrap();
5151
}
5252
let ProcessOutput { status, output, error } =
5353
process.wait_with_output().unwrap();
@@ -79,7 +79,7 @@ pub fn run_background(lib_path: &str,
7979
match cmd.spawn() {
8080
Ok(mut process) => {
8181
for input in input.iter() {
82-
process.stdin.as_mut().unwrap().write(input.as_bytes()).unwrap();
82+
process.stdin.get_mut_ref().write(input.as_bytes()).unwrap();
8383
}
8484

8585
Some(process)

branches/try2/src/compiletest/runtest.rs

Lines changed: 70 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,12 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
323323
};
324324

325325
let config = &mut config;
326-
let DebuggerCommands { commands, check_lines, .. } = parse_debugger_commands(testfile, "gdb");
326+
let DebuggerCommands {
327+
commands,
328+
check_lines,
329+
use_gdb_pretty_printer,
330+
..
331+
} = parse_debugger_commands(testfile, "gdb");
327332
let mut cmds = commands.connect("\n");
328333

329334
// compile test file (it should have 'compile-flags:-g' in the header)
@@ -334,7 +339,6 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
334339

335340
let exe_file = make_exe_name(config, testfile);
336341

337-
let mut proc_args;
338342
let debugger_run_result;
339343
match config.target.as_slice() {
340344
"arm-linux-androideabi" => {
@@ -454,6 +458,12 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
454458
}
455459

456460
_=> {
461+
let rust_src_root = find_rust_src_root(config).expect("Could not find Rust source root");
462+
let rust_pp_module_rel_path = Path::new("./src/etc");
463+
let rust_pp_module_abs_path = rust_src_root.join(rust_pp_module_rel_path)
464+
.as_str()
465+
.unwrap()
466+
.to_string();
457467
// write debugger script
458468
let script_str = [
459469
"set charset UTF-8".to_string(),
@@ -466,6 +476,12 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
466476
script_str.as_slice(),
467477
"debugger.script");
468478

479+
if use_gdb_pretty_printer {
480+
// Only emit the gdb auto-loading script if pretty printers
481+
// should actually be loaded
482+
dump_gdb_autoload_script(config, testfile);
483+
}
484+
469485
// run debugger script with gdb
470486
#[cfg(windows)]
471487
fn debugger() -> String {
@@ -483,16 +499,27 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
483499
vec!("-quiet".to_string(),
484500
"-batch".to_string(),
485501
"-nx".to_string(),
502+
// Add the directory containing the pretty printers to
503+
// GDB's script auto loading safe path ...
504+
format!("-iex=add-auto-load-safe-path {}",
505+
rust_pp_module_abs_path.as_slice()),
506+
// ... and also the test directory
507+
format!("-iex=add-auto-load-safe-path {}",
508+
config.build_base.as_str().unwrap()),
486509
format!("-command={}", debugger_script.as_str().unwrap()),
487510
exe_file.as_str().unwrap().to_string());
488-
proc_args = ProcArgs {
511+
512+
let proc_args = ProcArgs {
489513
prog: debugger(),
490514
args: debugger_opts,
491515
};
516+
517+
let environment = vec![("PYTHONPATH".to_string(), rust_pp_module_abs_path)];
518+
492519
debugger_run_result = compose_and_run(config,
493520
testfile,
494521
proc_args,
495-
Vec::new(),
522+
environment,
496523
config.run_lib_path.as_slice(),
497524
None,
498525
None);
@@ -504,6 +531,32 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
504531
}
505532

506533
check_debugger_output(&debugger_run_result, check_lines.as_slice());
534+
535+
fn dump_gdb_autoload_script(config: &Config, testfile: &Path) {
536+
let mut script_path = output_base_name(config, testfile);
537+
let mut script_file_name = script_path.filename().unwrap().to_vec();
538+
script_file_name.push_all("-gdb.py".as_bytes());
539+
script_path.set_filename(script_file_name.as_slice());
540+
541+
let script_content = "import gdb_rust_pretty_printing\n\
542+
gdb_rust_pretty_printing.register_printers(gdb.current_objfile())\n"
543+
.as_bytes();
544+
545+
File::create(&script_path).write(script_content).unwrap();
546+
}
547+
}
548+
549+
fn find_rust_src_root(config: &Config) -> Option<Path> {
550+
let mut path = config.src_base.clone();
551+
let path_postfix = Path::new("src/etc/lldb_batchmode.py");
552+
553+
while path.pop() {
554+
if path.join(path_postfix.clone()).is_file() {
555+
return Some(path);
556+
}
557+
}
558+
559+
return None;
507560
}
508561

509562
fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path) {
@@ -533,7 +586,8 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
533586
let DebuggerCommands {
534587
commands,
535588
check_lines,
536-
breakpoint_lines
589+
breakpoint_lines,
590+
..
537591
} = parse_debugger_commands(testfile, "lldb");
538592

539593
// Write debugger script:
@@ -619,6 +673,7 @@ struct DebuggerCommands {
619673
commands: Vec<String>,
620674
check_lines: Vec<String>,
621675
breakpoint_lines: Vec<uint>,
676+
use_gdb_pretty_printer: bool
622677
}
623678

624679
fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str)
@@ -631,6 +686,7 @@ fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str)
631686
let mut breakpoint_lines = vec!();
632687
let mut commands = vec!();
633688
let mut check_lines = vec!();
689+
let mut use_gdb_pretty_printer = false;
634690
let mut counter = 1;
635691
let mut reader = BufferedReader::new(File::open(file_path).unwrap());
636692
for line in reader.lines() {
@@ -640,6 +696,10 @@ fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str)
640696
breakpoint_lines.push(counter);
641697
}
642698

699+
if line.as_slice().contains("gdb-use-pretty-printer") {
700+
use_gdb_pretty_printer = true;
701+
}
702+
643703
header::parse_name_value_directive(
644704
line.as_slice(),
645705
command_directive.as_slice()).map(|cmd| {
@@ -663,7 +723,8 @@ fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str)
663723
DebuggerCommands {
664724
commands: commands,
665725
check_lines: check_lines,
666-
breakpoint_lines: breakpoint_lines
726+
breakpoint_lines: breakpoint_lines,
727+
use_gdb_pretty_printer: use_gdb_pretty_printer,
667728
}
668729
}
669730

@@ -1526,7 +1587,7 @@ fn compile_cc_with_clang_and_save_bitcode(config: &Config, _props: &TestProps,
15261587
let testcc = testfile.with_extension("cc");
15271588
let proc_args = ProcArgs {
15281589
// FIXME (#9639): This needs to handle non-utf8 paths
1529-
prog: config.clang_path.as_ref().unwrap().as_str().unwrap().to_string(),
1590+
prog: config.clang_path.get_ref().as_str().unwrap().to_string(),
15301591
args: vec!("-c".to_string(),
15311592
"-emit-llvm".to_string(),
15321593
"-o".to_string(),
@@ -1542,7 +1603,7 @@ fn extract_function_from_bitcode(config: &Config, _props: &TestProps,
15421603
let bitcodefile = output_base_name(config, testfile).with_extension("bc");
15431604
let bitcodefile = append_suffix_to_stem(&bitcodefile, suffix);
15441605
let extracted_bc = append_suffix_to_stem(&bitcodefile, "extract");
1545-
let prog = config.llvm_bin_path.as_ref().unwrap().join("llvm-extract");
1606+
let prog = config.llvm_bin_path.get_ref().join("llvm-extract");
15461607
let proc_args = ProcArgs {
15471608
// FIXME (#9639): This needs to handle non-utf8 paths
15481609
prog: prog.as_str().unwrap().to_string(),
@@ -1559,7 +1620,7 @@ fn disassemble_extract(config: &Config, _props: &TestProps,
15591620
let bitcodefile = append_suffix_to_stem(&bitcodefile, suffix);
15601621
let extracted_bc = append_suffix_to_stem(&bitcodefile, "extract");
15611622
let extracted_ll = extracted_bc.with_extension("ll");
1562-
let prog = config.llvm_bin_path.as_ref().unwrap().join("llvm-dis");
1623+
let prog = config.llvm_bin_path.get_ref().join("llvm-dis");
15631624
let proc_args = ProcArgs {
15641625
// FIXME (#9639): This needs to handle non-utf8 paths
15651626
prog: prog.as_str().unwrap().to_string(),

branches/try2/src/doc/guide-ffi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ extern crate libc;
477477

478478
#[cfg(target_os = "win32", target_arch = "x86")]
479479
#[link(name = "kernel32")]
480-
#[allow(non_snake_case)]
480+
#[allow(non_snake_case_functions)]
481481
extern "stdcall" {
482482
fn SetEnvironmentVariableA(n: *const u8, v: *const u8) -> libc::c_int;
483483
}

0 commit comments

Comments
 (0)