From 42d940118a6372d6e85f71a54fed75fdf5c606bd Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Wed, 6 Jul 2016 10:55:10 +0530 Subject: 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 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 --- gdb/rust-lang.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gdb/rust-lang.c') diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index 1849349..17b20c6 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -1415,6 +1415,12 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside, low_bound = 0; high_bound = value_as_long (len); } + else if (TYPE_CODE (type) == TYPE_CODE_PTR) + { + base = lhs; + low_bound = 0; + high_bound = LONGEST_MAX; + } else error (_("Cannot subscript non-array type")); -- cgit v1.1