diff options
author | Tom Tromey <tom@tromey.com> | 2017-07-14 08:10:39 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-07-14 12:30:56 -0600 |
commit | 8880f2a9cb5151ce1c2714a75d123ba0f63668ac (patch) | |
tree | eeeb99b36c6ddea814112fc1b465cb317a42f2d9 /gdb/testsuite | |
parent | 65547233e04b32e087f74f8f5e9d3ffb6fe2c198 (diff) | |
download | binutils-gdb-8880f2a9cb5151ce1c2714a75d123ba0f63668ac.tar.gz |
Handle sizeof(type) in Rust
PR rust/21764 notes that "sizeof" does not work correctly for all types
in Rust. The bug turns out to be an error in the conversion of the AST
to gdb expressions. This patch fixes the bug and also avoids generating
incorrect expressions in another case.
Tested on the buildbot. I'm checking this in.
2017-07-14 Tom Tromey <tom@tromey.com>
PR rust/21764:
* rust-exp.y (convert_ast_to_expression): Add "want_type"
parameter.
<UNOP_SIZEOF>: Split into separate case.
<UNOP_VAR_VALUE>: Handle want_type. Add error case.
2017-07-14 Tom Tromey <tom@tromey.com>
PR rust/21764:
* gdb.rust/simple.exp: Add tests.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.rust/simple.exp | 3 |
2 files changed, 8 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index b715bfd7fe1..3fac8daa06b 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2017-07-14 Tom Tromey <tom@tromey.com> + PR rust/21764: + * gdb.rust/simple.exp: Add tests. + +2017-07-14 Tom Tromey <tom@tromey.com> + * gdb.rust/simple.exp: Add regression test for PR rust/21763. 2017-07-14 Pedro Alves <palves@redhat.com> diff --git a/gdb/testsuite/gdb.rust/simple.exp b/gdb/testsuite/gdb.rust/simple.exp index db231623a4d..83dab170229 100644 --- a/gdb/testsuite/gdb.rust/simple.exp +++ b/gdb/testsuite/gdb.rust/simple.exp @@ -135,6 +135,9 @@ gdb_test "print simple::ByeBob\{field1: 0xff, field2:5\}" \ gdb_test "print simple::HiBob(0xff, 5)" \ "Type simple::HiBob is not a tuple struct" +gdb_test "print sizeof(simple::HiBob)" " = \[0-9\]+" +gdb_test "print simple::HiBob + 5" \ + "Found type 'simple::HiBob', which can't be evaluated in this context" gdb_test "print nosuchsymbol" \ "No symbol 'nosuchsymbol' in current context" |