From: Tom Tromey Date: Fri, 12 May 2017 01:50:47 +0000 (-0600) Subject: Fix rust_dump_subexp_body X-Git-Tag: binutils-2_29~545 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=68f2f2e308a8585c39ddb2f391a9ae8d779c5029;p=thirdparty%2Fbinutils-gdb.git 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 * rust-lang.c (rust_dump_subexp_body) : Fix. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b4caf1f43d9..c2d3f2d3dac 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2017-05-12 Tom Tromey + + * rust-lang.c (rust_dump_subexp_body) : Fix. + 2017-05-12 Tom Tromey * rust-lang.c (rust_print_subexp): Replace "return" with "break". diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index dc48ff9dbf7..b4a529d58a4 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: