diff options
author | Tom Tromey <tom@tromey.com> | 2017-05-21 17:00:10 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-05-21 17:02:16 -0600 |
commit | e6cf65f283b8be44014fad0ad0aebfbcc71fceac (patch) | |
tree | 54803ee7f0e6635475b02382e79649c2786281aa /gdb/rust-lang.c | |
parent | 56298620acb02ab589ce3ddf398788227ab20211 (diff) | |
download | gdb-e6cf65f283b8be44014fad0ad0aebfbcc71fceac.zip gdb-e6cf65f283b8be44014fad0ad0aebfbcc71fceac.tar.gz gdb-e6cf65f283b8be44014fad0ad0aebfbcc71fceac.tar.bz2 |
Print Rust unsized array types a bit more nicely
It's a bit difficult to create an unsized array type in Rust, but if
you do, right now ptype will show something like "[u8; ]". It really
should print "[u8]", though, which is what this patch implements.
This is part of PR 21466.
Built and regtested on x86-64 Fedora 25. I'm checking this in.
ChangeLog
2017-05-21 Tom Tromey <tom@tromey.com>
PR rust/21466:
* rust-lang.c (rust_print_type) <TYPE_CODE_ARRAY>: Print unsized
arrays as "[T]", not "[T; ]".
testsuite/ChangeLog
2017-05-21 Tom Tromey <tom@tromey.com>
PR rust/21466:
* gdb.rust/unsized.exp: New file.
* gdb.rust/unsized.rs: New file.
Diffstat (limited to 'gdb/rust-lang.c')
-rw-r--r-- | gdb/rust-lang.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index dce184c..d4cda1f 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -893,13 +893,12 @@ rust_print_type (struct type *type, const char *varstring, fputs_filtered ("[", stream); rust_print_type (TYPE_TARGET_TYPE (type), NULL, stream, show - 1, level, flags); - fputs_filtered ("; ", stream); if (TYPE_HIGH_BOUND_KIND (TYPE_INDEX_TYPE (type)) == PROP_LOCEXPR || TYPE_HIGH_BOUND_KIND (TYPE_INDEX_TYPE (type)) == PROP_LOCLIST) - fprintf_filtered (stream, "variable length"); + fprintf_filtered (stream, "; variable length"); else if (get_array_bounds (type, &low_bound, &high_bound)) - fprintf_filtered (stream, "%s", + fprintf_filtered (stream, "; %s", plongest (high_bound - low_bound + 1)); fputs_filtered ("]", stream); } |