diff --git a/gdb/ChangeLog b/gdb/ChangeLog index de4ca2e7e0..723ed2ca1a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2015-07-08 Robert O'Callahan + + PR exp/18617 + * ax-gdb.c (gen_conversion): Extend to 'to' bits, not 'from'. + 2015-07-08 Markus Metzger * MAINTAINERS (Write After Approval): Add Markus T. Metzger. diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c index 7a9d1e7a8f..38dacac846 100644 --- a/gdb/ax-gdb.c +++ b/gdb/ax-gdb.c @@ -885,7 +885,7 @@ gen_conversion (struct agent_expr *ax, struct type *from, struct type *to) /* If we're converting to a narrower type, then we need to clear out the upper bits. */ if (TYPE_LENGTH (to) < TYPE_LENGTH (from)) - gen_extend (ax, from); + gen_extend (ax, to); /* If the two values have equal width, but different signednesses, then we need to extend. */ diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index c5386b2830..285bf2cf6b 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-07-08 Robert O'Callahan + + PR exp/18617 + * gdb.trace/ax.exp: Add test. + 2015-07-07 Yao Qi * gdb.arch/aarch64-atomic-inst.exp: Check is_aarch64_target diff --git a/gdb/testsuite/gdb.trace/ax.exp b/gdb/testsuite/gdb.trace/ax.exp index e3d0479d92..d0644756fb 100644 --- a/gdb/testsuite/gdb.trace/ax.exp +++ b/gdb/testsuite/gdb.trace/ax.exp @@ -80,6 +80,8 @@ gdb_test "maint agent &gdb_long_test == &gdb_short_test" "" "maint agent &gdb_lo gdb_test "maint agent &gdb_long_test < &gdb_short_test" "" "maint agent &gdb_long_test < &gdb_short_test" +gdb_test "maint agent (unsigned char)1L" ".*ext 8.*" "maint agent (unsigned char)1L" + # Now test eval version of agent expressions. gdb_test "maint agent-eval 12" ".*const8 12.*end.*" "maint agent-eval 12"