Skip to content

Commit c6c14e2

Browse files
---
yaml --- r: 128510 b: refs/heads/try c: b3c6ed5 h: refs/heads/master v: v3
1 parent b8be123 commit c6c14e2

File tree

6 files changed

+67
-15
lines changed

6 files changed

+67
-15
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: b22e840d43ec8d0de0b95f26a76046cfcca93c22
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a86d9ad15e339ab343a12513f9c90556f677b9ca
5-
refs/heads/try: 23736239da3cc267f754a28dbc7605f4075557bd
5+
refs/heads/try: b3c6ed5c9bd0dee175a6f63b4f19ce399291241d
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/configure

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,14 @@ probe CFG_LUALATEX lualatex
509509
probe CFG_GDB gdb
510510
probe CFG_LLDB lldb
511511

512+
if [ ! -z "$CFG_GDB" ]
513+
then
514+
# Extract the version
515+
CFG_GDB_VERSION=$($CFG_GDB --version 2>/dev/null | head -1 \
516+
| sed -e 's/.*\([0-9]\+\.[0-9]\+$\)/\1/' )
517+
putvar CFG_GDB_VERSION
518+
fi
519+
512520
if [ ! -z "$CFG_LLDB" ]
513521
then
514522
# If CFG_LLDB_PYTHON_DIR is not already set from the outside and valid, try to read it from

branches/try/mk/tests.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,7 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
623623
--stage-id stage$(1)-$(2) \
624624
--target $(2) \
625625
--host $(3) \
626+
--gdb-version=$(CFG_GDB_VERSION) \
626627
--android-cross-path=$(CFG_ANDROID_CROSS_PATH) \
627628
--adb-path=$(CFG_ADB) \
628629
--adb-test-dir=$(CFG_ADB_TEST_DIR) \

branches/try/src/compiletest/common.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ pub struct Config {
130130
// Host triple for the compiler being invoked
131131
pub host: String,
132132

133+
// Version of GDB
134+
pub gdb_version: Option<String>,
135+
133136
// Path to the android tools
134137
pub android_cross_path: Path,
135138

branches/try/src/compiletest/compiletest.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
8181
optflag("", "jit", "run tests under the JIT"),
8282
optopt("", "target", "the target to build for", "TARGET"),
8383
optopt("", "host", "the host to build for", "HOST"),
84+
optopt("", "gdb-version", "the version of GDB used", "MAJOR.MINOR"),
8485
optopt("", "android-cross-path", "Android NDK standalone path", "PATH"),
8586
optopt("", "adb-path", "path to the android debugger", "PATH"),
8687
optopt("", "adb-test-dir", "path to tests for the android debugger", "PATH"),
@@ -157,6 +158,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
157158
jit: matches.opt_present("jit"),
158159
target: opt_str2(matches.opt_str("target")),
159160
host: opt_str2(matches.opt_str("host")),
161+
gdb_version: matches.opt_str("gdb-version"),
160162
android_cross_path: opt_path(matches, "android-cross-path"),
161163
adb_path: opt_str2(matches.opt_str("adb-path")),
162164
adb_test_dir: opt_str2(matches.opt_str("adb-test-dir")),

branches/try/src/compiletest/runtest.rs

Lines changed: 52 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use util::logv;
1919
#[cfg(target_os = "win32")]
2020
use util;
2121

22+
use std::from_str::FromStr;
2223
use std::io::File;
2324
use std::io::fs;
2425
use std::io::net::tcp;
@@ -315,6 +316,7 @@ actual:\n\
315316
}
316317

317318
fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
319+
318320
let mut config = Config {
319321
target_rustcflags: cleanup_debug_info_options(&config.target_rustcflags),
320322
host_rustcflags: cleanup_debug_info_options(&config.host_rustcflags),
@@ -465,11 +467,38 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
465467
.unwrap()
466468
.to_string();
467469
// write debugger script
468-
let script_str = [
469-
"set charset UTF-8".to_string(),
470-
cmds,
471-
"quit\n".to_string()
472-
].connect("\n");
470+
let mut script_str = String::with_capacity(2048);
471+
472+
script_str.push_str("set charset UTF-8\n");
473+
script_str.push_str("show version\n");
474+
475+
match config.gdb_version {
476+
Some(ref version) => {
477+
if gdb_version_to_int(version.as_slice()) > gdb_version_to_int("7.3") {
478+
// Add the directory containing the pretty printers to
479+
// GDB's script auto loading safe path ...
480+
script_str.push_str(
481+
format!("add-auto-load-safe-path {}\n",
482+
rust_pp_module_abs_path.as_slice())
483+
.as_slice());
484+
// ... and also the test directory
485+
script_str.push_str(
486+
format!("add-auto-load-safe-path {}\n",
487+
config.build_base.as_str().unwrap())
488+
.as_slice());
489+
}
490+
}
491+
_ => { /* nothing to do */ }
492+
}
493+
494+
// Load the target executable
495+
script_str.push_str(format!("file {}\n",
496+
exe_file.as_str().unwrap())
497+
.as_slice());
498+
499+
script_str.push_str(cmds.as_slice());
500+
script_str.push_str("quit\n");
501+
473502
debug!("script_str = {}", script_str);
474503
dump_output_file(config,
475504
testfile,
@@ -499,15 +528,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
499528
vec!("-quiet".to_string(),
500529
"-batch".to_string(),
501530
"-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()),
509-
format!("-command={}", debugger_script.as_str().unwrap()),
510-
exe_file.as_str().unwrap().to_string());
531+
format!("-command={}", debugger_script.as_str().unwrap()));
511532

512533
let proc_args = ProcArgs {
513534
prog: debugger(),
@@ -544,6 +565,23 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
544565

545566
File::create(&script_path).write(script_content).unwrap();
546567
}
568+
569+
fn gdb_version_to_int(version_string: &str) -> int {
570+
let error_string = format!(
571+
"Encountered GDB version string with unexpected format: {}",
572+
version_string);
573+
574+
let components: Vec<&str> = version_string.trim().split('.').collect();
575+
576+
if components.len() != 2 {
577+
fatal(error_string.as_slice());
578+
}
579+
580+
let major: int = FromStr::from_str(components[0]).expect(error_string.as_slice());
581+
let minor: int = FromStr::from_str(components[1]).expect(error_string.as_slice());
582+
583+
return major * 1000 + minor;
584+
}
547585
}
548586

549587
fn find_rust_src_root(config: &Config) -> Option<Path> {

0 commit comments

Comments
 (0)