diff options
author | Manish Goregaokar <manish@mozilla.com> | 2016-07-06 10:55:10 +0530 |
---|---|---|
committer | Manish Goregaokar <manish@mozilla.com> | 2016-07-06 10:56:21 +0530 |
commit | 42d940118a6372d6e85f71a54fed75fdf5c606bd (patch) | |
tree | c20163aacfb47e8e467b3db13f0a889a65b53406 /gdb/rust-lang.c | |
parent | 6949d8a719659ee6003aff0c90d03ae81489cab3 (diff) | |
download | gdb-42d940118a6372d6e85f71a54fed75fdf5c606bd.zip gdb-42d940118a6372d6e85f71a54fed75fdf5c606bd.tar.gz gdb-42d940118a6372d6e85f71a54fed75fdf5c606bd.tar.bz2 |
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
Diffstat (limited to 'gdb/rust-lang.c')
-rw-r--r-- | gdb/rust-lang.c | 6 |
1 files changed, 6 insertions, 0 deletions
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")); |