Allow subscripting raw pointers
This will be useful for dealing with vectors; regardless of our final solution for the Index trait. 2016-07-06 Manish Goregaokar <manish@mozilla.com> gdb/ChangeLog: * rust-lang.c (rust_subscript): Allow subscripting pointers gdb/testsuite/ChangeLog: * simple.rs: Add test for raw pointer subscripting * simple.exp: Add test expectations
This commit is contained in:
parent
6949d8a719
commit
42d940118a
5 changed files with 17 additions and 0 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2016-07-06 Manish Goregaokar <manish@mozilla.com>
|
||||||
|
|
||||||
|
* rust-lang.c (rust_subscript): Allow subscripting pointers
|
||||||
|
|
||||||
2016-07-05 Jan Kratochvil <jan.kratochvil@redhat.com>
|
2016-07-05 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
* configure: Regenerate.
|
* configure: Regenerate.
|
||||||
|
|
|
@ -1415,6 +1415,12 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside,
|
||||||
low_bound = 0;
|
low_bound = 0;
|
||||||
high_bound = value_as_long (len);
|
high_bound = value_as_long (len);
|
||||||
}
|
}
|
||||||
|
else if (TYPE_CODE (type) == TYPE_CODE_PTR)
|
||||||
|
{
|
||||||
|
base = lhs;
|
||||||
|
low_bound = 0;
|
||||||
|
high_bound = LONGEST_MAX;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
error (_("Cannot subscript non-array type"));
|
error (_("Cannot subscript non-array type"));
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2016-07-06 Manish Goregaokar <manish@mozilla.com>
|
||||||
|
|
||||||
|
* simple.rs: Add test for raw pointer subscripting
|
||||||
|
* simple.exp: Add test expectations
|
||||||
|
|
||||||
2016-07-05 Yao Qi <yao.qi@linaro.org>
|
2016-07-05 Yao Qi <yao.qi@linaro.org>
|
||||||
|
|
||||||
* gdb.mi/mi-reverse.exp: Match =record-started output.
|
* gdb.mi/mi-reverse.exp: Match =record-started output.
|
||||||
|
|
|
@ -73,6 +73,7 @@ gdb_test "print w" " = \\\[1, 2, 3, 4\\\]"
|
||||||
gdb_test "ptype w" " = \\\[i32; 4\\\]"
|
gdb_test "ptype w" " = \\\[i32; 4\\\]"
|
||||||
gdb_test "print w\[2\]" " = 3"
|
gdb_test "print w\[2\]" " = 3"
|
||||||
gdb_test "print w\[2\] @ 2" " = \\\[3, 4\\\]"
|
gdb_test "print w\[2\] @ 2" " = \\\[3, 4\\\]"
|
||||||
|
gdb_test "print w_ptr\[2\]" " = 3"
|
||||||
gdb_test "print fromslice" " = 3"
|
gdb_test "print fromslice" " = 3"
|
||||||
gdb_test "print slice\[0\]" " = 3"
|
gdb_test "print slice\[0\]" " = 3"
|
||||||
gdb_test "print slice as &\[i32\]\[0\]" " = 3"
|
gdb_test "print slice as &\[i32\]\[0\]" " = 3"
|
||||||
|
|
|
@ -87,6 +87,7 @@ fn main () {
|
||||||
|
|
||||||
let v = Something::Three;
|
let v = Something::Three;
|
||||||
let w = [1,2,3,4];
|
let w = [1,2,3,4];
|
||||||
|
let w_ptr = &w[0];
|
||||||
let x = (23, 25.5);
|
let x = (23, 25.5);
|
||||||
let y = HiBob {field1: 7, field2: 8};
|
let y = HiBob {field1: 7, field2: 8};
|
||||||
let z = ByeBob(7, 8);
|
let z = ByeBob(7, 8);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue