aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/lib/future.exp
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2016-04-26 19:38:43 -0600
committerTom Tromey <tom@tromey.com>2016-05-17 12:02:01 -0600
commit67218854b1987d89593ccaf5feaf5b29b1b976f2 (patch)
tree8137e1713d27a507dfc57015308f44166543ffc6 /gdb/testsuite/lib/future.exp
parentc44af4ebc000f606d16b42224cba2cfe80391d5c (diff)
downloadgdb-67218854b1987d89593ccaf5feaf5b29b1b976f2.zip
gdb-67218854b1987d89593ccaf5feaf5b29b1b976f2.tar.gz
gdb-67218854b1987d89593ccaf5feaf5b29b1b976f2.tar.bz2
Update gdb test suite for Rust
This updates the gdb test suite for Rust. 2016-05-17 Tom Tromey <tom@tromey.com> Manish Goregaokar <manishsmail@gmail.com> * lib/rust-support.exp: New file. * lib/gdb.exp (skip_rust_tests): New proc. (build_executable_from_specs): Handle rust. * lib/future.exp (gdb_find_rustc): New proc. (gdb_default_target_compile): Handle rust. * gdb.rust/expr.exp: New file. * gdb.rust/generics.exp: New file. * gdb.rust/generics.rs: New file. * gdb.rust/methods.exp: New file. * gdb.rust/methods.rs: New file. * gdb.rust/modules.exp: New file. * gdb.rust/modules.rs: New file. * gdb.rust/simple.exp: New file. * gdb.rust/simple.rs: New file.
Diffstat (limited to 'gdb/testsuite/lib/future.exp')
-rw-r--r--gdb/testsuite/lib/future.exp46
1 files changed, 45 insertions, 1 deletions
diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp
index 4f771b8..2ecff2e 100644
--- a/gdb/testsuite/lib/future.exp
+++ b/gdb/testsuite/lib/future.exp
@@ -105,6 +105,22 @@ proc gdb_find_go_linker {} {
return [find_go]
}
+proc gdb_find_rustc {} {
+ global tool_root_dir
+ if {![is_remote host]} {
+ set rustc [lookfor_file $tool_root_dir rustc]
+ if {$rustc == ""} {
+ set rustc rustc
+ }
+ } else {
+ set rustc ""
+ }
+ if {$rustc != ""} {
+ append rustc " --color never"
+ }
+ return $rustc
+}
+
proc gdb_find_ldd {} {
global LDD_FOR_TARGET
if [info exists LDD_FOR_TARGET] {
@@ -262,6 +278,18 @@ proc gdb_default_target_compile {source destfile type options} {
}
}
+ if { $i == "rust" } {
+ set compiler_type "rust"
+ if {[board_info $dest exists rustflags]} {
+ append add_flags " [target_info rustflags]"
+ }
+ if {[board_info $dest exists rustflags]} {
+ set compiler [target_info rustflags]
+ } else {
+ set compiler [find_rustc]
+ }
+ }
+
if {[regexp "^dest=" $i]} {
regsub "^dest=" $i "" tmp
if {[board_info $tmp exists name]} {
@@ -324,6 +352,7 @@ proc gdb_default_target_compile {source destfile type options} {
global GNATMAKE_FOR_TARGET
global GO_FOR_TARGET
global GO_LD_FOR_TARGET
+ global RUSTC_FOR_TARGET
if {[info exists GNATMAKE_FOR_TARGET]} {
if { $compiler_type == "ada" } {
@@ -370,6 +399,12 @@ proc gdb_default_target_compile {source destfile type options} {
}
}
+ if {[info exists RUSTC_FOR_TARGET]} {
+ if {$compiler_type == "rust"} {
+ set compiler $RUSTC_FOR_TARGET
+ }
+ }
+
if { $type == "executable" && $linker != "" } {
set compiler $linker
}
@@ -388,7 +423,11 @@ proc gdb_default_target_compile {source destfile type options} {
}
if {$type == "object"} {
- append add_flags " -c"
+ if {$compiler_type == "rust"} {
+ append add_flags "--emit obj"
+ } else {
+ append add_flags " -c"
+ }
}
if { $type == "preprocess" } {
@@ -605,6 +644,11 @@ if {[info procs find_gdc] == ""} {
set use_gdb_compile 1
}
+if {[info procs find_rustc] == ""} {
+ rename gdb_find_rustc find_rustc
+ set use_gdb_compile 1
+}
+
if {$use_gdb_compile} {
catch {rename default_target_compile {}}
rename gdb_default_target_compile default_target_compile