diff options
author | Tom Tromey <tom@tromey.com> | 2017-10-02 13:47:15 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-10-02 14:06:48 -0600 |
commit | b3e3859bc577db5b79bb3d39048fd46c0a0420ef (patch) | |
tree | dd763223288447e29296b120520b709e4020dded /gdb/testsuite/gdb.rust | |
parent | 01af5e0d09ac9c621e7b280f44a2c7ef55784493 (diff) | |
download | gdb-b3e3859bc577db5b79bb3d39048fd46c0a0420ef.zip gdb-b3e3859bc577db5b79bb3d39048fd46c0a0420ef.tar.gz gdb-b3e3859bc577db5b79bb3d39048fd46c0a0420ef.tar.bz2 |
Fix ptype of Rust slices
Something like "ptype &x[..]" (where "x" was a slice) would crash gdb.
rust_subscript wasn't handling slicing in the EVAL_AVOID_SIDE_EFFECTS
case.
2017-10-02 Tom Tromey <tom@tromey.com>
* rust-lang.c (rust_subscript): Handle slices in
EVAL_AVOID_SIDE_EFFECTS case.
2017-10-02 Tom Tromey <tom@tromey.com>
* gdb.rust/simple.exp: Test ptype of a slice.
Diffstat (limited to 'gdb/testsuite/gdb.rust')
-rw-r--r-- | gdb/testsuite/gdb.rust/simple.exp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.rust/simple.exp b/gdb/testsuite/gdb.rust/simple.exp index 1a46317..b01841f 100644 --- a/gdb/testsuite/gdb.rust/simple.exp +++ b/gdb/testsuite/gdb.rust/simple.exp @@ -85,6 +85,25 @@ gdb_test "print fromslice" " = 3" gdb_test "print slice\[0\]" " = 3" gdb_test "print slice as &\[i32\]\[0\]" " = 3" +gdb_test_sequence "ptype slice" "" { + " = struct &\\\[i32\\\] \\{" + " data_ptr: i32 \\*," + " length: usize," + "\\}" +} +gdb_test_sequence "ptype &slice\[..\]" "" { + " = struct &\\\[i32\\\] \\{" + " data_ptr: i32 \\*," + " length: usize," + "\\}" +} +gdb_test_sequence "ptype &b\[..\]" "" { + " = struct &\\\[\\*gdb\\*\\\] \\{" + " data_ptr: i32 \\*," + " length: usize," + "\\}" +} + gdb_test "print x" " = \\(23, 25\\.5\\)" gdb_test "ptype x" " = \\(i32, f64\\)" gdb_test "print x as (i32,f64)" " = \\(23, 25\\.5\\)" |