Skip to content

Commit 18ee04b

Browse files
committed
Merge branch 'gdb-next-gen' of https://github.com/TimNN/rust into rollup
2 parents 11251e5 + d2cb515 commit 18ee04b

File tree

77 files changed

+1235
-614
lines changed

Some content is hidden

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

77 files changed

+1235
-614
lines changed

configure

-7
Original file line numberDiff line numberDiff line change
@@ -868,13 +868,6 @@ then
868868
fi
869869
fi
870870

871-
if [ -n "$CFG_GDB" ]
872-
then
873-
# Store GDB's version
874-
CFG_GDB_VERSION=$($CFG_GDB --version 2>/dev/null | head -1)
875-
putvar CFG_GDB_VERSION
876-
fi
877-
878871
if [ -n "$CFG_LLDB" ]
879872
then
880873
# Store LLDB's version

mk/tests.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) = \
648648
--host $(3) \
649649
--docck-python $$(CFG_PYTHON) \
650650
--lldb-python $$(CFG_LLDB_PYTHON) \
651-
--gdb-version="$(CFG_GDB_VERSION)" \
651+
--gdb="$(CFG_GDB)" \
652652
--lldb-version="$(CFG_LLDB_VERSION)" \
653653
--llvm-version="$$(LLVM_VERSION_$(3))" \
654654
--android-cross-path=$(CFG_ARM_LINUX_ANDROIDEABI_NDK) \

src/bootstrap/check.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ pub fn compiletest(build: &Build,
143143
cmd.arg("--lldb-python").arg(python_default);
144144
}
145145

146-
if let Some(ref vers) = build.gdb_version {
147-
cmd.arg("--gdb-version").arg(vers);
146+
if let Some(ref gdb) = build.config.gdb {
147+
cmd.arg("--gdb").arg(gdb);
148148
}
149149
if let Some(ref vers) = build.lldb_version {
150150
cmd.arg("--lldb-version").arg(vers);

src/bootstrap/config.rs

+23-15
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use std::process;
2323
use num_cpus;
2424
use rustc_serialize::Decodable;
2525
use toml::{Parser, Decoder, Value};
26+
use util::push_exe_path;
2627

2728
/// Global configuration for the entire build and/or bootstrap.
2829
///
@@ -86,6 +87,7 @@ pub struct Config {
8687
pub mandir: Option<String>,
8788
pub codegen_tests: bool,
8889
pub nodejs: Option<PathBuf>,
90+
pub gdb: Option<PathBuf>,
8991
}
9092

9193
/// Per-target configuration stored in the global configuration structure.
@@ -123,6 +125,7 @@ struct Build {
123125
compiler_docs: Option<bool>,
124126
docs: Option<bool>,
125127
submodules: Option<bool>,
128+
gdb: Option<String>,
126129
}
127130

128131
/// TOML representation of how the LLVM build is configured.
@@ -227,6 +230,7 @@ impl Config {
227230
}
228231
config.rustc = build.rustc.map(PathBuf::from);
229232
config.cargo = build.cargo.map(PathBuf::from);
233+
config.gdb = build.gdb.map(PathBuf::from);
230234
set(&mut config.compiler_docs, build.compiler_docs);
231235
set(&mut config.docs, build.docs);
232236
set(&mut config.submodules, build.submodules);
@@ -356,44 +360,47 @@ impl Config {
356360
.collect();
357361
}
358362
"CFG_MUSL_ROOT" if value.len() > 0 => {
359-
self.musl_root = Some(PathBuf::from(value));
363+
self.musl_root = Some(parse_configure_path(value));
360364
}
361365
"CFG_MUSL_ROOT_X86_64" if value.len() > 0 => {
362366
let target = "x86_64-unknown-linux-musl".to_string();
363367
let target = self.target_config.entry(target)
364368
.or_insert(Target::default());
365-
target.musl_root = Some(PathBuf::from(value));
369+
target.musl_root = Some(parse_configure_path(value));
366370
}
367371
"CFG_MUSL_ROOT_I686" if value.len() > 0 => {
368372
let target = "i686-unknown-linux-musl".to_string();
369373
let target = self.target_config.entry(target)
370374
.or_insert(Target::default());
371-
target.musl_root = Some(PathBuf::from(value));
375+
target.musl_root = Some(parse_configure_path(value));
372376
}
373377
"CFG_MUSL_ROOT_ARM" if value.len() > 0 => {
374378
let target = "arm-unknown-linux-musleabi".to_string();
375379
let target = self.target_config.entry(target)
376380
.or_insert(Target::default());
377-
target.musl_root = Some(PathBuf::from(value));
381+
target.musl_root = Some(parse_configure_path(value));
378382
}
379383
"CFG_MUSL_ROOT_ARMHF" if value.len() > 0 => {
380384
let target = "arm-unknown-linux-musleabihf".to_string();
381385
let target = self.target_config.entry(target)
382386
.or_insert(Target::default());
383-
target.musl_root = Some(PathBuf::from(value));
387+
target.musl_root = Some(parse_configure_path(value));
384388
}
385389
"CFG_MUSL_ROOT_ARMV7" if value.len() > 0 => {
386390
let target = "armv7-unknown-linux-musleabihf".to_string();
387391
let target = self.target_config.entry(target)
388392
.or_insert(Target::default());
389-
target.musl_root = Some(PathBuf::from(value));
393+
target.musl_root = Some(parse_configure_path(value));
390394
}
391395
"CFG_DEFAULT_AR" if value.len() > 0 => {
392396
self.rustc_default_ar = Some(value.to_string());
393397
}
394398
"CFG_DEFAULT_LINKER" if value.len() > 0 => {
395399
self.rustc_default_linker = Some(value.to_string());
396400
}
401+
"CFG_GDB" if value.len() > 0 => {
402+
self.gdb = Some(parse_configure_path(value));
403+
}
397404
"CFG_RELEASE_CHANNEL" => {
398405
self.channel = value.to_string();
399406
}
@@ -412,41 +419,42 @@ impl Config {
412419
"CFG_LLVM_ROOT" if value.len() > 0 => {
413420
let target = self.target_config.entry(self.build.clone())
414421
.or_insert(Target::default());
415-
let root = PathBuf::from(value);
416-
target.llvm_config = Some(root.join("bin/llvm-config"));
422+
let root = parse_configure_path(value);
423+
target.llvm_config = Some(push_exe_path(root, &["bin", "llvm-config"]));
417424
}
418425
"CFG_JEMALLOC_ROOT" if value.len() > 0 => {
419426
let target = self.target_config.entry(self.build.clone())
420427
.or_insert(Target::default());
421-
target.jemalloc = Some(PathBuf::from(value));
428+
target.jemalloc = Some(parse_configure_path(value));
422429
}
423430
"CFG_ARM_LINUX_ANDROIDEABI_NDK" if value.len() > 0 => {
424431
let target = "arm-linux-androideabi".to_string();
425432
let target = self.target_config.entry(target)
426433
.or_insert(Target::default());
427-
target.ndk = Some(PathBuf::from(value));
434+
target.ndk = Some(parse_configure_path(value));
428435
}
429436
"CFG_ARMV7_LINUX_ANDROIDEABI_NDK" if value.len() > 0 => {
430437
let target = "armv7-linux-androideabi".to_string();
431438
let target = self.target_config.entry(target)
432439
.or_insert(Target::default());
433-
target.ndk = Some(PathBuf::from(value));
440+
target.ndk = Some(parse_configure_path(value));
434441
}
435442
"CFG_I686_LINUX_ANDROID_NDK" if value.len() > 0 => {
436443
let target = "i686-linux-android".to_string();
437444
let target = self.target_config.entry(target)
438445
.or_insert(Target::default());
439-
target.ndk = Some(PathBuf::from(value));
446+
target.ndk = Some(parse_configure_path(value));
440447
}
441448
"CFG_AARCH64_LINUX_ANDROID_NDK" if value.len() > 0 => {
442449
let target = "aarch64-linux-android".to_string();
443450
let target = self.target_config.entry(target)
444451
.or_insert(Target::default());
445-
target.ndk = Some(PathBuf::from(value));
452+
target.ndk = Some(parse_configure_path(value));
446453
}
447454
"CFG_LOCAL_RUST_ROOT" if value.len() > 0 => {
448-
self.rustc = Some(PathBuf::from(value).join("bin/rustc"));
449-
self.cargo = Some(PathBuf::from(value).join("bin/cargo"));
455+
let path = parse_configure_path(value);
456+
self.rustc = Some(push_exe_path(path.clone(), &["bin", "rustc"]));
457+
self.cargo = Some(push_exe_path(path, &["bin", "cargo"]));
450458
}
451459
_ => {}
452460
}

src/bootstrap/config.toml.example

+3
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@
7979
# Indicate whether submodules are managed and updated automatically.
8080
#submodules = true
8181

82+
# The path to (or name of) the GDB executable to use
83+
#gdb = "gdb"
84+
8285
# =============================================================================
8386
# Options for compiling Rust code itself
8487
# =============================================================================

src/bootstrap/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ pub struct Build {
124124
bootstrap_key_stage0: String,
125125

126126
// Probed tools at runtime
127-
gdb_version: Option<String>,
128127
lldb_version: Option<String>,
129128
lldb_python_dir: Option<String>,
130129

@@ -211,7 +210,6 @@ impl Build {
211210
cc: HashMap::new(),
212211
cxx: HashMap::new(),
213212
crates: HashMap::new(),
214-
gdb_version: None,
215213
lldb_version: None,
216214
lldb_python_dir: None,
217215
}

src/bootstrap/sanity.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ pub fn check(build: &mut Build) {
9292
need_cmd(s.as_ref());
9393
}
9494

95+
if let Some(ref gdb) = build.config.gdb {
96+
need_cmd(gdb.as_ref());
97+
} else {
98+
build.config.gdb = have_cmd("gdb".as_ref());
99+
}
100+
95101
// We're gonna build some custom C code here and there, host triples
96102
// also build some C++ shims for LLVM so we need a C++ compiler.
97103
for target in build.config.target.iter() {
@@ -198,7 +204,6 @@ $ pacman -R cmake && pacman -S mingw-w64-x86_64-cmake
198204
.to_string()
199205
})
200206
};
201-
build.gdb_version = run(Command::new("gdb").arg("--version")).ok();
202207
build.lldb_version = run(Command::new("lldb").arg("--version")).ok();
203208
if build.lldb_version.is_some() {
204209
build.lldb_python_dir = run(Command::new("lldb").arg("-P")).ok();

src/bootstrap/util.rs

+18
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,21 @@ pub fn dylib_path() -> Vec<PathBuf> {
171171
env::split_paths(&env::var_os(dylib_path_var()).unwrap_or(OsString::new()))
172172
.collect()
173173
}
174+
175+
/// `push` all components to `buf`. On windows, append `.exe` to the last component.
176+
pub fn push_exe_path(mut buf: PathBuf, components: &[&str]) -> PathBuf {
177+
let (&file, components) = components.split_last().expect("at least one component required");
178+
let mut file = file.to_owned();
179+
180+
if cfg!(windows) {
181+
file.push_str(".exe");
182+
}
183+
184+
for c in components {
185+
buf.push(c);
186+
}
187+
188+
buf.push(file);
189+
190+
buf
191+
}

src/test/debuginfo/associated-types.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
// gdb-command:run
1717

1818
// gdb-command:print arg
19-
// gdb-check:$1 = {b = -1, b1 = 0}
19+
// gdbg-check:$1 = {b = -1, b1 = 0}
20+
// gdbr-check:$1 = associated_types::Struct<i32> {b: -1, b1: 0}
2021
// gdb-command:continue
2122

2223
// gdb-command:print inferred
@@ -30,7 +31,8 @@
3031
// gdb-command:continue
3132

3233
// gdb-command:print arg
33-
// gdb-check:$5 = {__0 = 4, __1 = 5}
34+
// gdbg-check:$5 = {__0 = 4, __1 = 5}
35+
// gdbr-check:$5 = (4, 5)
3436
// gdb-command:continue
3537

3638
// gdb-command:print a

src/test/debuginfo/basic-types-globals-metadata.rs

+28-14
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,47 @@
1212

1313
// compile-flags:-g
1414
// gdb-command:run
15-
// gdb-command:whatis 'basic_types_globals_metadata::B'
15+
// gdbg-command:whatis 'basic_types_globals_metadata::B'
16+
// gdbr-command:whatis basic_types_globals_metadata::B
1617
// gdb-check:type = bool
17-
// gdb-command:whatis 'basic_types_globals_metadata::I'
18+
// gdbg-command:whatis 'basic_types_globals_metadata::I'
19+
// gdbr-command:whatis basic_types_globals_metadata::I
1820
// gdb-check:type = isize
19-
// gdb-command:whatis 'basic_types_globals_metadata::C'
21+
// gdbg-command:whatis 'basic_types_globals_metadata::C'
22+
// gdbr-command:whatis basic_types_globals_metadata::C
2023
// gdb-check:type = char
21-
// gdb-command:whatis 'basic_types_globals_metadata::I8'
24+
// gdbg-command:whatis 'basic_types_globals_metadata::I8'
25+
// gdbr-command:whatis basic_types_globals_metadata::I8
2226
// gdb-check:type = i8
23-
// gdb-command:whatis 'basic_types_globals_metadata::I16'
27+
// gdbg-command:whatis 'basic_types_globals_metadata::I16'
28+
// gdbr-command:whatis basic_types_globals_metadata::I16
2429
// gdb-check:type = i16
25-
// gdb-command:whatis 'basic_types_globals_metadata::I32'
30+
// gdbg-command:whatis 'basic_types_globals_metadata::I32'
31+
// gdbr-command:whatis basic_types_globals_metadata::I32
2632
// gdb-check:type = i32
27-
// gdb-command:whatis 'basic_types_globals_metadata::I64'
33+
// gdbg-command:whatis 'basic_types_globals_metadata::I64'
34+
// gdbr-command:whatis basic_types_globals_metadata::I64
2835
// gdb-check:type = i64
29-
// gdb-command:whatis 'basic_types_globals_metadata::U'
36+
// gdbg-command:whatis 'basic_types_globals_metadata::U'
37+
// gdbr-command:whatis basic_types_globals_metadata::U
3038
// gdb-check:type = usize
31-
// gdb-command:whatis 'basic_types_globals_metadata::U8'
39+
// gdbg-command:whatis 'basic_types_globals_metadata::U8'
40+
// gdbr-command:whatis basic_types_globals_metadata::U8
3241
// gdb-check:type = u8
33-
// gdb-command:whatis 'basic_types_globals_metadata::U16'
42+
// gdbg-command:whatis 'basic_types_globals_metadata::U16'
43+
// gdbr-command:whatis basic_types_globals_metadata::U16
3444
// gdb-check:type = u16
35-
// gdb-command:whatis 'basic_types_globals_metadata::U32'
45+
// gdbg-command:whatis 'basic_types_globals_metadata::U32'
46+
// gdbr-command:whatis basic_types_globals_metadata::U32
3647
// gdb-check:type = u32
37-
// gdb-command:whatis 'basic_types_globals_metadata::U64'
48+
// gdbg-command:whatis 'basic_types_globals_metadata::U64'
49+
// gdbr-command:whatis basic_types_globals_metadata::U64
3850
// gdb-check:type = u64
39-
// gdb-command:whatis 'basic_types_globals_metadata::F32'
51+
// gdbg-command:whatis 'basic_types_globals_metadata::F32'
52+
// gdbr-command:whatis basic_types_globals_metadata::F32
4053
// gdb-check:type = f32
41-
// gdb-command:whatis 'basic_types_globals_metadata::F64'
54+
// gdbg-command:whatis 'basic_types_globals_metadata::F64'
55+
// gdbr-command:whatis basic_types_globals_metadata::F64
4256
// gdb-check:type = f64
4357
// gdb-command:continue
4458

src/test/debuginfo/basic-types-globals.rs

+30-15
Original file line numberDiff line numberDiff line change
@@ -18,33 +18,48 @@
1818

1919
// compile-flags:-g
2020
// gdb-command:run
21-
// gdb-command:print 'basic_types_globals::B'
21+
// gdbg-command:print 'basic_types_globals::B'
22+
// gdbr-command:print B
2223
// gdb-check:$1 = false
23-
// gdb-command:print 'basic_types_globals::I'
24+
// gdbg-command:print 'basic_types_globals::I'
25+
// gdbr-command:print I
2426
// gdb-check:$2 = -1
25-
// gdb-command:print 'basic_types_globals::C'
26-
// gdb-check:$3 = 97
27-
// gdb-command:print/d 'basic_types_globals::I8'
27+
// gdbg-command:print 'basic_types_globals::C'
28+
// gdbr-command:print C
29+
// gdbg-check:$3 = 97
30+
// gdbr-check:$3 = 97 'a'
31+
// gdbg-command:print/d 'basic_types_globals::I8'
32+
// gdbr-command:print I8
2833
// gdb-check:$4 = 68
29-
// gdb-command:print 'basic_types_globals::I16'
34+
// gdbg-command:print 'basic_types_globals::I16'
35+
// gdbr-command:print I16
3036
// gdb-check:$5 = -16
31-
// gdb-command:print 'basic_types_globals::I32'
37+
// gdbg-command:print 'basic_types_globals::I32'
38+
// gdbr-command:print I32
3239
// gdb-check:$6 = -32
33-
// gdb-command:print 'basic_types_globals::I64'
40+
// gdbg-command:print 'basic_types_globals::I64'
41+
// gdbr-command:print I64
3442
// gdb-check:$7 = -64
35-
// gdb-command:print 'basic_types_globals::U'
43+
// gdbg-command:print 'basic_types_globals::U'
44+
// gdbr-command:print U
3645
// gdb-check:$8 = 1
37-
// gdb-command:print/d 'basic_types_globals::U8'
46+
// gdbg-command:print/d 'basic_types_globals::U8'
47+
// gdbr-command:print U8
3848
// gdb-check:$9 = 100
39-
// gdb-command:print 'basic_types_globals::U16'
49+
// gdbg-command:print 'basic_types_globals::U16'
50+
// gdbr-command:print U16
4051
// gdb-check:$10 = 16
41-
// gdb-command:print 'basic_types_globals::U32'
52+
// gdbg-command:print 'basic_types_globals::U32'
53+
// gdbr-command:print U32
4254
// gdb-check:$11 = 32
43-
// gdb-command:print 'basic_types_globals::U64'
55+
// gdbg-command:print 'basic_types_globals::U64'
56+
// gdbr-command:print U64
4457
// gdb-check:$12 = 64
45-
// gdb-command:print 'basic_types_globals::F32'
58+
// gdbg-command:print 'basic_types_globals::F32'
59+
// gdbr-command:print F32
4660
// gdb-check:$13 = 2.5
47-
// gdb-command:print 'basic_types_globals::F64'
61+
// gdbg-command:print 'basic_types_globals::F64'
62+
// gdbr-command:print F64
4863
// gdb-check:$14 = 3.5
4964
// gdb-command:continue
5065

0 commit comments

Comments
 (0)