aboutsummaryrefslogtreecommitdiff
path: root/gdb/rust-lang.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-05-11 19:50:47 -0600
committerTom Tromey <tom@tromey.com>2017-05-12 08:52:55 -0600
commit68f2f2e308a8585c39ddb2f391a9ae8d779c5029 (patch)
tree1881748e66801a38a7055aab44336011a628c737 /gdb/rust-lang.c
parent256afbc259c1e22fafba601a27cf3c8d7bdde417 (diff)
downloadgdb-68f2f2e308a8585c39ddb2f391a9ae8d779c5029.zip
gdb-68f2f2e308a8585c39ddb2f391a9ae8d779c5029.tar.gz
gdb-68f2f2e308a8585c39ddb2f391a9ae8d779c5029.tar.bz2
Fix rust_dump_subexp_body
rust_dump_subexp_body was not correct in a couple of cases. While debugging the bug I was really interested in, this caused a crash. This patch fixes the problems. No test case because, IIRC there generally aren't tests for expression dumping. ChangeLog 2017-05-12 Tom Tromey <tom@tromey.com> * rust-lang.c (rust_dump_subexp_body) <STRUCTOP_ANONYMOUS, OP_RUST_ARRAY>: Fix.
Diffstat (limited to 'gdb/rust-lang.c')
-rw-r--r--gdb/rust-lang.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index dc48ff9..b4a529d 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -1951,14 +1951,15 @@ rust_dump_subexp_body (struct expression *exp, struct ui_file *stream,
{
int field_number;
- field_number = longest_to_int (exp->elts[elt].longconst);
+ field_number = longest_to_int (exp->elts[elt + 1].longconst);
fprintf_filtered (stream, "Field number: %d", field_number);
- elt = dump_subexp (exp, stream, elt + 2);
+ elt = dump_subexp (exp, stream, elt + 3);
}
break;
case OP_RUST_ARRAY:
+ ++elt;
break;
default: